The Trunk: MorphicTests-mt.41.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MorphicTests-mt.41.mcz

commits-2
Marcel Taeumel uploaded a new version of MorphicTests to project The Trunk:
http://source.squeak.org/trunk/MorphicTests-mt.41.mcz

==================== Summary ====================

Name: MorphicTests-mt.41
Author: mt
Time: 1 July 2017, 2:57:41.428352 pm
UUID: ee05a5f6-3c62-1c46-af81-607c453de86c
Ancestors: MorphicTests-nice.40

Adds a test for event handler and red/blue/yellow mouse down.

=============== Diff against MorphicTests-nice.40 ===============

Item was added:
+ ----- Method: MorphicEventTests>>test03EventHandler (in category 'tests') -----
+ test03EventHandler
+
+ | m |
+ m := Morph new.
+ m extent: 20@20; topLeft: 0@0.
+
+ m wantsHaloFromClick: false.
+ m wantsYellowButtonMenu: false.
+ m wantsMetaMenu: false.
+
+ m on: #mouseDown send: #value: to:[:evt|
+ evt redButtonPressed ifTrue:[m color: Color red].
+ evt yellowButtonPressed ifTrue:[m color: Color yellow].
+ evt blueButtonPressed ifTrue:[m color: Color blue]].
+
+ m openInWorld: world.
+
+ hand handleEvent: (self redMouseDownAt: m center).
+ self assert: Color red equals: m color.
+
+ hand handleEvent: (self yellowMouseDownAt: m center).
+ self assert: Color yellow equals: m color.
+
+ hand handleEvent: (self blueMouseDownAt: m center).
+ self assert: Color blue equals: m color.!

Item was added:
+ ----- Method: UserInputEventTests>>blueMouseDownAt: (in category 'support') -----
+ blueMouseDownAt: point
+
+ ^ MouseButtonEvent new
+ setType: #mouseDown
+ position: point
+ which: 2r000 "no change"
+ buttons: 2r001 "blue pressed"
+ hand: hand
+ stamp: Time millisecondClockValue!

Item was added:
+ ----- Method: UserInputEventTests>>yellowMouseDownAt: (in category 'support') -----
+ yellowMouseDownAt: point
+
+ ^ MouseButtonEvent new
+ setType: #mouseDown
+ position: point
+ which: 2r000 "no change"
+ buttons: 2r010 "yellow pressed"
+ hand: hand
+ stamp: Time millisecondClockValue!