Andreas Raab uploaded a new version of GraphicsTests to project The Trunk:
http://source.squeak.org/trunk/GraphicsTests-ar.14.mcz==================== Summary ====================
Name: GraphicsTests-ar.14
Author: ar
Time: 1 September 2009, 12:55:01 pm
UUID: f9bc21a1-1fc2-0c46-bef4-be3557e9ff83
Ancestors: GraphicsTests-edc.13
http://bugs.squeak.org/view.php?id=6936#asHTMLColor is inaccurate for certain values.
Attached fix resolves that, also gives 10x speed-up.
=============== Diff against GraphicsTests-edc.13 ===============
Item was changed:
+ ----- Method: ColorTest>>testAsHTMLColor (in category 'testing') -----
- ----- Method: ColorTest>>testAsHTMLColor (in category 'tests') -----
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 sameAs: aColorString)].
+
+ table do: [ :each |
+ aColorString := '#', '00', each, each, '00'.
+ self assert: ((Color fromString: aColorString) asHTMLColor sameAs: aColorString)].
+
+ table do: [ :each |
+ aColorString := '#', '0000', each, each.
+ self assert: ((Color fromString: aColorString) asHTMLColor sameAs: aColorString)].
+
+ table do: [ :each |
+ aColorString := '#', each, each, each, each, each, each.
+ self assert: ((Color fromString: aColorString) asHTMLColor sameAs: aColorString)].!
- self assert: (Color white asHTMLColor = '#ffffff').
- self assert: (Color black asHTMLColor = '#000000').!
Item was changed:
+ ----- Method: ColorTest>>testFromString (in category 'testing') -----
- ----- Method: ColorTest>>testFromString (in category 'tests') -----
testFromString
+ self assert: ((Color fromString: '#FF8800') asHTMLColor sameAs: '#ff8800').!
-
- self assert: ((Color fromString: '#FF8800') asHTMLColor = '#ff8800').!
Item was changed:
+ ----- Method: ColorTest>>testColorFrom (in category 'testing') -----
- ----- Method: ColorTest>>testColorFrom (in category 'tests') -----
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').!
- self assert: ((Color colorFrom: #white) asHTMLColor = '#ffffff').
- self assert: ((Color colorFrom: #(1.0 0.5 0.0)) asHTMLColor = '#ff7f00').
- self assert: ((Color colorFrom: (Color white)) asHTMLColor = '#ffffff').
- self assert: ((Color colorFrom: '#FF8800') asHTMLColor = '#ff8800').!