Skip to content

Commit

Permalink
Merge main into hitfoxForLine
Browse files Browse the repository at this point in the history
  • Loading branch information
macnic02 committed Jul 9, 2024
2 parents 8816f2e + c249842 commit 5466e39
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 203 deletions.
4 changes: 2 additions & 2 deletions src/SqueakWhiteboard-Tests/WBButtonTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ WBButtonTests >> testButtonHoverColor [

{
#category : #testing,
#'squeak_changestamp' : 'is 6/26/2024 10:42'
#'squeak_changestamp' : 'ACL 7/7/2024 18:19'
}
WBButtonTests >> testMouseDown [
| aButton aMouseEvent |

aButton := self canvas toolbar buttons at: 1.
aMouseEvent := MouseButtonEvent new.
aMouseEvent setType: #mouseDown position: (aButton position + aButton extent + (1@1)) which: 4 buttons: aMouseEvent class redButton hand: HandMorph new stamp: 0.
aMouseEvent setType: #mouseDown position: (aButton position + aButton extent + (1 @ 1)) which: 4 buttons: aMouseEvent class redButton hand: HandMorph new stamp: 0.
self assert: (aButton handlesMouseOver: aMouseEvent) = true.
self assert: (aButton handlesMouseDown: aMouseEvent) = true.

Expand Down
11 changes: 8 additions & 3 deletions src/SqueakWhiteboard-Tests/WBCanvasTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ WBCanvasTests >> tearDown [

{
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 20:36'
#'squeak_changestamp' : 'ACL 7/7/2024 18:26'
}
WBCanvasTests >> testActiveElement [
| anActiveElement aMouseEvent |
Expand All @@ -57,6 +57,7 @@ WBCanvasTests >> testActiveElement [
aMouseEvent := MouseButtonEvent new.
aMouseEvent setType: #mouseDown position: anActiveElement position which: 4 buttons: aMouseEvent class redButton hand: HandMorph new stamp: 0.
anActiveElement mouseDown: aMouseEvent.

self assert: self canvas activeElement = anActiveElement

]
Expand All @@ -81,17 +82,20 @@ WBCanvasTests >> testClampElementToCanvas [

{
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 18:50'
#'squeak_changestamp' : 'ACL 7/7/2024 18:25'
}
WBCanvasTests >> testElementsCollection [
| elementToDelete |

self assert: self canvas elements size = 0.

self canvas addElement: (WBRectangle newWithCanvas: self canvas).
self assert: self canvas elements size = 1.

elementToDelete := WBRectangle newWithCanvas: self canvas.
self canvas addElement: elementToDelete.
self assert: self canvas elements size = 2.

elementToDelete delete.
self assert: self canvas elements size = 1

Expand All @@ -115,11 +119,12 @@ WBCanvasTests >> testMouseDown [

{
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 18:54'
#'squeak_changestamp' : 'ACL 7/7/2024 18:25'
}
WBCanvasTests >> testRectangleCreate [
|rectangle|

rectangle := WBRectangle newWithCanvas: self canvas.

self assert: rectangle class = WBRectangle
]
38 changes: 20 additions & 18 deletions src/SqueakWhiteboard-Tests/WBDeletePopUpTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,32 @@ Class {

{
#category : #tests,
#'squeak_changestamp' : 'is 7/1/2024 22:36'
#'squeak_changestamp' : 'ACL 7/7/2024 18:26'
}
WBDeletePopUpTests >> testButtonFunctionalityForCancel [
| button buttonForCancel mouseEvent |

mouseEvent := MouseButtonEvent new.
mouseEvent setType: #mouseDown position: self canvas position + (100 @ 100) which: 4 buttons: mouseEvent class redButton hand: HandMorph new stamp: 0.
button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (100@100)).
self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (100 @ 100)).
self canvas dropElement: mouseEvent.
self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (200@200)).
self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (200 @ 200)).
self canvas dropElement: mouseEvent.

buttonForCancel := self canvas toolbar popUp submorphs at: 1.
buttonForCancel clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
buttonForCancel clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self assert: self canvas elements size = 2.
self assert: self canvas toolbar popUp = nil.
self assert: self canvas text = nil
]

{
#category : #tests,
#'squeak_changestamp' : 'is 7/1/2024 22:37'
#'squeak_changestamp' : 'ACL 7/7/2024 18:26'
}
WBDeletePopUpTests >> testButtonFunctionalityForConfirm [
| button buttonForConfirm mouseEvent |
Expand All @@ -39,70 +40,71 @@ WBDeletePopUpTests >> testButtonFunctionalityForConfirm [
mouseEvent setType: #mouseDown position: self canvas position + (100 @ 100) which: 4 buttons: mouseEvent class redButton hand: HandMorph new stamp: 0.

button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (100@100)).
self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (100 @ 100)).
self canvas dropElement: mouseEvent.
self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (200@200)).
self canvas spawnAnElement: (WBRectangle newWithCanvas: self canvas) At: (MouseButtonEvent new position: self canvas position + (200 @ 200)).
self canvas dropElement: mouseEvent.

buttonForConfirm := self canvas toolbar popUp submorphs at: 2.
buttonForConfirm clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
buttonForConfirm clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self assert: self canvas elements size = 0.
self assert: self canvas toolbar popUp = nil.
self assert: self canvas text = nil
]

{
#category : #tests,
#'squeak_changestamp' : 'is 6/26/2024 11:33'
#'squeak_changestamp' : 'ACL 7/7/2024 18:21'
}
WBDeletePopUpTests >> testButtonsOfPopUp [
| button |

button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self assert: self canvas toolbar popUp submorphs size = 2
]

{
#category : #tests,
#'squeak_changestamp' : 'is 6/26/2024 11:33'
#'squeak_changestamp' : 'ACL 7/7/2024 18:21'
}
WBDeletePopUpTests >> testExistenceOfPopUp [
| button|

button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self assert: self canvas toolbar popUp notNil.
self assert: self canvas text contents = WBToolbar textForDeleteAll
]

{
#category : #tests,
#'squeak_changestamp' : 'is 6/26/2024 11:33'
#'squeak_changestamp' : 'ACL 7/7/2024 18:21'
}
WBDeletePopUpTests >> testPopUpPlacementInX [
| button |

button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self assert: (self canvas center x - 100) <= self canvas toolbar popUp left.
self assert: self canvas toolbar popUp right <= (self canvas center x + 100)
]

{
#category : #tests,
#'squeak_changestamp' : 'is 6/26/2024 11:33'
#'squeak_changestamp' : 'ACL 7/7/2024 18:21'
}
WBDeletePopUpTests >> testPopUpPlacementInY [
| button |

button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100 @ 100)).

self assert: self canvas center y <= self canvas toolbar popUp top.
self assert: self canvas toolbar popUp bottom <= (self canvas bottom)
Expand Down
4 changes: 2 additions & 2 deletions src/SqueakWhiteboard-Tests/WBElementLineTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Class {

{
#category : #tests,
#'squeak_changestamp' : 'is 7/1/2024 22:36'
#'squeak_changestamp' : 'ACL 7/7/2024 18:27'
}
WBElementLineTests >> testSpawningViaClicking [
| element mouseEvent1 mouseEvent2 |
Expand All @@ -17,7 +17,7 @@ WBElementLineTests >> testSpawningViaClicking [
mouseEvent2 setType: #mouseDown position: self canvas position + (200 @ 200) which: 4 buttons: mouseEvent2 class redButton hand: HandMorph new stamp: 0.

element := ((WBLine newWithCanvas: self canvas) arrowHead: true).
self canvas spawnAnElement: (element) At: (MouseButtonEvent new position: self canvas position + (100@100)).
self canvas spawnAnElement: (element) At: (MouseButtonEvent new position: self canvas position + (100 @ 100)).
element mouseUp: mouseEvent1.
element mouseUp: mouseEvent2.

Expand Down
Loading

0 comments on commit 5466e39

Please sign in to comment.