The Trunk: MorphicTests-mt.79.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.79.mcz

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

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

Name: MorphicTests-mt.79
Author: mt
Time: 19 April 2021, 10:04:21.810053 am
UUID: 7bae0322-f841-224f-ac06-f4e370992115
Ancestors: MorphicTests-mt.78

Update test03EventHandler to be more realistic. Avoid triggering the mouse-focus-event-disptach path.

=============== Diff against MorphicTests-mt.78 ===============

Item was changed:
  ----- Method: MorphicEventTests>>test03EventHandler (in category 'tests') -----
  test03EventHandler
+ "Test a morph's event handler, which is configured via #on:send:to:. Note that the handler only reacts on #mouseDown but we do send a #mouseUp to reset the mouse focus to ensure the same event-dispatching flow for all three mouse buttons."
 
  | 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 color: Color blue.
  m openInWorld: world.
 
+ self assert: hand mouseFocus isNil.
  hand handleEvent: (self redMouseDownAt: m center).
+ hand handleEvent: (self redMouseUpAt: m center).
  self assert: Color red equals: m color.
 
+ self assert: hand mouseFocus isNil.
  hand handleEvent: (self yellowMouseDownAt: m center).
+ hand handleEvent: (self yellowMouseUpAt: m center).
  self assert: Color yellow equals: m color.
+
+ self assert: hand mouseFocus isNil.
-
  hand handleEvent: (self blueMouseDownAt: m center).
+ hand handleEvent: (self blueMouseUpAt: m center).
  self assert: Color blue equals: m color.!

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

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