@@ -37,3 +37,57 @@ PyramidLayoutBlocCommandTest >> targetContainers [
3737 yourself )
3838 prop: BlProportionalLayout new ) }
3939]
40+
41+ { #category : #tests }
42+ PyramidLayoutBlocCommandTest >> testGetValueFor [
43+
44+ self targetsWithValuesAndValues do: [ :each |
45+ self assert: (self command getValueFor: each key) class equals: each value class ].
46+ ]
47+
48+ { #category : #tests }
49+ PyramidLayoutBlocCommandTest >> testHistory [
50+ " Do once.
51+ undo
52+ redo
53+ undo
54+ redo"
55+
56+ | history commandExecutor targets |
57+ targets := self targetsCanBeUsedFor.
58+ history := PyramidHistory new .
59+ commandExecutor := PyramidHistoryCommandExecutor new
60+ history: history;
61+ wrappee: PyramidMainCommandExecutor new ;
62+ yourself .
63+
64+ " Do once"
65+ self argumentsForHistory do: [ :each |
66+ commandExecutor use: self command on: targets with: each ].
67+
68+ " Undo all"
69+ self argumentsForHistory reverseDo: [ :argument |
70+ targets do: [ :target |
71+ self
72+ assert: (self command getValueFor: target) class
73+ equals: argument class ].
74+ history canUndo ifTrue: [ history undo ] ].
75+
76+ " Redo all"
77+ self argumentsForHistory do: [ :argument |
78+ history canRedo ifTrue: [ history redo ].
79+ targets do: [ :target |
80+ self assert: (self command getValueFor: target) class equals: argument class ] ].
81+
82+ " Undo all"
83+ self argumentsForHistory reverseDo: [ :argument |
84+ targets do: [ :target |
85+ self assert: (self command getValueFor: target) class equals: argument class ].
86+ history canUndo ifTrue: [ history undo ] ].
87+
88+ " Redo all"
89+ self argumentsForHistory do: [ :argument |
90+ history canRedo ifTrue: [ history redo ].
91+ targets do: [ :target |
92+ self assert: (self command getValueFor: target) class equals: argument class ] ]
93+ ]
0 commit comments