tests/ImageTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 03 Jan 2018 22:19:22 +0000
branchjv
changeset 8269 5382a417a503
child 8420 76e39223f5ab
permissions -rw-r--r--
Issue #190: added tests for `Image class >> fromView:` and `Image class >> fromScreen:' ...which broke under XWayland since XWayland does not support `XGetImage()` https://swing.fit.cvut.cz/projects/stx-jv/ticket/190

"{ Package: 'stx:libview/tests' }"

"{ NameSpace: Smalltalk }"

TestCase subclass:#ImageTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Graphics-Images-Tests'
!


!ImageTests methodsFor:'running'!

setUp
    Screen current isNil ifTrue:[
        Smalltalk openDisplay
    ].
    self skipIf: Screen current isNil description: 'Display connection not available'

    "Created: / 25-04-2016 / 20:30:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 03-01-2018 / 21:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ImageTests methodsFor:'tests - regression'!

test_fromScreen_01
    | image |

    self skipIf: true  description: 'Image fromScreen: is broken on XWayland'.
    image := Image fromScreen.

    "Created: / 04-01-2018 / 09:22:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

test_fromView_01
    | view image |

    [ 
        view := Button new.
        view label: 'Hello world'.
        view open.
        image := Image fromView: view grab: false.  
    ] ensure:[ 
        view topView close.
    ].
    self assert: image notNil.

    "Created: / 03-01-2018 / 21:28:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ImageTests class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !