RegressionTests__ImageTests.st
changeset 1678 82d861aedadd
child 1686 976a342e6acf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RegressionTests__ImageTests.st	Tue Aug 22 17:53:02 2017 +0200
@@ -0,0 +1,65 @@
+"{ Package: 'stx:goodies/regression' }"
+
+"{ NameSpace: RegressionTests }"
+
+TestCase subclass:#ImageTests
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'tests-Regression'
+!
+
+!ImageTests class methodsFor:'documentation'!
+
+documentation
+"
+    Tests for the image classes in libview, i.e. Image,
+    Depth1Image, Depth2Image, etc.
+
+    [author:]
+        mawalch
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!ImageTests methodsFor:'tests'!
+
+testFillWhite
+    |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).
+        ].
+    ].
+
+    "Created: / 22-08-2017 / 17:30:55 / mawalch"
+! !
+
+!ImageTests class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
+! !
+