Skip to content

Commit

Permalink
fix non passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyan11 committed Jun 24, 2024
1 parent b6fb3d1 commit f0e2de0
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 89 deletions.
35 changes: 25 additions & 10 deletions src/Pyramid-Tests/PyramidLibraryPresenterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,34 @@ Class {
PyramidLibraryPresenterTest >> testIdGenerator [
"We generate a bunch of id and we verify that none are the same"

| treePlugin libraryPresForElements libraryPresForFirstLevel elements |
| treePlugin libraryPresForElements libraryPresForFirstLevel elementIds |
treePlugin := PyramidTreePlugin new.
libraryPresForElements := treePlugin libraryPresenterForElement.
libraryPresForFirstLevel := treePlugin libraryPresenterForRoot.
elements := Bag new.
libraryPresForElements library currentFactory:
(PyramidElementToAddFactory new
elementBlock: [
{
BlElement new.
BlElement new } ];
yourself).
libraryPresForFirstLevel library currentFactory:
(PyramidElementToAddFactory new
elementBlock: [
{
BlElement new.
BlElement new } ];
yourself).

elementIds := Bag new.
1 to: 100 do: [ :i |
elements add:
libraryPresForElements list selectedItem blockMaker value id
asSymbol ].
elementIds addAll:
(libraryPresForElements elementToAdd collect: [ :each |
each id asSymbol ]) ].
1 to: 100 do: [ :i |
elements add:
libraryPresForFirstLevel list selectedItem blockMaker value id
asSymbol ].
self assert: elements size equals: 200.
self assert: elements asSet size equals: 200
elementIds addAll:
(libraryPresForFirstLevel elementToAdd collect: [ :each |
each id asSymbol ]) ].
self assert: elementIds size equals: 400.
self assert: elementIds asSet size equals: 400.
]
71 changes: 0 additions & 71 deletions src/Pyramid-Tests/PyramidPluginTestModeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,74 +10,3 @@ Class {
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-testmode'
}

{ #category : 'accessing' }
PyramidPluginTestModeTest >> editor [
^ editor
]

{ #category : 'accessing' }
PyramidPluginTestModeTest >> plugin [

^ plugin
]

{ #category : 'running' }
PyramidPluginTestModeTest >> setUp [

super setUp.

plugin := PyramidPluginTestMode new.
spacePlugin := PyramidSpacePlugin new.
editor := PyramidEditorBuilder new plugins: { plugin . spacePlugin }; build.
]

{ #category : 'tests' }
PyramidPluginTestModeTest >> testIsTestOnGoing [

self assert: self plugin isTestOnGoing not.
self plugin switchToTestMode.
self assert: self plugin isTestOnGoing.
self plugin switchToTestMode.
self assert: self plugin isTestOnGoing not.
]

{ #category : 'tests' }
PyramidPluginTestModeTest >> testSwitchToTestMode [

| element elementThatReceiveEvent |
element := BlElement new
size: 500 asPoint;
background: Color blue;
addEventHandler: (BlEventHandler
on: BlPrimaryClickEvent
do: [ :evt | ]);
yourself.
self plugin elementAtEvents addEventHandler: (BlEventHandler
on: BlPrimaryClickEvent
do: [ :evt | ]).
self editor projectModel firstLevelElements add: element.

self plugin elementAtMain forceLayout.
elementThatReceiveEvent := self plugin elementAtMain
findMouseEventTargetAt:
10 asPoint
+ self plugin currentTransformTranslation.
self deny: elementThatReceiveEvent equals: element.

self plugin switchToTestMode.
self plugin elementAtMain forceLayout.
elementThatReceiveEvent := self plugin elementAtMain
findMouseEventTargetAt:
10 asPoint
+ self plugin currentTransformTranslation.
self assert: elementThatReceiveEvent equals: element.

self plugin switchToTestMode.
self plugin elementAtMain forceLayout.
elementThatReceiveEvent := self plugin elementAtMain
findMouseEventTargetAt:
10 asPoint
+ self plugin currentTransformTranslation.
self deny: elementThatReceiveEvent equals: element
]
28 changes: 23 additions & 5 deletions src/Pyramid-Tests/PyramidProjectModelObserverForTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ Class {
#tag : 'cases-models'
}

{ #category : 'initialization' }
{ #category : 'accessing' }
PyramidProjectModelObserverForTest >> initialize [

self pyramidElementsChangedAction: [ :evt | ].
self pyramidFirstLevelElementsChangedAction: [ :evt | ].
self pyramidSelectionChangedAction: [ :evt | ]
self pyramidElementsChangedAction: [ :evt | ].
self pyramidFirstLevelElementsChangedAction: [ :evt | ].
self pyramidSelectionChangedAction: [ :evt | ]
]

{ #category : 'accessing' }
Expand All @@ -37,12 +37,18 @@ PyramidProjectModelObserverForTest >> projectModel: aProjectModel [
]

{ #category : 'as yet unclassified' }
PyramidProjectModelObserverForTest >> pyramidElementsChanged [

self pyramidElementsChangedAction value.
]

{ #category : 'accessing' }
PyramidProjectModelObserverForTest >> pyramidElementsChanged: anEvent [

self pyramidElementsChangedAction value: anEvent
]

{ #category : 'as yet unclassified' }
{ #category : 'accessing' }
PyramidProjectModelObserverForTest >> pyramidElementsChangedAction [

^ pyramidElementsChangedAction
Expand All @@ -55,6 +61,12 @@ PyramidProjectModelObserverForTest >> pyramidElementsChangedAction: anObject [
]

{ #category : 'as yet unclassified' }
PyramidProjectModelObserverForTest >> pyramidFirstLevelElementsChanged [

self pyramidFirstLevelElementsChangedAction value
]

{ #category : 'accessing' }
PyramidProjectModelObserverForTest >> pyramidFirstLevelElementsChanged: anEvent [

self pyramidFirstLevelElementsChangedAction value: anEvent
Expand All @@ -73,6 +85,12 @@ PyramidProjectModelObserverForTest >> pyramidFirstLevelElementsChangedAction: an
]

{ #category : 'as yet unclassified' }
PyramidProjectModelObserverForTest >> pyramidSelectionChanged [

self pyramidSelectionChangedAction value
]

{ #category : 'accessing' }
PyramidProjectModelObserverForTest >> pyramidSelectionChanged: anEvent [

self pyramidSelectionChangedAction value: anEvent
Expand Down
14 changes: 11 additions & 3 deletions src/Pyramid-Tests/PyramidProjectModelTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,17 @@ PyramidProjectModelTest >> setUp [
observer := PyramidProjectModelObserverForTest new.

observer projectModel: projectModel.

projectModel firstLevelElements addAll: { BlElement new. BlElement new. BlElement new. BlElement new}.
projectModel selection addAll: { BlElement new. BlElement new. BlElement new. BlElement new}.

projectModel firstLevelElements addAll: {
BlElement new.
BlElement new.
BlElement new.
BlElement new }.
projectModel selection addAll: {
BlElement new.
BlElement new.
BlElement new.
BlElement new }.

pyramidElementsChanged := false.
pyramidFirstLevelElementsChanged := false.
Expand Down

0 comments on commit f0e2de0

Please sign in to comment.