Skip to content

Commit

Permalink
even more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivenjs committed Jun 21, 2024
1 parent d5e9cb5 commit 5c5d91a
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/SqueakWhiteboard-Tests/WBCanvasTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ WBCanvasTests >> tearDown [
]

{
#category : #tests,
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 20:36'
}
WBCanvasTests >> testActiveElement [
Expand All @@ -62,7 +62,7 @@ WBCanvasTests >> testActiveElement [
]

{
#category : #tests,
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 23:52'
}
WBCanvasTests >> testClampElementToCanvas [
Expand All @@ -80,7 +80,7 @@ WBCanvasTests >> testClampElementToCanvas [
]

{
#category : #tests,
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 18:50'
}
WBCanvasTests >> testElementsCollection [
Expand All @@ -99,7 +99,7 @@ WBCanvasTests >> testElementsCollection [
]

{
#category : #tests,
#category : #testing,
#'squeak_changestamp' : 'is 6/22/2024 00:42'
}
WBCanvasTests >> testMouseEvents [
Expand All @@ -114,7 +114,7 @@ WBCanvasTests >> testMouseEvents [
]

{
#category : #tests,
#category : #testing,
#'squeak_changestamp' : 'is 6/21/2024 18:54'
}
WBCanvasTests >> testRectangleCreate [
Expand Down
66 changes: 66 additions & 0 deletions src/SqueakWhiteboard-Tests/WBResizeBarTests.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Class {
#name : #WBResizeBarTests,
#superclass : #TestCase,
#instVars : [
'canvas'
],
#category : #'SqueakWhiteboard-Tests'
}

{
#category : #accessing,
#'squeak_changestamp' : 'si 6/7/2024 00:30'
}
WBResizeBarTests >> canvas [

^ canvas
]

{
#category : #accessing,
#'squeak_changestamp' : 'si 6/21/2024 00:53'
}
WBResizeBarTests >> canvas: anObject [

canvas := anObject
]

{
#category : #setUp,
#'squeak_changestamp' : 'is 6/15/2024 12:58'
}
WBResizeBarTests >> setUp [

super setUp.
self canvas: WBCanvas new

]

{
#category : #tearDown,
#'squeak_changestamp' : 'is 6/4/2024 17:24'
}
WBResizeBarTests >> tearDown [

super tearDown.
self canvas ifNotNil: [:canvas | canvas owner delete]
]

{
#category : #testing,
#'squeak_changestamp' : 'is 6/22/2024 01:30'
}
WBResizeBarTests >> testMouseEvents [
| aResizeBar aMouseEvent prevCursor |

aResizeBar := WBResizeBar new.
aMouseEvent := MouseButtonEvent new.
aMouseEvent setType: #mouseDown position: aResizeBar position which: 4 buttons: aMouseEvent class redButton hand: HandMorph new stamp: 0.
self assert: (aResizeBar handlesMouseDown: aMouseEvent) = true.
self assert: (aResizeBar handlesMouseOver: aMouseEvent) = true.
prevCursor := Cursor currentCursor.
aResizeBar mouseEnter: aMouseEvent.
self assert: Cursor currentCursor = Cursor move.
aResizeBar mouseLeave: aMouseEvent.
self assert: Cursor currentCursor = prevCursor
]
66 changes: 66 additions & 0 deletions src/SqueakWhiteboard-Tests/WBResizeHandleTests.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Class {
#name : #WBResizeHandleTests,
#superclass : #TestCase,
#instVars : [
'canvas'
],
#category : #'SqueakWhiteboard-Tests'
}

{
#category : #accessing,
#'squeak_changestamp' : 'si 6/7/2024 00:30'
}
WBResizeHandleTests >> canvas [

^ canvas
]

{
#category : #accessing,
#'squeak_changestamp' : 'si 6/21/2024 00:53'
}
WBResizeHandleTests >> canvas: anObject [

canvas := anObject
]

{
#category : #setUp,
#'squeak_changestamp' : 'is 6/15/2024 12:58'
}
WBResizeHandleTests >> setUp [

super setUp.
self canvas: WBCanvas new

]

{
#category : #tearDown,
#'squeak_changestamp' : 'is 6/4/2024 17:24'
}
WBResizeHandleTests >> tearDown [

super tearDown.
self canvas ifNotNil: [:canvas | canvas owner delete]
]

{
#category : #testing,
#'squeak_changestamp' : 'is 6/22/2024 01:34'
}
WBResizeHandleTests >> testMouseEvents [
| aResizeBar aMouseEvent prevCursor |

aResizeBar := WBResizeBar new.
aMouseEvent := MouseButtonEvent new.
aMouseEvent setType: #mouseDown position: aResizeBar position which: 4 buttons: aMouseEvent class redButton hand: HandMorph new stamp: 0.
self assert: (aResizeBar handlesMouseDown: aMouseEvent) = true.
self assert: (aResizeBar handlesMouseOver: aMouseEvent) = true.
prevCursor := Cursor currentCursor.
aResizeBar mouseEnter: aMouseEvent.
self assert: Cursor currentCursor = Cursor move.
aResizeBar mouseLeave: aMouseEvent.
self assert: Cursor currentCursor = prevCursor
]
15 changes: 11 additions & 4 deletions src/SqueakWhiteboard-Tests/WBTextfieldTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ WBTextfieldTests >> testTextfieldDeactivationViaEscape [

{
#category : #testing,
#'squeak_changestamp' : 'is 6/22/2024 00:00'
#'squeak_changestamp' : 'is 6/22/2024 01:18'
}
WBTextfieldTests >> testTextfieldKeyboardEventHandling [
| anElement aFirstMouseEvent aSecondMouseEvent aKeyboardEvent |
Expand All @@ -223,6 +223,7 @@ WBTextfieldTests >> testTextfieldKeyboardEventHandling [
aSecondMouseEvent := MouseButtonEvent new.
aSecondMouseEvent setType: #mouseDown position: anElement position which: 4 buttons: aSecondMouseEvent class redButton hand: HandMorph new stamp: 0.
aKeyboardEvent := KeyboardEvent new.
self assert: (anElement textField handlesKeyboard: aFirstMouseEvent) = anElement textField enabled.
self assert: (anElement textField textMorph handlesKeyboard: aKeyboardEvent) = false.

anElement mouseDown: aFirstMouseEvent.
Expand All @@ -232,10 +233,10 @@ WBTextfieldTests >> testTextfieldKeyboardEventHandling [

{
#category : #testing,
#'squeak_changestamp' : 'is 6/22/2024 00:00'
#'squeak_changestamp' : 'is 6/22/2024 01:37'
}
WBTextfieldTests >> testTextfieldMouseEventHandling [
| anElement aFirstMouseEvent aSecondMouseEvent |
| anElement aFirstMouseEvent aSecondMouseEvent prevCursor |

anElement := WBRectangle newWithCanvas: self canvas.
aFirstMouseEvent := MouseButtonEvent new.
Expand All @@ -252,7 +253,13 @@ WBTextfieldTests >> testTextfieldMouseEventHandling [

self assert: (anElement textField handlesMouseOver: aFirstMouseEvent) = false.
self assert: (anElement textField handlesMouseDown: aFirstMouseEvent) = true.
self assert: (anElement textField textMorph handlesMouseDown: aFirstMouseEvent) = true
self assert: (anElement textField textMorph handlesMouseDown: aFirstMouseEvent) = true.

prevCursor := Cursor currentCursor.
anElement textField textMorph mouseEnter: aFirstMouseEvent.
self assert: Cursor currentCursor = Cursor text.
anElement textField textMorph mouseLeave: aFirstMouseEvent.
self assert: Cursor currentCursor = prevCursor
]

{
Expand Down

0 comments on commit 5c5d91a

Please sign in to comment.