RegressionTests__FormDrawingTests.st
changeset 1899 f44a3e659f0d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RegressionTests__FormDrawingTests.st	Wed Mar 07 18:47:32 2018 +0100
@@ -0,0 +1,115 @@
+"{ Package: 'stx:goodies/regression' }"
+
+"{ NameSpace: RegressionTests }"
+
+TestCase subclass:#FormDrawingTests
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'tests-Regression-Graphics'
+!
+
+!FormDrawingTests class methodsFor:'documentation'!
+
+documentation
+"
+    documentation to be added.
+
+    [author:]
+        cg
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!FormDrawingTests methodsFor:'initialize / release'!
+
+setUp
+    "common setup - invoked before testing."
+
+    super setUp
+!
+
+tearDown
+    "common cleanup - invoked after testing."
+
+    super tearDown
+! !
+
+!FormDrawingTests methodsFor:'tests'!
+
+test01_copyBitmap
+    "it seems that XQuartz has trouble with that..."
+
+    |form1 form2|
+
+    form1 := Form width:16 height:16.
+    form2 := Form width:16 height:16. 
+
+    form1 fill:(Color colorId:0).
+    self assert:(form1 pixelAt:0@0) = 0.
+    self assert:(form1 pixelAt:15@15) = 0.
+
+    form2 fill:(Color colorId:1).
+    self assert:(form2 pixelAt:0@0) = 1.
+    self assert:(form2 pixelAt:15@15) = 1.
+
+    form1 function:#copy.
+    form1 copyFrom:form2 x:0 y:0 toX:0 y:0 width:16 height:16.
+
+    self assert:(form1 pixelAt:0@0) = 1.
+    self assert:(form1 pixelAt:7@7) = 1.
+    self assert:(form1 pixelAt:8@8) = 0.
+    self assert:(form1 pixelAt:15@15) = 0.
+
+    "
+     self run:#test1
+     self new test1
+    "
+!
+
+test02_copyPixmap
+    "it seems that XQuartz has trouble with that..."
+
+    |form1 form2|
+
+    form1 := Form width:16 height:16 depth:8 .
+    form2 := Form width:16 height:16 depth:8 . 
+
+    form1 fill:(Color colorId:0).
+    self assert:(form1 pixelAt:0@0) = 0.
+    self assert:(form1 pixelAt:15@15) = 0.
+
+    form2 fill:(Color colorId:1).
+    self assert:(form2 pixelAt:0@0) = 1.
+    self assert:(form2 pixelAt:15@15) = 1.
+
+    form1 function:#copy.
+    form1 copyFrom:form2 x:0 y:0 toX:0 y:0 width:8 height:8.
+
+    self assert:(form1 pixelAt:0@0) = 1.
+    self assert:(form1 pixelAt:7@7) = 1.
+    self assert:(form1 pixelAt:8@8) = 0.
+    self assert:(form1 pixelAt:15@15) = 0.
+
+    "
+     self run:#test1
+     self new test1
+    "
+! !
+
+!FormDrawingTests class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
+! !
+