forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpWindowPresenterTest.class.st
81 lines (69 loc) · 1.78 KB
/
SpWindowPresenterTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Class {
#name : #SpWindowPresenterTest,
#superclass : #SpSpecTest,
#category : #'Spec2-Tests-Core'
}
{ #category : #running }
SpWindowPresenterTest >> classToTest [
^ SpWindowPresenter
]
{ #category : #running }
SpWindowPresenterTest >> initializeTestedInstance [
presenter presenter: SpLabelPresenter new
]
{ #category : #running }
SpWindowPresenterTest >> openInstance [
window ifNil: [ window := presenter openWithSpecLayout: SpLabelPresenter defaultSpec ]
]
{ #category : #tests }
SpWindowPresenterTest >> testInitialPosition [
presenter initialPosition: 100 @ 100.
self openInstance.
self assert: window adapter widget position equals: 100 @ 100
]
{ #category : #tests }
SpWindowPresenterTest >> testIsClosed [
self assert: presenter isClosed.
self openInstance.
self deny: presenter isClosed.
presenter close.
self assert: presenter isClosed
]
{ #category : #tests }
SpWindowPresenterTest >> testIsTopWindow [
self deny: presenter isTopWindow.
self openInstance.
presenter takeKeyboardFocus.
self assert: presenter isTopWindow.
presenter close.
self deny: presenter isTopWindow
]
{ #category : #tests }
SpWindowPresenterTest >> testWhenClosedDo [
| closed |
closed := false.
presenter whenClosedDo: [ closed := true ].
self openInstance.
presenter close.
self assert: closed
]
{ #category : #tests }
SpWindowPresenterTest >> testWhenOpenedDo [
| opened |
opened := false.
presenter whenOpenedDo: [ opened := true ].
self openInstance.
self assert: opened
]
{ #category : #tests }
SpWindowPresenterTest >> testWhenWillCloseDo [
| willClose closed |
willClose := false.
closed := false.
presenter whenWillCloseDo: [ willClose := true ].
presenter whenClosedDo: [ closed := willClose ].
self openInstance.
presenter close.
self assert: willClose.
self assert: closed
]