-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
Class { | ||
#name : #PyramidPluginTestModeTest, | ||
#superclass : #TestCase, | ||
#instVars : [ | ||
'plugin', | ||
'spacePlugin', | ||
'editor' | ||
], | ||
#category : #'Pyramid-Bloc-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 | ||
] |