-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPyramidLayoutBlocCommandTest.class.st
More file actions
91 lines (79 loc) · 2.49 KB
/
PyramidLayoutBlocCommandTest.class.st
File metadata and controls
91 lines (79 loc) · 2.49 KB
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
82
83
84
85
86
87
88
89
90
91
Class {
#name : #PyramidLayoutBlocCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : #'Pyramid-Tests-cases-plugin-bloc-layout'
}
{ #category : #accessing }
PyramidLayoutBlocCommandTest >> command [
^ PyramidLayoutBlocCommand new
]
{ #category : #'as yet unclassified' }
PyramidLayoutBlocCommandTest >> targetContainers [
| flowLayoutVertical basicLayout proportionalLayout |
flowLayoutVertical := BlFlowLayout vertical.
basicLayout := BlBasicLayout new.
proportionalLayout := BlProportionalLayout new.
^ {
(PyramidCommandTestContainer
no: BlElement new
with: (BlElement new
layout: flowLayoutVertical;
yourself)
prop: flowLayoutVertical).
(PyramidCommandTestContainer
no: (BlElement new
layout: flowLayoutVertical;
yourself)
with: (BlElement new
layout: basicLayout;
yourself)
prop: basicLayout).
(PyramidCommandTestContainer
no: BlElement new
with: (BlElement new
layout: proportionalLayout;
yourself)
prop: proportionalLayout) }
]
{ #category : #tests }
PyramidLayoutBlocCommandTest >> testHistory [
"Do once.
undo
redo
undo
redo"
| history commandExecutor targets |
targets := self targetsCanBeUsedFor.
history := PyramidHistory new.
commandExecutor := PyramidHistoryCommandExecutor new
history: history;
wrappee: PyramidMainCommandExecutor new;
yourself.
"Do once"
self argumentsForHistory do: [ :each |
commandExecutor use: self command on: targets with: each ].
"Undo all"
self argumentsForHistory reverseDo: [ :argument |
targets do: [ :target |
self
assert: (self command getValueFor: target) class
equals: argument class ].
history canUndo ifTrue: [ history undo ] ].
"Redo all"
self argumentsForHistory do: [ :argument |
history canRedo ifTrue: [ history redo ].
targets do: [ :target |
self assert: (self command getValueFor: target) class equals: argument class] ].
"Undo all"
self argumentsForHistory reverseDo: [ :argument |
targets do: [ :target |
self assert: (self command getValueFor: target) class equals: argument class].
history canUndo ifTrue: [ history undo ] ].
"Redo all"
self argumentsForHistory do: [ :argument |
history canRedo ifTrue: [ history redo ].
targets do: [ :target |
self assert: (self command getValueFor: target) class equals: argument class ] ]
]