@@ -14,26 +14,78 @@ PyramidLayoutBlocCommandTest >> command [
1414
1515{ #category : #' as yet unclassified' }
1616PyramidLayoutBlocCommandTest >> targetContainers [
17-
17+ | flowLayoutVertical basicLayout proportionalLayout |
18+
19+ flowLayoutVertical := BlFlowLayout vertical.
20+ basicLayout := BlBasicLayout new .
21+ proportionalLayout := BlProportionalLayout new .
22+
1823 ^ {
1924 (PyramidCommandTestContainer
2025 no: BlElement new
2126 with: (BlElement new
22- layout: BlFlowLayout vertical ;
27+ layout: flowLayoutVertical ;
2328 yourself )
24- prop: BlFlowLayout vertical ).
29+ prop: flowLayoutVertical ).
2530 (PyramidCommandTestContainer
2631 no: (BlElement new
27- layout: BlFlowLayout vertical ;
32+ layout: flowLayoutVertical ;
2833 yourself )
2934 with: (BlElement new
30- layout: BlBasicLayout new ;
35+ layout: basicLayout ;
3136 yourself )
32- prop: BlBasicLayout new ).
37+ prop: basicLayout ).
3338 (PyramidCommandTestContainer
3439 no: BlElement new
3540 with: (BlElement new
36- layout: BlProportionalLayout new ;
41+ layout: proportionalLayout ;
3742 yourself )
38- prop: BlProportionalLayout new ) }
43+ prop: proportionalLayout) }
44+ ]
45+
46+ { #category : #tests }
47+ PyramidLayoutBlocCommandTest >> testHistory [
48+ " Do once.
49+ undo
50+ redo
51+ undo
52+ redo"
53+
54+ | history commandExecutor targets |
55+ targets := self targetsCanBeUsedFor.
56+ history := PyramidHistory new .
57+ commandExecutor := PyramidHistoryCommandExecutor new
58+ history: history;
59+ wrappee: PyramidMainCommandExecutor new ;
60+ yourself .
61+
62+ " Do once"
63+ self argumentsForHistory do: [ :each |
64+ commandExecutor use: self command on: targets with: each ].
65+
66+ " Undo all"
67+ self argumentsForHistory reverseDo: [ :argument |
68+ targets do: [ :target |
69+ self
70+ assert: (self command getValueFor: target) class
71+ equals: argument class ].
72+ history canUndo ifTrue: [ history undo ] ].
73+
74+ " Redo all"
75+ self argumentsForHistory do: [ :argument |
76+ history canRedo ifTrue: [ history redo ].
77+ targets do: [ :target |
78+ self assert: (self command getValueFor: target) class equals: argument class ] ].
79+
80+ " Undo all"
81+ self argumentsForHistory reverseDo: [ :argument |
82+ targets do: [ :target |
83+ self assert: (self command getValueFor: target) class equals: argument class ].
84+ history canUndo ifTrue: [ history undo ] ].
85+
86+ " Redo all"
87+ self argumentsForHistory do: [ :argument |
88+ history canRedo ifTrue: [ history redo ].
89+ targets do: [ :target |
90+ self assert: (self command getValueFor: target) class equals: argument class ] ]
3991]
0 commit comments