[squeak-dev] The Trunk: MorphicTests-mt.33.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 20 15:14:58 UTC 2016


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

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

Name: MorphicTests-mt.33
Author: mt
Time: 20 June 2016, 5:14:51.500796 pm
UUID: 18fd6b33-66f2-d541-84a8-d8ede4a28134
Ancestors: MorphicTests-mt.32

More tests for Morphic event dispatchs.

Use custom hand morph for these tests.

=============== Diff against MorphicTests-mt.32 ===============

Item was added:
+ HandMorph subclass: #HandMorphForEventTests
+ 	instanceVariableNames: 'eventsDuringCapture eventsDuringBubble eventsRejected eventsFiltered isHandling'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'MorphicTests-Events'!

Item was added:
+ ----- Method: HandMorphForEventTests>>eventsDuringBubble (in category 'accessing') -----
+ eventsDuringBubble
+ 	^ eventsDuringBubble ifNil: [eventsDuringBubble := OrderedCollection new]!

Item was added:
+ ----- Method: HandMorphForEventTests>>eventsDuringCapture (in category 'accessing') -----
+ eventsDuringCapture
+ 	^ eventsDuringCapture ifNil: [eventsDuringCapture := OrderedCollection new]!

Item was added:
+ ----- Method: HandMorphForEventTests>>eventsFiltered (in category 'accessing') -----
+ eventsFiltered
+ 	^ eventsFiltered ifNil: [eventsFiltered := OrderedCollection new]!

Item was added:
+ ----- Method: HandMorphForEventTests>>eventsRejected (in category 'accessing') -----
+ eventsRejected
+ 	^ eventsRejected ifNil: [eventsRejected := OrderedCollection new]!

Item was added:
+ ----- Method: HandMorphForEventTests>>filterEvent:for: (in category 'event filtering') -----
+ filterEvent: anEvent for: aMorphOrNil
+ 
+ 	self eventsFiltered add: anEvent copy -> aMorphOrNil.
+ 	^ anEvent!

Item was added:
+ ----- Method: HandMorphForEventTests>>handleEvent: (in category 'events-processing') -----
+ handleEvent: anEvent
+ 
+ 	(isHandling == true and: [(#(mouseOver mouseMove) includes: anEvent type) not]) ifTrue: [Error signal: 'Recursive handling detected!!'].
+ 	isHandling := true.
+ 	self eventsDuringBubble add: anEvent copy.
+ 	[^ super handleEvent: anEvent]
+ 		ensure: [isHandling := false].!

Item was added:
+ ----- Method: HandMorphForEventTests>>handleEventSilently: (in category 'events-processing') -----
+ handleEventSilently: anEvent
+ 
+ 	^ super handleEvent: anEvent!

Item was added:
+ ----- Method: HandMorphForEventTests>>processEvent:using: (in category 'events-processing') -----
+ processEvent: anEvent using: dispatcher
+ 
+ 	self eventsDuringCapture add: anEvent copy.
+ 	^ super processEvent: anEvent using: dispatcher!

Item was added:
+ ----- Method: HandMorphForEventTests>>rejectsEvent: (in category 'events-processing') -----
+ rejectsEvent: anEvent
+ 
+ 	^ (super rejectsEvent: anEvent)
+ 		ifTrue: [self eventsRejected add: anEvent copy. true]
+ 		ifFalse: [false]!

Item was added:
+ ----- Method: MorphicEventDispatcherTests>>test08FocusEventBubblingNoHand (in category 'tests') -----
+ test08FocusEventBubblingNoHand
+ 	"If you drag something, do not bubble up to the hand."
+ 	
+ 	| m1 |
+ 	m1 := MorphForEventTests new noMouseDown.
+ 	hand grabMorph: m1.
+ 
+ 	hand newKeyboardFocus: m1.
+ 
+ 	self assert: (hand eventsDuringBubble noneSatisfy: [:ea | ea isKeystroke]).
+ 	self assert: (m1 eventsDuringBubble noneSatisfy: [:ea | ea isKeystroke]).
+ 	
+ 	self
+ 		shouldnt: [hand handleEventSilently: (self keystroke: $x at: 0 at 0)]
+ 		raise: Error.
+ 	
+ 	self assert: (hand eventsDuringBubble noneSatisfy: [:ea | ea isKeystroke]).
+ 	self assert: (m1 eventsDuringBubble anySatisfy: [:ea | ea isKeystroke]).
+ !

Item was added:
+ ----- Method: MorphicEventDispatcherTests>>test09FocusEventCapturingNoHand (in category 'tests') -----
+ test09FocusEventCapturingNoHand
+ 	"Avoid duplication of capture step in hand for focus events."
+ 	
+ 	| m1 |
+ 	m1 := MorphForEventTests new noMouseDown.
+ 	hand grabMorph: m1.
+ 
+ 	hand newKeyboardFocus: m1.
+ 
+ 	self assert: (hand eventsDuringCapture noneSatisfy: [:ea | ea isKeystroke]).
+ 	self assert: (m1 eventsDuringCapture noneSatisfy: [:ea | ea isKeystroke]).
+ 	
+ 	hand handleEventSilently: (self keystroke: $x at: 0 at 0).
+ 	
+ 	self assert: (hand eventsDuringCapture noneSatisfy: [:ea | ea isKeystroke]).
+ 	self assert: (m1 eventsDuringCapture noneSatisfy: [:ea | ea isKeystroke]).!

Item was changed:
  ----- Method: UserInputEventTests>>setUp (in category 'running') -----
  setUp
  
  	super setUp.
+ 
- 	
  	world := (PasteUpMorph newWorldForProject: nil)
  		extent: 300 at 200;
  		viewBox: (0 at 0 extent: 300 at 200);
  		yourself.
  		
  	(world instVarNamed: #worldState)
  		instVarNamed: #canvas
  		put: (Form extent: 300 at 200 depth: 32) getCanvas. 
  		
+ 	hand := HandMorphForEventTests new.
+ 	
+ 	world
+ 		removeHand: world firstHand; "the default hand"
+ 		addHand: hand.!
- 	hand := world firstHand.!

Item was added:
+ ----- Method: UserInputEventTests>>tearDown (in category 'running') -----
+ tearDown
+ 
+ 	hand showHardwareCursor: true. "Nasty side-effect"
+ 	super tearDown.!



More information about the Squeak-dev mailing list