diff --git a/accessible/jsat/Gestures.jsm b/accessible/jsat/Gestures.jsm index 1719276c6d9..895932f162e 100644 --- a/accessible/jsat/Gestures.jsm +++ b/accessible/jsat/Gestures.jsm @@ -213,8 +213,7 @@ this.GestureTracker = { // jshint ignore:line */ handle: function GestureTracker_handle(aDetail, aTimeStamp) { Logger.gesture(() => { - return ['Pointer event', aDetail.type, 'at:', aTimeStamp, - JSON.stringify(aDetail.points)]; + return ['Pointer event', Utils.dpi, 'at:', aTimeStamp, JSON.stringify(aDetail)]; }); this[this.current ? '_update' : '_init'](aDetail, aTimeStamp); }, @@ -403,7 +402,12 @@ Gesture.prototype = { let identifier = point.identifier; let gesturePoint = this.points[identifier]; if (gesturePoint) { - gesturePoint.update(point); + if (aType === 'pointerdown' && aCanCreate) { + // scratch the previous pointer with that id. + this.points[identifier] = new Point(point); + } else { + gesturePoint.update(point); + } if (aNeedComplete) { // Since the gesture is completing and at least one of the gesture // points is updated, set the return value to true. diff --git a/accessible/tests/mochitest/jsat/dom_helper.js b/accessible/tests/mochitest/jsat/dom_helper.js index b75c5f7c4b1..431bed1d55b 100644 --- a/accessible/tests/mochitest/jsat/dom_helper.js +++ b/accessible/tests/mochitest/jsat/dom_helper.js @@ -109,9 +109,10 @@ var originalConsecutiveGestureDelay = * Attach a listener for the mozAccessFuGesture event that tests its * type. * @param {Array} aExpectedGestures A stack of expected event types. + * @param {String} aTitle Title of this sequence, if any. * Note: the listener is removed once the stack reaches 0. */ -function testMozAccessFuGesture(aExpectedGestures) { +function testMozAccessFuGesture(aExpectedGestures, aTitle) { var types = aExpectedGestures; function handleGesture(aEvent) { if (aEvent.detail.type !== types[0].type) { @@ -120,8 +121,10 @@ function testMozAccessFuGesture(aExpectedGestures) { return; } is(!!aEvent.detail.edge, !!types[0].edge); + is(aEvent.detail.touches.length, types[0].fingers || 1, + 'failed to count fingers: ' + types[0].type); ok(true, 'Received correct mozAccessFuGesture: ' + - JSON.stringify(types.shift()) + '.'); + JSON.stringify(types.shift()) + '. (' + aTitle + ')'); if (types.length === 0) { win.removeEventListener('mozAccessFuGesture', handleGesture); if (AccessFuTest.sequenceCleanup) { @@ -168,7 +171,7 @@ function resetTimers() { */ AccessFuTest.addSequence = function AccessFuTest_addSequence(aSequence) { AccessFuTest.addFunc(function testSequence() { - testMozAccessFuGesture(aSequence.expectedGestures); + testMozAccessFuGesture(aSequence.expectedGestures, aSequence.title); var events = aSequence.events; function fireEvent(aEvent) { var event = { diff --git a/accessible/tests/mochitest/jsat/gestures.json b/accessible/tests/mochitest/jsat/gestures.json index 2e5f800a89c..b6cc23c4a07 100644 --- a/accessible/tests/mochitest/jsat/gestures.json +++ b/accessible/tests/mochitest/jsat/gestures.json @@ -162,7 +162,7 @@ {"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1}, {"x": 1.5, "y": 1.5, "identifier": 2}]} ], - "expectedGestures": [{ "type": "swiperight" }] + "expectedGestures": [{ "type": "swiperight", "fingers": 2 }] }, { "events": [ @@ -173,7 +173,7 @@ {"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1}]}, {"type": "pointerup", "points": [{"x": 1.5, "y": 1.5, "identifier": 2}]} ], - "expectedGestures": [{ "type": "swiperight" }] + "expectedGestures": [{ "type": "swiperight", "fingers": 2 }] }, { "events": [ @@ -187,7 +187,7 @@ {"x": 1.5, "y": 1.5, "identifier": 2}, {"x": 1.5, "y": 2, "identifier": 3}]} ], - "expectedGestures": [{ "type": "swiperight" }] + "expectedGestures": [{ "type": "swiperight", "fingers": 3 }] }, { "events": [ @@ -263,6 +263,96 @@ {"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1}, {"x": 1.5, "y": 1.5, "identifier": 2}]} ], - "expectedGestures": [{ "type": "swiperight", "edge": true }] + "expectedGestures": [{ "type": "swiperight", "edge": true, "fingers": 2 }] + }, + { + "title": "Bug 1182311 - 3 finger triple tap is not reliable 1/2", + "events": [ + {"points": [ + {"y": 1.88467, "x": 0.89311, "identifier": 0}, + {"y": 2.78481, "x": 0.56259, "identifier": 1}, + {"y": 1.35021, "x": 1.37834, "identifier": 2}], "type": "pointerdown"}, + {"points": [ + {"y": 1.88467, "x": 0.89311, "identifier": 0}, + {"y": 2.78481, "x": 0.56259, "identifier": 1}, + {"y": 1.35021, "x": 1.37834, "identifier": 2}], "type": "pointerup"}, + {"points": [ + {"y": 1.76512, "x": 0.98453, "identifier": 0}, + {"y": 1.1744, "x": 1.4346, "identifier": 1}, + {"y": 2.5879, "x": 0.61181, "identifier": 2}], "type": "pointerdown"}, + {"points": [ + {"y": 1.76512, "x": 0.98453, "identifier": 0}, + {"y": 1.1744, "x": 1.4346, "identifier": 1}, + {"y": 2.5879, "x": 0.61181, "identifier": 2}], "type": "pointerup"}, + {"points": [ + {"y": 1.30098, "x": 1.52602, "identifier": 0}, + {"y": 1.94093, "x": 1.02672, "identifier": 1}, + {"y": 2.67229, "x": 0.75246, "identifier": 2}], "type": "pointerdown"}, + {"points": [ + {"y": 1.30098, "x": 1.52602, "identifier": 0}, + {"y": 1.94093, "x": 1.02672, "identifier": 1}, + {"y": 2.67229, "x": 0.75246, "identifier": 2}], "type": "pointerup", + "removeConsecutiveGestureDelay": false}], + "expectedGestures": [{ "type": "tripletap", "fingers": 3 }] + }, + { + "title": "Bug 1182311 - 3 finger triple tap is not reliable 2/2", + "events": [ + {"type": "pointerdown", + "points": [{"identifier": 0, "x": 2.21875, "y": 1.510417}]}, + {"type": "pointerdown", + "points": [{"identifier": 1, "x": 1.479167, "y": 2.53125}]}, + {"type": "pointerdown", + "points": [{"identifier": 2, "x": 1.072917, "y": 3.739583}]}, + {"type": "pointermove", + "points": [{"identifier": 1, "x": 1.46875, "y": 2.53125}]}, + {"type": "pointermove", + "points": [{"identifier": 1, "x": 1.447917, "y": 2.46875}]}, + {"type": "pointerup", + "points": [{"identifier": 0, "x": 2.21875, "y": 1.510417}]}, + {"type": "pointerup", + "points": [{"identifier": 1, "x": 1.447917, "y": 2.489583}]}, + {"type": "pointerup", + "points": [{"identifier": 2, "x": 1.072917, "y": 3.739583}]}, + {"type": "pointerdown", + "points": [{"identifier": 0, "x": 2.114583, "y": 1.572917}]}, + {"type": "pointerdown", + "points": [{"identifier": 1, "x": 1.364583, "y": 2.614583}]}, + {"type": "pointerdown", + "points": [{"identifier": 2, "x": 0.927083, "y": 3.864583}]}, + {"type": "pointermove", + "points": [{"identifier": 1, "x": 1.364583, "y": 2.614583}]}, + {"type": "pointermove", + "points": [{"identifier": 0, "x": 2.114583, "y": 1.572917}]}, + {"type": "pointerup", + "points": [{"identifier": 1, "x": 1.364583, "y": 2.614583}]}, + {"type": "pointerup", + "points": [{"identifier": 2, "x": 0.927083, "y": 3.864583}]}, + {"type": "pointerup", + "points": [{"identifier": 0, "x": 2.114583, "y": 1.572917}]}, + {"type": "pointerdown", + "points": [{"identifier": 0, "x": 1.4375, "y": 2.59375}]}, + {"type": "pointerdown", + "points": [{"identifier": 1, "x": 1.083333, "y": 3.71875}]}, + {"type": "pointerdown", + "points": [{"identifier": 2, "x": 2.15625, "y": 1.489583}]}, + {"type": "pointermove", + "points": [{"identifier": 0, "x": 1.4375, "y": 2.59375}, + {"identifier": 2, "x": 2.15625, "y": 1.489583}]}, + {"type": "pointermove", + "points": [{"identifier": 0, "x": 1.4375, "y": 2.59375}, + {"identifier": 2, "x": 2.15625, "y": 1.489583}]}, + {"type": "pointerup", + "points": [{"identifier": 1, "x": 1.083333, "y": 3.71875}]}, + {"type": "pointermove", + "points": [{"identifier": 0, "x": 1.427083, "y": 2.59375}]}, + {"type": "pointerup", + "points": [{"identifier": 0, "x": 1.427083, "y": 2.59375}]}, + {"type": "pointerup", + "points": [{"identifier": 2, "x": 2.15625, "y": 1.489583}], + "removeConsecutiveGestureDelay": false} + ], + "expectedGestures": [{ "type": "tripletap", "fingers": 3 }] } + ]