[squeak-dev] The Trunk: GraphicsTests-pre.47.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Oct 15 08:30:42 UTC 2018


Patrick Rein uploaded a new version of GraphicsTests to project The Trunk:
http://source.squeak.org/trunk/GraphicsTests-pre.47.mcz

==================== Summary ====================

Name: GraphicsTests-pre.47
Author: pre
Time: 15 October 2018, 9:30:12.460742 am
UUID: bf438d26-c2ca-1a49-8877-d78c853b6c8e
Ancestors: GraphicsTests-ul.46

Adds a test which checks whether the Color instance creation methods use consistent rounding.

Also re-categorizes the test methods.

=============== Diff against GraphicsTests-ul.46 ===============

Item was changed:
  SystemOrganization addCategory: #'GraphicsTests-Files'!
  SystemOrganization addCategory: #'GraphicsTests-Primitives'!
+ SystemOrganization addCategory: #'GraphicsTests-Transformations'!
  SystemOrganization addCategory: #'GraphicsTests-Text'!

Item was changed:
+ ----- Method: ColorTest>>testAsHTMLColor (in category 'tests') -----
- ----- Method: ColorTest>>testAsHTMLColor (in category 'testing') -----
  testAsHTMLColor
  
  	| table aColorString |
  	table := #('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'A' 'B' 'C' 'D' 'E' 'F').
  
  	table do: [ :each |
  		aColorString := '#', each, each, '0000'.
  		self assert: (Color fromString: aColorString) asHTMLColor equals: aColorString].
  
  	table do: [ :each |
  		aColorString := '#', '00', each, each, '00'.
  		self assert: (Color fromString: aColorString) asHTMLColor equals: aColorString].
  
  	table do: [ :each |
  		aColorString := '#', '0000', each, each.
  		self assert: (Color fromString: aColorString) asHTMLColor equals: aColorString].
  
  	table do: [ :each |
  		aColorString := '#', each, each, each, each, each, each.
  		self assert: (Color fromString: aColorString) asHTMLColor equals: aColorString].
  	
  	table do: [ :each |
  		aColorString := '#', each, each, each, each, each, each, each, each.
  		each = 'F'
  			ifTrue: [self assert: (Color fromString: aColorString) asHTMLColor equals: '#FFFFFF' description: 'For full alpha channel the no alpha color is used']
  			ifFalse: [self assert: (Color fromString: aColorString) asHTMLColor equals: aColorString]].!

Item was changed:
+ ----- Method: ColorTest>>testColorFrom (in category 'tests') -----
- ----- Method: ColorTest>>testColorFrom (in category 'testing') -----
  testColorFrom
  	self assert: ((Color colorFrom: #white) asHTMLColor sameAs: '#ffffff').
  	self assert: ((Color colorFrom: #(1.0 0.5 0.0)) asHTMLColor sameAs: '#ff8000').
  	self assert: ((Color colorFrom: (Color white)) asHTMLColor sameAs: '#ffffff').
  	self assert: ((Color colorFrom: '#FF8800') asHTMLColor sameAs: '#ff8800').
  	self assert: ((Color colorFrom: '#222222') asHTMLColor sameAs: '#222222').!

Item was added:
+ ----- Method: ColorTest>>testConstructorsAreConsistent (in category 'testing') -----
+ testConstructorsAreConsistent
+ 	
+ 	"Color seaFoam asHTMLColor".
+ 	self assert: (Color r: 0 g: 1 b: 128/255) equals: (Color fromString: '#00FF80').
+ 	self assert: (Color r: 0 g: 1 b: 128/255) equals: (Color r: 0 g: 255 b: 128 range: 255).!

Item was changed:
+ ----- Method: ColorTest>>testFromString (in category 'tests') -----
- ----- Method: ColorTest>>testFromString (in category 'testing') -----
  testFromString
  	self assert: ((Color fromString: '#FF8800') asHTMLColor sameAs: '#ff8800');
  		assert: ((Color fromString: 'FF8800') asHTMLColor sameAs: '#ff8800');
  		assert: ((Color fromString: '126,42,33') asHTMLColor sameAs:  '#7E2A21');
  		assert: ((Color fromString: '00000000') asHTMLColor sameAs: '#00000000'); "html with alpha channel"
  		assert: ((Color fromString: '#8C500BAE') asHTMLColor sameAs: '#8C500BAE');
  		assert: ((Color fromString: 'white') asHTMLColor sameAs: '#ffffff');
  		assert: ((Color fromString: 'black') asHTMLColor sameAs: '#000000');
  		assert: ((Color fromString: nil) asHTMLColor sameAs: '#ffffff');
  		assert: ((Color fromString: 'inexistent color') asHTMLColor sameAs: '#ffffff'); "should return white"
  		assert: ((Color fromString: 'XXXXXX') asHTMLColor sameAs: '#ffffff') description: 'Color string should be alphanumeric';
  		assert: ((Color fromString: '000000000') asHTMLColor sameAs: '#ffffff') description: 'number string too long'. 
  		
  	self
  		assert: (Color fromString: 'DARKGRAY') = Color darkGray description: 'Color can be specified with a case insensitive color name';
  		assert: (Color fromString: '#blue') = Color blue description: 'Color can be specified with a leading literal sharp'.!

Item was changed:
+ ----- Method: ColorTest>>testHSV (in category 'tests') -----
- ----- Method: ColorTest>>testHSV (in category 'testing') -----
  testHSV
  	"Test the color wheel modulo 360"
  	
  	self assert: (Color h: 0 s: 1 v: 1) = Color red.
  	self assert: (Color h: 60 s: 1 v: 1) = Color yellow.
  	self assert: (Color h: 120 s: 1 v: 1) = Color green.
  	self assert: (Color h: 180 s: 1 v: 1) = Color cyan.
  	self assert: (Color h: 240 s: 1 v: 1) = Color blue.
  	self assert: (Color h: 300 s: 1 v: 1) = Color magenta.
  	self assert: (Color h: 0+360 s: 1 v: 1) = Color red.
  	self assert: (Color h: 120+720 s: 1 v: 1) = Color green.
  	self assert: (Color h: 180-360 s: 1 v: 1) = Color cyan.
  	self assert: (Color h: 240-720 s: 1 v: 1) = Color blue.!

Item was changed:
+ ----- Method: ColorTest>>testMultiplyByArray (in category 'tests') -----
- ----- Method: ColorTest>>testMultiplyByArray (in category 'testing') -----
  testMultiplyByArray
  	| newColor oldColor tolerance |
  	tolerance := 0.001.
  
  	oldColor := Color r: 0.75 g: 0.5 b: 0.25.
  	newColor := oldColor * #(0.1 2 3).
  
  	self assert: (0.075 - newColor red) abs < tolerance.
  	self assert: (1 - newColor green) abs < tolerance.
  	self assert: (0.75 - newColor blue) abs < tolerance.!

Item was changed:
+ ----- Method: ColorTest>>testMultiplyByArrayIdentityTransform (in category 'tests') -----
- ----- Method: ColorTest>>testMultiplyByArrayIdentityTransform (in category 'testing') -----
  testMultiplyByArrayIdentityTransform
  	| newColor oldColor tolerance |
  	tolerance := 0.001.
  
  	oldColor := Color r: 0.75 g: 0.5 b: 0.25.
  	newColor := oldColor * 2.
  
  	self assert: (1 - newColor red) abs < tolerance.
  	self assert: (1 - newColor green) abs < tolerance.
  	self assert: (0.5 - newColor blue) abs < tolerance.!

Item was changed:
+ ----- Method: ColorTest>>testMultiplyByNumber (in category 'tests') -----
- ----- Method: ColorTest>>testMultiplyByNumber (in category 'testing') -----
  testMultiplyByNumber
  	| newColor oldColor tolerance |
  	tolerance := 0.001.
  
  	oldColor := Color r: 0.75 g: 0.5 b: 0.25.
  	newColor := oldColor * 2.
  
  	self assert: (1 - newColor red) abs < tolerance.
  	self assert: (1 - newColor green) abs < tolerance.
  	self assert: (0.5 - newColor blue) abs < tolerance.!



More information about the Squeak-dev mailing list