Add some basic pointer events tests
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2018 00:46:34 +0000 (00:46 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2018 00:46:34 +0000 (00:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191336
<rdar://problem/45858574>

Reviewed by Wenson Hsieh.

Generate some fake touches for pointer events testing.

* fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup-expected.txt: Added.
* fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html: Added.
* fast/events/pointer/ios/tap-gives-pointerdown-pointerup-expected.txt: Added.
* fast/events/pointer/ios/tap-gives-pointerdown-pointerup.html: Added.
* platform/ios/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237902 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html [new file with mode: 0644]
LayoutTests/fast/events/pointer/ios/tap-gives-pointerdown-pointerup-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/pointer/ios/tap-gives-pointerdown-pointerup.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations

index a48b497..0646377 100644 (file)
@@ -1,3 +1,19 @@
+2018-11-06  Dean Jackson  <dino@apple.com>
+
+        Add some basic pointer events tests
+        https://bugs.webkit.org/show_bug.cgi?id=191336
+        <rdar://problem/45858574>
+
+        Reviewed by Wenson Hsieh.
+
+        Generate some fake touches for pointer events testing.
+
+        * fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup-expected.txt: Added.
+        * fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html: Added.
+        * fast/events/pointer/ios/tap-gives-pointerdown-pointerup-expected.txt: Added.
+        * fast/events/pointer/ios/tap-gives-pointerdown-pointerup.html: Added.
+        * platform/ios/TestExpectations:
+
 2018-11-06  Timothy Hatcher  <timothy@apple.com>
 
         Skip css-dark-mode tests on older macOS platforms
diff --git a/LayoutTests/fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup-expected.txt b/LayoutTests/fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup-expected.txt
new file mode 100644 (file)
index 0000000..6981c91
--- /dev/null
@@ -0,0 +1,14 @@
+Test that a drag is registered as a pointerdown, then pointermoves, then pointerup.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    pointerdown fired.
+Remove this when bug 19133 is fixed.
+At least one pointermove was fired.
+pointerup fired.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html b/LayoutTests/fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html
new file mode 100644 (file)
index 0000000..9c5d235
--- /dev/null
@@ -0,0 +1,57 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:PointerEventsEnabled=true ] -->
+<html>
+<head>
+    <script src="../../../../resources/js-test-pre.js"></script>
+    <script src="../../../../resources/basic-gestures.js"></script>
+    <style>
+        body {
+            margin: none;
+        }
+    </style>
+    <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+    <p id="description"></p>
+    <div id="console">
+    </div>
+    <script>
+        description("Test that a drag is registered as a pointerdown, then pointermoves, then pointerup.");
+        window.jsTestIsAsync = true;
+
+        function runTest()
+        {
+            // FIXME: At the moment a touch listener is required due
+            // to the way pointer events are dispatched.
+            // https://bugs.webkit.org/show_bug.cgi?id=191333
+            window.addEventListener("touchstart", (event) => {
+                debug("Remove this when bug 19133 is fixed.");
+            });
+
+            window.addEventListener("pointerdown", (event) => {
+                debug("pointerdown fired.");
+            });
+
+            seenMove = false;
+            window.addEventListener("pointermove", (event) => {
+                if (!seenMove)
+                    debug("At least one pointermove was fired.");
+                seenMove = true;
+            });
+
+            window.addEventListener("pointerup", (event) => {
+                debug("pointerup fired.");
+                finishJSTest();
+            });
+
+            if (window.testRunner) {
+                touchAndDragFromPointToPoint(50, 200, 60, 210).then(() => {
+                    liftUpAtPoint(60, 210);
+                });
+            }
+        }
+
+        window.addEventListener("load", runTest, false);
+    </script>
+    <script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/events/pointer/ios/tap-gives-pointerdown-pointerup-expected.txt b/LayoutTests/fast/events/pointer/ios/tap-gives-pointerdown-pointerup-expected.txt
new file mode 100644 (file)
index 0000000..5d36057
--- /dev/null
@@ -0,0 +1,13 @@
+Test that a tap is registered as a pointerdown then pointerup.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    pointerdown fired.
+Remove this when bug 19133 is fixed.
+pointerup fired.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/events/pointer/ios/tap-gives-pointerdown-pointerup.html b/LayoutTests/fast/events/pointer/ios/tap-gives-pointerdown-pointerup.html
new file mode 100644 (file)
index 0000000..d8d62fe
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:PointerEventsEnabled=true ] -->
+<html>
+<head>
+    <script src="../../../../resources/js-test-pre.js"></script>
+    <script src="../../../../resources/ui-helper.js"></script>
+    <style>
+        body {
+            margin: none;
+        }
+    </style>
+    <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+    <p id="description"></p>
+    <div id="console">
+    </div>
+    <script>
+        description("Test that a tap is registered as a pointerdown then pointerup.");
+        window.jsTestIsAsync = true;
+
+        function runTest()
+        {
+            // FIXME: At the moment a touch listener is required due
+            // to the way pointer events are dispatched.
+            // https://bugs.webkit.org/show_bug.cgi?id=191333
+            window.addEventListener("touchstart", (event) => {
+                debug("Remove this when bug 19133 is fixed.");
+            });
+
+            window.addEventListener("pointerdown", (event) => {
+                debug("pointerdown fired.");
+            });
+
+            window.addEventListener("pointerup", (event) => {
+                debug("pointerup fired.");
+                finishJSTest();
+            });
+
+            UIHelper.tapAt(50, 200);
+        }
+
+        window.addEventListener("load", runTest, false);
+    </script>
+    <script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
index 991ba0a..e6173cd 100644 (file)
@@ -3218,3 +3218,6 @@ webkit.org/b/190764 editing/spelling/spelling-dots-repaint.html [ Skip ]
 webkit.org/b/190764 editing/spelling/spelling-dots-position.html [ Skip ]
 webkit.org/b/190764 editing/spelling/spelling-dots-position-2.html [ Skip ]
 webkit.org/b/190764 editing/spelling/spelling-dots-position-3.html [ Skip ]
+
+# Skip on OpenSource while the code is in WebKitAdditions
+fast/events/pointer [ Skip ]