Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions src/Cormas-Tests/CMColorTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Class {
#name : 'CMColorTest',
#superclass : 'TestCase',
#category : 'Cormas-Tests-Model',
#package : 'Cormas-Tests',
#tag : 'Model'
}

{ #category : 'tests' }
CMColorTest >> testHexString [

| color hex |

hex := 'B90E0A'.
color := CMColor fromHexString: hex.

self assert: (color isKindOf: Color).
self assert: color asHexString equals: hex
]

{ #category : 'tests' }
CMColorTest >> testRgbTriplet [

| rgb color otherColor |

rgb := #(0.73 0.05 0.04).
color := CMColor fromRgbTriplet: rgb.

otherColor := CMColor
r: rgb first
g: rgb second
b: rgb third.

self assert: (color isKindOf: Color).
self assert: otherColor equals: color.
self assert: color rgbTriplet equals: rgb
]

{ #category : 'tests' }
CMColorTest >> testUnderstandNamedColors [

self assert: (CMColor red isKindOf: Color).
self assert: (CMColor green isKindOf: Color).
self assert: (CMColor blue isKindOf: Color).
self assert: (CMColor cyan isKindOf: Color).
self assert: (CMColor yellow isKindOf: Color).
self assert: (CMColor pink isKindOf: Color).
self assert: (CMColor purple isKindOf: Color).
self assert: (CMColor orange isKindOf: Color).
self assert: (CMColor brown isKindOf: Color).
self assert: (CMColor gray isKindOf: Color).
self assert: (CMColor white isKindOf: Color).
self assert: (CMColor black isKindOf: Color)
]
2 changes: 1 addition & 1 deletion src/Cormas-UI/CMColor.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'CMColor',
#superclass : 'Object',
#superclass : 'Color',
#category : 'Cormas-UI',
#package : 'Cormas-UI'
}
Expand Down
Loading