tests/VDBAbstractApplicationTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 23 Jul 2019 14:53:07 +0100
changeset 181 d220862ec65f
parent 164 364ebdd1d42c
permissions -rw-r--r--
Remove launcher script on UNIX ...ie., `vdb` is the real executable, not just a script that launches it. Time have shown this laucnher script is not needed.

"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
"{ Package: 'jv:vdb/tests' }"

"{ NameSpace: Smalltalk }"

TestCase subclass:#VDBAbstractApplicationTests
	instanceVariableNames:'preferences debugger application'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-UI-Abstract-Tests'
!

!VDBAbstractApplicationTests class methodsFor:'documentation'!

copyright
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
! !

!VDBAbstractApplicationTests class methodsFor:'accessing'!

resources
    ^ Array with: GDBDebuggeesResource

    "Created: / 28-02-2015 / 00:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractApplicationTests class methodsFor:'queries'!

isAbstract
    "Return if this class is an abstract class.
     True is returned here for myself only; false for subclasses.
     Abstract subclasses must redefine this again."

    ^ self == VDBAbstractApplicationTests.
! !

!VDBAbstractApplicationTests methodsFor:'running'!

setUp
    super setUp.

    Screen current isNil ifTrue:[ Smalltalk openDisplay ].
    self skipIf: Screen current isNil description: 'No display connection'.
    Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'.

    preferences := UserPreferences new.
    preferences gdbCommand: UserPreferences current gdbCommand.
    MessageTracer mock: #current  in: UserPreferences class do: [ preferences ].
    self assert: UserPreferences current == preferences.      

    "Add your own code here..."

    "Modified: / 28-09-2018 / 07:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 16-01-2019 / 16:21:13 / jv"
!

tearDown
    super tearDown.
    MessageTracer unmock: #current  in: UserPreferences class.
    application notNil ifTrue:[ 
        application closeDownViews.
    ].
    debugger isConnected ifTrue:[ 
        debugger send: 'quit' andWait: false.        
    ].

    "Created: / 28-09-2018 / 08:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractApplicationTests methodsFor:'utilities'!

waitForUIToStabilize
    "Block testcase execution until UI stabilizes, i.e.,
     all events are processed, all pending commands executed."

    | window |

    window := application window.
    window notNil ifTrue:[ window waitUntilEventsProcessed ].
    debugger waitUntilAlCommandsProcessed.
    window notNil ifTrue:[ window waitUntilEventsProcessed ].
    Delay waitForMilliseconds: 200.

    "Created: / 23-01-2019 / 21:42:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 12-06-2019 / 16:21:16 / jv"
    "Modified: / 12-06-2019 / 16:28:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractApplicationTests class methodsFor:'documentation'!

version_HG

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