RegressionTests__ElectronGraphicDeviceTest.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Feb 2020 17:19:49 +0100
changeset 2586 7dc7be5a6f3d
parent 2505 f9586bc25d4a
permissions -rw-r--r--
#OTHER by cg s

"{ Encoding: utf8 }"

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#ElectronGraphicDeviceTest
	instanceVariableNames:'display'
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression-Graphics-Basic'
!

!ElectronGraphicDeviceTest class methodsFor:'documentation'!

documentation
"
    documentation to be added.

    class:
        <a short class summary here, describing what instances represent>

    responsibilities:    
        <describing what my main role is>

    collaborators:    
        <describing with whom and how I talk to>

    API:
        <public api and main messages>
        
    example:
        <a one-line examples on how to use - can also be in a separate example method>

    implementation:
        <implementation points>

    [author:]
        exept MBP

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!ElectronGraphicDeviceTest methodsFor:'tests'!

setUp
    display := ElectronWorkstation newFor:'localhost:8588'.
!

tearDown
    display notNil ifTrue:[
        display close
    ].

!

test_01_ConnectDisconnect
    self assert:(display notNil).
    self assert:(display isOpen).
    display close.
    self assert:(display isOpen not).

    "
     self new test_01_ConnectDisconnect
    "
!

test_02_Properties
    self assert:(display visualType notNil).
    display visualType == #TrueColor ifTrue:[
        self assert:(display hasColors).
        self assert:(display hasGreyscales).
    ].

    self assert:(display depth notNil).
    self assert:(display shiftRed notNil).
    self assert:(display shiftGreen notNil).
    self assert:(display shiftBlue notNil).

    self assert:(display blackpixel == 0).
    self assert:(display whitepixel == 16rFFFFFF).

    "
     self new test_02_Properties
    "
!

test_03_WindowCreation
    |v|

    v := StandardSystemView onDevice:display.
    Delay waitForSeconds:3.
    v destroy.

    "
     self new test_03_WindowCreation
    "
!

test_04_WindowCreateAndMap
    |v|

    v := StandardSystemView onDevice:display.
    v realize.
    Delay waitForSeconds:1.
    v destroy.

    "
     self new test_04_WindowCreateAndMap
    "
!

test_05_WindowResize
    |v|

    v := StandardSystemView onDevice:display.
    v extent:300@300.
    v origin:100@100.
    v realize.
    Delay waitForSeconds:1.
    "/ display bridge callFunction:'test1' withArguments:#().
    "/ Delay waitForSeconds:1.
    "/ display bridge callFunction:'test2' withArguments:#().
    "/ Delay waitForSeconds:1.
    "/ display bridge callFunction:'test3' withArguments:#().

    v extent:600@100.
    "/ display testResize:v id.
    "/ v extent:(500@500).
    "/ Delay waitForSeconds:1.
    "/ v extent:(200@200).
    Delay waitForSeconds:1.
    v destroy.

    "
     self new 
        setUp;
        test_05_WindowResize;
        tearDown
    "
!

test_06_WindowTitle
    |v|

    v := StandardSystemView onDevice:display.
    v extent:300@300.
    v realize.
    Delay waitForSeconds:1.
    v label:'AAAA'.
    Delay waitForSeconds:1.
    v label:'BBBB'.
    Delay waitForSeconds:1.
    v label:'CCCC'.
    v destroy.

    "
     self new 
        setUp;
        test_06_WindowTitle;
        tearDown
    "
!

test_07_WindowBackground
    |v|

    v := StandardSystemView onDevice:display.
    v extent:300@300.
    v realize.
    Delay waitForSeconds:1.
    v viewBackground:(Color red).
    Delay waitForSeconds:1.
    v viewBackground:(Color green).
    Delay waitForSeconds:1.
    v destroy.

    "
     self new 
        setUp;
        test_07_WindowBackground;
        tearDown
    "
!

test_08_WindowPosition
    |v|

    v := StandardSystemView onDevice:display.
    v origin:100@100.
    v extent:300@300.
    v realize.
    Delay waitForSeconds:1.
    v origin:600@100.
    Delay waitForSeconds:1.
    v origin:200@300.
    Delay waitForSeconds:1.
    v destroy.

    "
     self new 
        setUp;
        test_08_WindowPosition;
        tearDown
    "
!

test_10_Subview
    "fails: subViews are NOT browserwindows,
     but must be created as DIV in the renderer!!"

    |top v|

    top := StandardSystemView onDevice:display.
    top origin:100@100 extent:300@300.
    top viewBackground:(Color green).

    top addSubView:(v := View new).
    v origin:50@50 extent:100@100.
    v viewBackground:(Color red).

    top realize.
    Delay waitForSeconds:2.
    top destroy.

    "
     self new 
        setUp;
        test_10_Subview;
        tearDown
    "
! !

!ElectronGraphicDeviceTest class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
! !