Bug 149738
Summary: | Convert svg/animation tests to not use eventSender, so they run on iOS | ||
---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ap, dino, lforschler, simon.fraser |
Priority: | P2 | ||
Version: | Safari 9 | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Simon Fraser (smfr)
Tests that use LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js, like all the svg/animation tests, make use of eventSender to fake a click event:
function clickAt(x, y) {
// Translation due to <h1> above us
x = x + rootSVGElement.offsetLeft;
y = y + rootSVGElement.offsetTop;
if (window.eventSender) {
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
We should fix this so that the tests run on iOS.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Simon Fraser (smfr)
I tried dispatching a synthetic click event, and most tests worked bug svg/animations/use-animate-width-and-height.html failed.
Simon Fraser (smfr)
diff --git a/LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js b/LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js
index 6936786e5c26b69055aac391da66c30543907796..a77ea711e52db7ac285aada3aa3e46807fbc8e30 100644
--- a/LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js
+++ b/LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js
@@ -46,11 +46,24 @@ function clickAt(x, y) {
x = x + rootSVGElement.offsetLeft;
y = y + rootSVGElement.offsetTop;
- if (window.eventSender) {
- eventSender.mouseMoveTo(x, y);
- eventSender.mouseDown();
- eventSender.mouseUp();
- }
+ // if (window.eventSender) {
+ // eventSender.mouseMoveTo(x, y);
+ // eventSender.mouseDown();
+ // eventSender.mouseUp();
+ // }
+
+ var target = document.elementFromPoint(x, y);
+ var event = new MouseEvent('click', {
+ 'view': window,
+ 'bubbles': true,
+ 'cancelable': true,
+ 'clientX': x,
+ 'clientY': y
+ });
+
+ window.console.log('sending click at ' + x + ' ' + y + ' to ' + target)
+
+ target.dispatchEvent(event);
}
function completeTest() {