@@ -14,26 +14,85 @@ 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 : #' as yet unclassified' }
47+ PyramidLayoutBlocCommandTest >> targetsCanBeUsedFor [
48+
49+ " ^ self targetContainers flatCollect: [ :each | { each targetNoProp . each targetWithProp } ]."
50+ ^ self targetContainers collect: [ :each | each targetNoProp ].
51+ ]
52+
53+ { #category : #tests }
54+ PyramidLayoutBlocCommandTest >> testHistory [
55+ " Do once.
56+ undo
57+ redo
58+ undo
59+ redo"
60+
61+ | history commandExecutor targets |
62+ targets := self targetsCanBeUsedFor.
63+ history := PyramidHistory new .
64+ commandExecutor := PyramidHistoryCommandExecutor new
65+ history: history;
66+ wrappee: PyramidMainCommandExecutor new ;
67+ yourself .
68+
69+ " Do once"
70+ self argumentsForHistory do: [ :each |
71+ commandExecutor use: self command on: targets with: each ].
72+
73+ " Undo all"
74+ self argumentsForHistory reverseDo: [ :argument |
75+ targets do: [ :target |
76+ self
77+ assert: (self command getValueFor: target) class
78+ equals: argument class ].
79+ history canUndo ifTrue: [ history undo ] ].
80+
81+ " Redo all"
82+ self argumentsForHistory do: [ :argument |
83+ history canRedo ifTrue: [ history redo ].
84+ targets do: [ :target |
85+ self assert: (self command getValueFor: target) class equals: argument class ] ].
86+
87+ " Undo all"
88+ self argumentsForHistory reverseDo: [ :argument |
89+ targets do: [ :target |
90+ self assert: (self command getValueFor: target) class equals: argument class ].
91+ history canUndo ifTrue: [ history undo ] ].
92+
93+ " Redo all"
94+ self argumentsForHistory do: [ :argument |
95+ history canRedo ifTrue: [ history redo ].
96+ targets do: [ :target |
97+ self assert: (self command getValueFor: target) class equals: argument class ] ]
3998]
0 commit comments