Marcel Taeumel uploaded a new version of MorphicTests to project The Trunk:
http://source.squeak.org/trunk/MorphicTests-mt.36.mcz==================== Summary ====================
Name: MorphicTests-mt.36
Author: mt
Time: 13 August 2016, 7:52:42.982008 am
UUID: 7d5e8b2d-a89b-3643-8921-aa71cc575a6f
Ancestors: MorphicTests-mt.35
Adds a test that verifies that Morphs do not have to set the #wasHandled: flag in an event, even now in the face of the latest event bubbling changed.
=============== Diff against MorphicTests-mt.35 ===============
Item was changed:
Morph subclass: #MorphForEventTests
+ instanceVariableNames: 'eventsDuringCapture eventsDuringBubble eventsRejected eventsFiltered handlesMouseDown keyStrokesReceived'
- instanceVariableNames: 'eventsDuringCapture eventsDuringBubble eventsRejected eventsFiltered handlesMouseDown'
classVariableNames: ''
poolDictionaries: ''
category: 'MorphicTests-Events'!
Item was added:
+ ----- Method: MorphForEventTests>>keyStroke: (in category 'event handling') -----
+ keyStroke: evt
+
+ self keyStrokesReceived add: evt.!
Item was added:
+ ----- Method: MorphForEventTests>>keyStrokesReceived (in category 'accessing') -----
+ keyStrokesReceived
+ ^ keyStrokesReceived ifNil: [keyStrokesReceived := OrderedCollection new]!
Item was added:
+ ----- Method: MorphicEventDispatcherTests>>test10NoDuplicateKeyStroke (in category 'tests') -----
+ test10NoDuplicateKeyStroke
+ "Verifies that the event bubbling mechanism does not send keystroke events twice after the event was handled, as usual, by a morph."
+
+ | m1 m2 m3 |
+ m1 := MorphForEventTests new.
+ m2 := MorphForEventTests new.
+ m3 := MorphForEventTests new.
+
+ m1 addMorph: m2.
+ m2 addMorph: m3.
+
+ m1 openInWorld: world.
+
+ self assert: m3 keyStrokesReceived isEmpty.
+ self assert: m2 keyStrokesReceived isEmpty.
+ self assert: m1 keyStrokesReceived isEmpty.
+
+ hand handleEvent: (self keystroke: $x at: m3 center).
+
+ self assert: (m3 eventsDuringBubble anySatisfy: [:ea | ea isKeystroke]).
+ self assert: (m2 eventsDuringBubble anySatisfy: [:ea | ea isKeystroke]).
+ self assert: (m1 eventsDuringBubble anySatisfy: [:ea | ea isKeystroke]).
+
+ self assert: m3 keyStrokesReceived first keyCharacter = $x.
+ self assert: m2 keyStrokesReceived isEmpty.
+ self assert: m1 keyStrokesReceived isEmpty.
+ !