Skip to content

Commit

Permalink
fixed color setting of textbox & tests that didnt use "newWithCanvas:…
Browse files Browse the repository at this point in the history
… self canvas"
  • Loading branch information
Ivenjs committed Jul 1, 2024
1 parent d31b8fe commit 1339ffd
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 47 deletions.
3 changes: 1 addition & 2 deletions src/SqueakWhiteboard-Core/WBCanvas.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ WBCanvas >> spawnACopiedElement: anElement At: aPoint [

{
#category : #'creating elements',
#'squeak_changestamp' : 'is 6/23/2024 01:25'
#'squeak_changestamp' : 'is 7/1/2024 22:32'
}
WBCanvas >> spawnAnElement: anElement At: aMouseEvent [

Expand All @@ -423,7 +423,6 @@ WBCanvas >> spawnAnElement: anElement At: aMouseEvent [
center: aMouseEvent cursorPoint;
dragOffset: anElement position - aMouseEvent cursorPoint;
canvas: self;
color: self globalColor;
addDropShadow;
yourself).
self addElement: anElement
Expand Down
5 changes: 3 additions & 2 deletions src/SqueakWhiteboard-Core/WBElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,15 @@ WBElement >> height: aHeight [

{
#category : #initialization,
#'squeak_changestamp' : 'is 6/23/2024 01:32'
#'squeak_changestamp' : 'is 7/1/2024 22:33'
}
WBElement >> initialize [

super initialize.
self morph:
self initializeElement;
extent: self class defaultSize.
extent: self class defaultSize;
color: self canvas globalColor.
self setupEventHandling.
self supportsText ifTrue: [self initializeTextfield]

Expand Down
12 changes: 1 addition & 11 deletions src/SqueakWhiteboard-Core/WBTextbox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,9 @@ WBTextbox class >> defaultSize [
^ 15@35
]

{
#category : #'morph functionalities',
#'squeak_changestamp' : 'is 7/1/2024 00:22'
}
WBTextbox >> color: aColor [
"The textbox should always be transparent"

self morph color: Color transparent
]

{
#category : #initialization,
#'squeak_changestamp' : 'is 7/1/2024 00:27'
#'squeak_changestamp' : 'is 7/1/2024 00:36'
}
WBTextbox >> initialize [

Expand Down
8 changes: 4 additions & 4 deletions src/SqueakWhiteboard-Core/WBToolbar.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ WBToolbar >> backgroundColor: aColor [

{
#category : #'button functionalities',
#'squeak_changestamp' : 'si 6/25/2024 14:07'
#'squeak_changestamp' : 'is 7/1/2024 22:39'
}
WBToolbar >> buttonFunctionalityForArrow [

^ [:aButton | self canvas spawnAnElement: (WBLine new arrowHead: true) At: aButton currentEvent]
^ [:aButton | self canvas spawnAnElement: ((WBLine newWithCanvas: self canvas) arrowHead: true) At: aButton currentEvent]
]

{
Expand Down Expand Up @@ -136,11 +136,11 @@ WBToolbar >> buttonFunctionalityForGlobalColor [

{
#category : #'button functionalities',
#'squeak_changestamp' : 'si 6/25/2024 14:09'
#'squeak_changestamp' : 'is 7/1/2024 22:39'
}
WBToolbar >> buttonFunctionalityForLine [

^ [:aButton | self canvas spawnAnElement: (WBLine new arrowHead: false) At: aButton currentEvent]
^ [:aButton | self canvas spawnAnElement: ((WBLine newWithCanvas: self canvas) arrowHead: false) At: aButton currentEvent]
]

{
Expand Down
12 changes: 6 additions & 6 deletions src/SqueakWhiteboard-Tests/WBDeletePopUpTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Class {

{
#category : #tests,
#'squeak_changestamp' : 'is 6/26/2024 11:33'
#'squeak_changestamp' : 'is 7/1/2024 22:36'
}
WBDeletePopUpTests >> testButtonFunctionalityForCancel [
| button buttonForCancel mouseEvent |
Expand All @@ -16,9 +16,9 @@ WBDeletePopUpTests >> testButtonFunctionalityForCancel [
button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).

self canvas spawnAnElement: (WBRectangle new) 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 new) 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.
Expand All @@ -30,7 +30,7 @@ WBDeletePopUpTests >> testButtonFunctionalityForCancel [

{
#category : #tests,
#'squeak_changestamp' : 'is 6/26/2024 11:33'
#'squeak_changestamp' : 'is 7/1/2024 22:37'
}
WBDeletePopUpTests >> testButtonFunctionalityForConfirm [
| button buttonForConfirm mouseEvent |
Expand All @@ -41,9 +41,9 @@ WBDeletePopUpTests >> testButtonFunctionalityForConfirm [
button := self canvas toolbar buttons at: 6.
button clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).

self canvas spawnAnElement: (WBRectangle new) 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 new) 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.
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' : 'si 6/25/2024 14:20'
#'squeak_changestamp' : 'is 7/1/2024 22:36'
}
WBElementLineTests >> testSpawningViaClicking [
| element mouseEvent1 mouseEvent2 |
Expand All @@ -16,7 +16,7 @@ WBElementLineTests >> testSpawningViaClicking [
mouseEvent2 := MouseButtonEvent new.
mouseEvent2 setType: #mouseDown position: self canvas position + (200 @ 200) which: 4 buttons: mouseEvent2 class redButton hand: HandMorph new stamp: 0.

element := (WBLine new arrowHead: true).
element := ((WBLine newWithCanvas: self canvas) arrowHead: true).
self canvas spawnAnElement: (element) At: (MouseButtonEvent new position: self canvas position + (100@100)).
element mouseUp: mouseEvent1.
element mouseUp: mouseEvent2.
Expand Down
36 changes: 18 additions & 18 deletions src/SqueakWhiteboard-Tests/WBElementPopUpTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Class {

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 17:52'
#'squeak_changestamp' : 'is 7/1/2024 22:39'
}
WBElementPopUpTests >> testButtonsOfPopUp [
| element mouseEvent |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand All @@ -24,15 +24,15 @@ WBElementPopUpTests >> testButtonsOfPopUp [

{
#category : #tests,
#'squeak_changestamp' : 'is 6/21/2024 18:55'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testExistenceOfPopUp [
| element mouseEvent |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand All @@ -43,15 +43,15 @@ WBElementPopUpTests >> testExistenceOfPopUp [

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 18:05'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfBorderColor [
| element mouseEvent buttonForColor |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand Down Expand Up @@ -97,15 +97,15 @@ WBElementPopUpTests >> testFunctionalityOfBorderColor [

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 18:01'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfBorderColorPopUp [
| element mouseEvent |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand All @@ -117,15 +117,15 @@ WBElementPopUpTests >> testFunctionalityOfBorderColorPopUp [

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 18:00'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfColor [
| element mouseEvent buttonForColor |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand Down Expand Up @@ -171,15 +171,15 @@ WBElementPopUpTests >> testFunctionalityOfColor [

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 18:00'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfColorPopUp [
| element mouseEvent |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand All @@ -191,15 +191,15 @@ WBElementPopUpTests >> testFunctionalityOfColorPopUp [

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 17:54'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfCopy [
| element mouseEvent |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand All @@ -211,15 +211,15 @@ WBElementPopUpTests >> testFunctionalityOfCopy [

{
#category : #tests,
#'squeak_changestamp' : 'ACL 6/23/2024 17:54'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfDelete [
| element mouseEvent |

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

self canvas spawnAnElement: (WBRectangle new) 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.
element := self canvas elements at: 1.

Expand All @@ -231,7 +231,7 @@ WBElementPopUpTests >> testFunctionalityOfDelete [

{
#category : #tests,
#'squeak_changestamp' : 'si 6/25/2024 14:19'
#'squeak_changestamp' : 'is 7/1/2024 22:40'
}
WBElementPopUpTests >> testFunctionalityOfSwitchVisibilityOfArrowHead [
| element mouseEvent1 mouseEvent2 |
Expand All @@ -240,7 +240,7 @@ WBElementPopUpTests >> testFunctionalityOfSwitchVisibilityOfArrowHead [
mouseEvent1 setType: #mouseDown position: self canvas position + (100 @ 100) which: 4 buttons: mouseEvent1 class redButton hand: HandMorph new stamp: 0.
mouseEvent2 := MouseButtonEvent new.
mouseEvent2 setType: #mouseDown position: self canvas position + (200 @ 200) which: 4 buttons: mouseEvent2 class redButton hand: HandMorph new stamp: 0.
element := (WBLine new arrowHead: true).
element := ((WBLine newWithCanvas: self canvas) arrowHead: true).

self canvas spawnAnElement: (element) At: (MouseButtonEvent new position: self canvas position + (100@100)).
element mouseUp: mouseEvent1.
Expand Down
4 changes: 2 additions & 2 deletions src/SqueakWhiteboard-Tests/WBLineChoosingPopUpTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Class {

{
#category : #tests,
#'squeak_changestamp' : 'si 6/25/2024 14:17'
#'squeak_changestamp' : 'is 7/1/2024 22:37'
}
WBLineChoosingPopUpTests >> testButtonFunctionality [
| button buttonForLine|
| button buttonForLine |

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

0 comments on commit 1339ffd

Please sign in to comment.