RegressionTests__ImageTests.st
changeset 1689 a026f67f0767
parent 1688 62ad31c3a464
child 2329 6763cf01c241
--- a/RegressionTests__ImageTests.st	Tue Aug 22 18:55:23 2017 +0200
+++ b/RegressionTests__ImageTests.st	Tue Aug 22 18:58:19 2017 +0200
@@ -200,6 +200,49 @@
     ].
 
     "Created: / 22-08-2017 / 18:45:44 / cg"
+!
+
+test10_FillRectangle_palette
+    |img depths colors rectangle|
+
+    depths := { 2 . 4 . 8 }.
+    colors := {
+            Color red.
+            Color green.
+            Color blue.
+            Color white.
+        }.
+        
+    rectangle := Rectangle left:0 top:0 width:1 height:1.
+            
+    depths do:[:depth | 
+        img := Image extent:1 @ 1 depth:depth.
+        img photometric:#palette.
+        img colorMap:colors.
+        
+        img createPixelStore.
+        colors do:[:color | 
+            img fillRectangle:rectangle withColor:color.
+            self assert:((img colorAt:0 @ 0) = color).
+        ].
+    ].
+
+    colors := {
+            Color red.
+            Color green.
+        }.
+
+    img := Image extent:1 @ 1 depth:1.
+    img photometric:#palette.
+    img colorMap:colors.
+
+    img createPixelStore.
+    colors do:[:color | 
+        img fillRectangle:rectangle withColor:color.
+        self assert:((img colorAt:0 @ 0) = color).
+    ].
+
+    "Created: / 22-08-2017 / 18:57:19 / cg"
 ! !
 
 !ImageTests class methodsFor:'documentation'!