[Seaside] Updated ColorValue>>fromString: to support 3-digit notation

Boris Popov boris at deepcovelabs.com
Fri Jul 4 19:13:10 UTC 2008


I had just updated fromString method to support three-digit notation and
pass the following test case, was thinking it might be useful to
someone, but again, can't quite say if this is something Cincom folks
need to integrate in their branch of Squeak-Extensions or something that
should go into Squeak's version, so don't jump on my case for
cross-posting please ;)

testColorFromString
	
 self assert: (ColorValue fromString: 'ff0000') = ColorValue red.
 self assert: (ColorValue fromString: 'FF0000') = ColorValue red.
 self assert: (ColorValue fromString: '#ff0000') = ColorValue red.
 self assert: (ColorValue fromString: '#FF0000') = ColorValue red.
 self assert: (ColorValue fromString: 'f00') = ColorValue red.
 self assert: (ColorValue fromString: 'F00') = ColorValue red.
 self assert: (ColorValue fromString: '#f00') = ColorValue red.
 self assert: (ColorValue fromString: '#F00') = ColorValue red.
 self assert: (ColorValue fromString: 'red') = ColorValue red.
 self assert: (ColorValue fromString: 'RED') = ColorValue red.
 self assert: (ColorValue fromString: '#red') = ColorValue red.
 self assert: (ColorValue fromString: '#RED') = ColorValue red.

Cheers,

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris at deepcovelabs.com

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ColorValue class-fromString.st
Type: application/octet-stream
Size: 1041 bytes
Desc: ColorValue class-fromString.st
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080704/a473dd09/ColorValueclass-fromString.obj


More information about the seaside mailing list