Title: [206613] trunk/LayoutTests
Revision
206613
Author
cdu...@apple.com
Date
2016-09-29 14:13:33 -0700 (Thu, 29 Sep 2016)

Log Message

[iOS] Add test for Touch constructor
https://bugs.webkit.org/show_bug.cgi?id=162736
<rdar://problem/28520007>

Reviewed by Ryosuke Niwa.

Add test for Touch constructor. There are no expected results because
the test (folder) is skipped in the open source.

* fast/events/touch/touch-constructor.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206612 => 206613)


--- trunk/LayoutTests/ChangeLog	2016-09-29 21:04:34 UTC (rev 206612)
+++ trunk/LayoutTests/ChangeLog	2016-09-29 21:13:33 UTC (rev 206613)
@@ -1,3 +1,16 @@
+2016-09-29  Chris Dumez  <cdu...@apple.com>
+
+        [iOS] Add test for Touch constructor
+        https://bugs.webkit.org/show_bug.cgi?id=162736
+        <rdar://problem/28520007>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add test for Touch constructor. There are no expected results because
+        the test (folder) is skipped in the open source.
+
+        * fast/events/touch/touch-constructor.html: Added.
+
 2016-09-28  Ada Chan  <adac...@apple.com>
 
         Fix flaky test media/click-placeholder-not-pausing.html

Added: trunk/LayoutTests/fast/events/touch/touch-constructor.html (0 => 206613)


--- trunk/LayoutTests/fast/events/touch/touch-constructor.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-constructor.html	2016-09-29 21:13:33 UTC (rev 206613)
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Test the Touch constructor");
+
+// identifier and target members are required.
+shouldThrowErrorName("new Touch({ })", "TypeError");
+shouldThrowErrorName("new Touch({ identifier: 0 })", "TypeError");
+shouldThrowErrorName("new Touch({ target: document.body })", "TypeError");
+
+// target is not nullable.
+shouldThrowErrorName("new Touch({ identifier: 0, target: null })", "TypeError");
+
+function validateTouch(touch, dictionary)
+{
+    createdTouch = touch;
+    init = dictionary;
+    shouldBe("createdTouch.identifier", "init.identifier");
+    shouldBe("createdTouch.target", "init.target");
+    if (init.hasOwnProperty("screenX"))
+        shouldBe("createdTouch.screenX", "init.screenX");
+    else
+        shouldBe("createdTouch.screenX", "0");
+    if (init.hasOwnProperty("screenX"))
+        shouldBe("createdTouch.screenX", "init.screenX");
+    else
+        shouldBe("createdTouch.screenX", "0");
+    if (init.hasOwnProperty("screenX"))
+        shouldBe("createdTouch.screenX", "init.screenX");
+    else
+        shouldBe("createdTouch.screenX", "0");
+    if (init.hasOwnProperty("screenY"))
+        shouldBe("createdTouch.screenY", "init.screenY");
+    else
+        shouldBe("createdTouch.screenY", "0");
+    if (init.hasOwnProperty("pageX"))
+        shouldBe("createdTouch.pageX", "init.pageX");
+    else
+        shouldBe("createdTouch.pageX", "0");
+    if (init.hasOwnProperty("pageY"))
+        shouldBe("createdTouch.pageY", "init.pageY");
+    else
+        shouldBe("createdTouch.pageY", "0");
+    if (init.hasOwnProperty("force"))
+        shouldBe("createdTouch.force", "init.force");
+    else
+        shouldBe("createdTouch.force", "0");
+}
+
+debug("");
+shouldNotThrow("touch = new Touch({ identifier: 1, target: document.body })");
+validateTouch(touch, { identifier: 1, target: document.body });
+
+debug("");
+shouldNotThrow("touch = new Touch({ identifier: 1, target: document.body, clientX: 1, clientY: 2, screenX: 3, screenY: 4, pageX: 5, pageY: 6, force: 7 })");
+validateTouch(touch, { identifier: 1, target: document.body, clientX: 1, clientY: 2, screenX: 3, screenY: 4, pageX: 5, pageY: 6, force: 7 });
+
+debug("");
+shouldNotThrow("touch = new Touch({ identifier: 1, target: document.body, clientX: 1.5, clientY: 2.5, screenX: 3.5, screenY: 4.5, pageX: 5.5, pageY: 6.5, force: 7.5 })");
+validateTouch(touch, { identifier: 1, target: document.body, clientX: 1.5, clientY: 2.5, screenX: 3.5, screenY: 4.5, pageX: 5.5, pageY: 6.5, force: 7.5 });
+</script>
+<script src=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to