Skip to content

Commit e607194

Browse files
committed
Fix the two test
1 parent f270c10 commit e607194

File tree

2 files changed

+63
-11
lines changed

2 files changed

+63
-11
lines changed

src/Pyramid-Bloc/PyramidElementsManipulationHelper.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ PyramidElementsManipulationHelper class >> accumulateParentsOf: aCollectionOfBlE
2828
nextCollection := OrderedCollection new.
2929

3030
onCollection do: [ :each |
31-
(each hasParent: elementToTest) ifFalse: [
31+
(each allParentsInclude: elementToTest) ifFalse: [
3232
nextCollection add: each ].
33-
(shouldKeepIt and: [ elementToTest hasParent: each ]) ifTrue: [
34-
shouldKeepIt := false ] ].
33+
(shouldKeepIt and: [ elementToTest allParentsInclude: each ])
34+
ifTrue: [ shouldKeepIt := false ] ].
3535
shouldKeepIt ifTrue: [ result add: elementToTest ].
3636
self accumulateParentsOf: nextCollection in: result
3737
]

src/Pyramid-Tests/PyramidLayoutBlocCommandTest.class.st

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,78 @@ PyramidLayoutBlocCommandTest >> command [
1414

1515
{ #category : #'as yet unclassified' }
1616
PyramidLayoutBlocCommandTest >> 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

Comments
 (0)