RegressionTests__FormDrawingTests.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 1899 f44a3e659f0d
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding

"{ 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$'
! !