Bug 829566 - have marionette client send right tap event depending on shim, r=jgriffin

This commit is contained in:
Malini Das 2013-01-16 11:40:06 -05:00
parent 3de1bf91c3
commit 313d1c0456
3 changed files with 14 additions and 6 deletions

View File

@ -18,7 +18,10 @@ class MarionetteTouchMixin(object):
self.import_script(self.library)
def tap(self, element):
self.execute_script("%s.tap(arguments[0]);" % self.library_name, [element])
# we pass in touch/mouse/click events if mouse_event_shim.js isn't included in the gaia app
# otherwise, we just send touch events. See Bug 829566
send_all = self.execute_script("return typeof window.wrappedJSObject.MouseEventShim === 'undefined';")
self.execute_script("%s.tap(arguments[0], null, null, null, null, arguments[1]);" % self.library_name, [element, send_all])
def double_tap(self, element):
self.execute_script("%s.dbltap(arguments[0]);" % self.library_name, [element])

View File

@ -285,7 +285,7 @@ var SyntheticGestures = (function() {
// x and y are the relative to the viewport.
// If not specified then the center of the target is used. t is the
// optional amount of time between touchstart and touchend event.
function tap(target, then, x, y, t) {
function tap(target, then, x, y, t, sendAll) {
if (!SyntheticGestures.touchSupported) {
console.warn('tap: touch events not supported; using mouse instead');
return mousetap(target, then, x, y, t);
@ -298,9 +298,14 @@ var SyntheticGestures = (function() {
var c = coordinates(target, x, y);
touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], function() {
mousetap(target, then, x, y, t, true);
});
if (sendAll) {
touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], function() {
mousetap(target, then, x, y, t, true);
});
}
else {
touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], then);
}
}
// Dispatch a dbltap gesture. The arguments are like those to tap()

View File

@ -1,7 +1,7 @@
import os
from setuptools import setup, find_packages
version = '0.5.15'
version = '0.5.16'
# get documentation from the README
try: