Skip to content

Commit

Permalink
Fix ColorTest rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
ClotildeToullec committed Sep 5, 2024
1 parent af05576 commit 907d210
Showing 1 changed file with 55 additions and 50 deletions.
105 changes: 55 additions & 50 deletions src/MooseIDE-Colors-Tests/ColorTest.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,61 @@ Extension { #name : #ColorTest }

{ #category : #'*MooseIDE-Colors-Tests' }
ColorTest >> testHclToLab [

self "white"
assert: (Color new hclToLab: {
#hue -> 0.
#chroma -> 0.
#luminance -> 100 } asDictionary)
equals: {
#luminance -> 100.
#a -> 0.
#b -> 0 } asDictionary.

self "black"
assert: (Color new hclToLab: {
#hue -> 0.
#chroma -> 0.
#luminance -> 0 } asDictionary)
equals: {
#luminance -> 0.
#a -> 0.
#b -> 0 } asDictionary.

self "red"
assert: (Color new hclToLab: {
#hue -> 40.85261277607024.
#chroma -> 106.83899941284552.
#luminance -> 54.29173376861782 } asDictionary)
equals: {
#luminance -> 54.29173376861782.
#a -> 80.81245531797708.
#b -> 69.8850403235053 } asDictionary.

self "green"
assert: (Color new hclToLab: {
#hue -> 134.39124580493436.
#chroma -> 113.33973051832487.
#luminance -> 87.81812823940444 } asDictionary)
equals: {
#luminance -> 87.81812823940444.
#a -> 79.28728092989569 negated.
#b -> 80.99025618375522 } asDictionary.

self "blue"
assert: (Color new hclToLab: {
#hue -> 301.368540512089.
#chroma -> 131.2070851917203.
#luminance -> 29.567572863553245 } asDictionary)
equals: {
#luminance -> 29.567572863553245.
#a -> 68.29865326565664.
#b -> 112.02942991288029 negated } asDictionary
"White"

self
assert: (Color new hclToLab: {
(#hue -> 0).
(#chroma -> 0).
(#luminance -> 100) } asDictionary)
equals: {
(#luminance -> 100).
(#a -> 0).
(#b -> 0) } asDictionary.

"Black"
self
assert: (Color new hclToLab: {
(#hue -> 0).
(#chroma -> 0).
(#luminance -> 0) } asDictionary)
equals: {
(#luminance -> 0).
(#a -> 0).
(#b -> 0) } asDictionary.

"Red"
self
assert: (Color new hclToLab: {
(#hue -> 40.85261277607024).
(#chroma -> 106.83899941284552).
(#luminance -> 54.29173376861782) } asDictionary)
equals: {
(#luminance -> 54.29173376861782).
(#a -> 80.8124553179771).
(#b -> 69.88504032350531) } asDictionary.

"Green"
self
assert: (Color new hclToLab: {
(#hue -> 134.39124580493436).
(#chroma -> 113.33973051832487).
(#luminance -> 87.81812823940444) } asDictionary)
equals: {
(#luminance -> 87.81812823940444).
(#a -> 79.2872809298957 negated).
(#b -> 80.99025618375522) } asDictionary.

"Blue"
self
assert: (Color new hclToLab: {
(#hue -> 301.368540512089).
(#chroma -> 131.2070851917203).
(#luminance -> 29.567572863553245) } asDictionary)
equals: {
(#luminance -> 29.567572863553245).
(#a -> 68.29865326565664).
(#b -> 112.02942991288029 negated) } asDictionary
]

{ #category : #'*MooseIDE-Colors-Tests' }
Expand Down

0 comments on commit 907d210

Please sign in to comment.