SimpleTestResource.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 26 Nov 2017 20:40:34 +0000
branchjv
changeset 696 268bf2c60556
parent 664 e31b2e7b658d
child 724 4dae63fce9f9
permissions -rw-r--r--
UI testing: wait until event queue empties ...when `#do:`ing an user action. This is necessary for widget/tools that pushes more work back onto an even queue (in order to make the system more responsive).

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

"{ NameSpace: Smalltalk }"

TestResource subclass:#SimpleTestResource
	instanceVariableNames:'runningState hasRun hasSetup'
	classVariableNames:''
	poolDictionaries:''
	category:'SUnit-Tests'
!

SimpleTestResource class instanceVariableNames:'preventAvailability'

"
 The following class instance variables are inherited by this class:

	TestResource - current
	TestAsserter - 
	Object - 
"
!


!SimpleTestResource class methodsFor:'accessing'!

allowAvailability
	^preventAvailability isNil
!

rawCurrentForTest
	^current
! !

!SimpleTestResource class methodsFor:'utility'!

preventAvailabilityDuring: aBlock
	"Only setter of preventAvailability."

	preventAvailability := false.
	^aBlock ensure: [preventAvailability := nil]
! !

!SimpleTestResource methodsFor:'accessing'!

runningState

	^runningState
!

runningState: aSymbol

	runningState := aSymbol
! !

!SimpleTestResource methodsFor:'running'!

setRun
	hasRun := true
!

setUp

	self runningState: self startedStateSymbol.
	hasSetup := true
!

startedStateSymbol

	^#started
!

stoppedStateSymbol

	^#stopped
!

tearDown

	self runningState: self stoppedStateSymbol
! !

!SimpleTestResource methodsFor:'testing'!

hasRun
	^hasRun
!

hasSetup
	^hasSetup
!

isAvailable
	^self class allowAvailability and:
		[self runningState == self startedStateSymbol]
! !

!SimpleTestResource class methodsFor:'documentation'!

version_SVN
    ^ '§Id: SimpleTestResource.st 214 2011-03-14 12:22:21Z vranyj1 §'
! !