RegressionTests__ImageTests.st
changeset 1686 976a342e6acf
parent 1678 82d861aedadd
child 1687 30597c99b668
--- a/RegressionTests__ImageTests.st	Tue Aug 22 17:55:10 2017 +0200
+++ b/RegressionTests__ImageTests.st	Tue Aug 22 18:39:46 2017 +0200
@@ -30,27 +30,62 @@
 
 !ImageTests methodsFor:'tests'!
 
-testFillWhite
-    |depths colors rectangle|
+testFillRectangle1
+    |depths|
 
     "/ So far not really supported for other depths (at least not in this straightforward way).
-    depths := { 24. 32 }.
-    colors := { Color red. Color green. Color blue. Color white. Color black }.
-    rectangle := Rectangle left:0 top:0 width:1 height:1.
-
-    depths do:[ :depth |
+    depths := { 24 . 32 }.
+    depths do:[:depth | 
         |img|
 
         img := Image extent:1@1 depth:depth.
         img createPixelStore.
 
-        colors do:[ :color |
+        self assert:(img bits at:1) == 0.
+        self assert:(img bits at:2) == 0.
+        self assert:(img bits at:3) == 0.
+        img 
+            pixelAtX:0
+            y:0
+            put:16rFF0000.
+        self assert:(img bits at:1) == 16rFF.
+        self assert:(img bits at:2) == 0.
+        self assert:(img bits at:3) == 0.
+    ].
+
+    "Created: / 22-08-2017 / 18:38:52 / mawalch"
+!
+
+testFillRectangle2
+    |depths colors rectangle|
+
+    "/ So far not really supported for other depths (at least not in this straightforward way).
+    depths := { 24 . 32 }.
+    colors := {
+            Color red.
+            Color green.
+            Color blue.
+            Color white.
+            Color black
+        }.
+    rectangle := Rectangle 
+            left:0
+            top:0
+            width:1
+            height:1.
+    depths do:[:depth | 
+        |img|
+
+        img := Image extent:1 @ 1 depth:depth.
+        img createPixelStore.
+        colors do:[:color | 
             img fillRectangle:rectangle withColor:color.
-            self assert:((img colorAt:0@0) = color).
+            self assert:((img colorAt:0 @ 0) = color).
         ].
     ].
 
     "Created: / 22-08-2017 / 17:30:55 / mawalch"
+    "Modified: / 22-08-2017 / 18:37:41 / mawalch"
 ! !
 
 !ImageTests class methodsFor:'documentation'!