Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: third_party/WebKit/LayoutTests/fast/events/constructors/pointer-event-constructor.html

Issue 2406263003: Make PointerEvent coordinates fractional for touch (Closed)
Patch Set: Rebased. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/events/constructors/pointer-event-constructor.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/constructors/pointer-event-constructor.html b/third_party/WebKit/LayoutTests/fast/events/constructors/pointer-event-constructor.html
index 0b2ae15cfba3f30d9a65c22dfed32f6f3364d7c3..d971c169b44b14b86d52f7c79c45e8644f88403c 100644
--- a/third_party/WebKit/LayoutTests/fast/events/constructors/pointer-event-constructor.html
+++ b/third_party/WebKit/LayoutTests/fast/events/constructors/pointer-event-constructor.html
@@ -5,13 +5,14 @@
description("This tests the constructor for the PointerEvent DOM class.");
-debug("--- tests for intrinsic attributes ---");
+debug("--- tests for intrinsic attributes plus screen & client coordinates ---");
["pointerId", "tiltX", "tiltY"].forEach(function (attr) {
debug("-- no init --");
shouldBeZero("new PointerEvent('eventType')." + attr);
debug("-- init with valid long values --");
+ shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": 0 })." + attr, 0);
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": 123 })." + attr, 123);
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": -123 })." + attr, -123);
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": 2147483647 })." + attr, 2147483647);
@@ -34,20 +35,21 @@ debug("--- tests for intrinsic attributes ---");
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": {valueOf: function () { return 123; }} })." + attr, 123);
});
-["width", "height", "pressure"].forEach(function (attr) {
+["width", "height", "pressure", "screenX", "screenY", "clientX", "clientY"].forEach(function (attr) {
debug("-- no init --");
- var defaultValue = 1; // For width and height
- if (attr == "pressure")
- defaultValue = 0;
+ var defaultValue = (attr == "width" || attr == "height") ? 1 : 0;
shouldBeEqualToNumber("new PointerEvent('eventType')." + attr, defaultValue);
debug("-- init with valid float/double values --");
+ shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": 0 })." + attr, 0);
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": 123 })." + attr, 123);
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": -123 })." + attr, -123);
shouldBeCloseTo("new PointerEvent('eventType', { " + attr + ": 123.45 })." + attr, 123.45, 0.00001);
shouldBeCloseTo("new PointerEvent('eventType', { " + attr + ": -123.45 })." + attr, -123.45, 0.00001);
shouldBeCloseTo("new PointerEvent('eventType', { " + attr + ": 1.23e5 })." + attr, 123000, 0.00001);
shouldBeCloseTo("new PointerEvent('eventType', { " + attr + ": -1.2e-3 })." + attr, -0.0012, 0.00001);
+ shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": 16777215 })." + attr, 16777215);
+ shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": -16777216 })." + attr, -16777216);
debug("-- init with non-float/double values --");
shouldThrow("new PointerEvent('eventType', { " + attr + ": '123abc' })." + attr);
@@ -56,7 +58,6 @@ debug("--- tests for intrinsic attributes ---");
shouldBeZero("new PointerEvent('eventType', { " + attr + ": null })." + attr);
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": undefined })." + attr, defaultValue);
shouldBeZero("new PointerEvent('eventType', { " + attr + ": [] })." + attr);
-
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": [12] })." + attr, 12);
shouldThrow("new PointerEvent('eventType', { " + attr + ": [12, 34] })." + attr);
shouldThrow("new PointerEvent('eventType', { " + attr + ": {} })." + attr);
@@ -65,16 +66,12 @@ debug("--- tests for intrinsic attributes ---");
shouldBeEqualToNumber("new PointerEvent('eventType', { " + attr + ": {valueOf: function () { return 123; }} })." + attr, 123);
});
-debug("--- tests for inherited attributes ---");
+debug("--- tests for inherited attributes (other than screen & client coordinates) ---");
shouldBeFalse("new PointerEvent('eventType').bubbles");
shouldBeFalse("new PointerEvent('eventType').cancelable");
shouldBeNull("new PointerEvent('eventType').view");
shouldBeZero("new PointerEvent('eventType').detail");
-shouldBeZero("new PointerEvent('eventType').screenX");
-shouldBeZero("new PointerEvent('eventType').screenY");
-shouldBeZero("new PointerEvent('eventType').clientX");
-shouldBeZero("new PointerEvent('eventType').clientY");
shouldBeFalse("new PointerEvent('eventType').ctrlKey");
shouldBeFalse("new PointerEvent('eventType').shiftKey");
shouldBeFalse("new PointerEvent('eventType').altKey");

Powered by Google App Engine
This is Rietveld 408576698