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

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

Issue 2406263003: Make PointerEvent coordinates fractional for touch (Closed)
Patch Set: Updated a TODO. Created 4 years, 2 months 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/wheel-event-constructor.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/constructors/wheel-event-constructor.html b/third_party/WebKit/LayoutTests/fast/events/constructors/wheel-event-constructor.html
index 977df4cba0fae19e7d165bc6fa2ee8e8552584fa..fbe54456a24ba46bc5c8ef88d774b9581fa46e45 100644
--- a/third_party/WebKit/LayoutTests/fast/events/constructors/wheel-event-constructor.html
+++ b/third_party/WebKit/LayoutTests/fast/events/constructors/wheel-event-constructor.html
@@ -62,12 +62,72 @@ shouldBe("new WheelEvent('eventType', { get view() { return window; } }).view",
shouldThrow("new WheelEvent('eventType', { get view() { return 123; } }).view");
shouldThrow("new WheelEvent('eventType', { get view() { throw 'WheelEvent Error'; } })");
+// detail is passed.
+// numbers within the long range.
+shouldBe("new WheelEvent('eventType', { detail: 0 }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: 2147483647 }).detail", "2147483647");
+shouldBe("new WheelEvent('eventType', { detail: -1 }).detail", "-1");
+shouldBe("new WheelEvent('eventType', { detail: -2147483648 }).detail", "-2147483648");
+// numbers out of the long range.
+shouldBe("new WheelEvent('eventType', { detail: 4294967295 }).detail", "-1");
+// 2^{53}-1, the largest number that can be exactly represented by double.
+shouldBe("new WheelEvent('eventType', { detail: 9007199254740991 }).detail", "-1");
+// 2^{64}-1
+shouldBe("new WheelEvent('eventType', { detail: 18446744073709551615 }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: 123.45 }).detail", "123");
+shouldBe("new WheelEvent('eventType', { detail: NaN }).detail", "0");
+// Non-numeric values.
+shouldBe("new WheelEvent('eventType', { detail: undefined }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: null }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: '' }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: '12345' }).detail", "12345");
+shouldBe("new WheelEvent('eventType', { detail: '12345a' }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: 'abc' }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: [] }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: [12345] }).detail", "12345");
+shouldBe("new WheelEvent('eventType', { detail: [12345, 67890] }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: {} }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: {moemoe: 12345} }).detail", "0");
+shouldBe("new WheelEvent('eventType', { detail: {valueOf: function () { return 12345; }} }).detail", "12345");
+
// Max/min for client positions (LayoutUnit max/min).
var MAX_CLIENT_SIZE = "33554431";
var MIN_CLIENT_SIZE = "-33554432";
-// detail, screenX, screenY, clientX, clientY, wheelDeltaX and wheelDeltaY are passed.
-["detail", "screenX", "screenY", "clientX", "clientY", "wheelDeltaX", "wheelDeltaY"].forEach(function (attr) {
+// screenX, screenY, clientX and clientY are passed.
+["screenX", "screenY", "clientX", "clientY"].forEach(function (attr) {
+ // numbers within the long range.
+ shouldBe("new WheelEvent('eventType', { " + attr + ": 0 })." + attr, "0");
+ shouldBe("new WheelEvent('eventType', { " + attr + ": 2147483647 })." + attr, MAX_CLIENT_SIZE);
+ shouldBe("new WheelEvent('eventType', { " + attr + ": -1 })." + attr, "-1");
+ shouldBe("new WheelEvent('eventType', { " + attr + ": -2147483648 })." + attr, MIN_CLIENT_SIZE);
+
+ // numbers out of the long range.
+ shouldBe("new WheelEvent('eventType', { " + attr + ": 4294967295 })." + attr, MAX_CLIENT_SIZE);
+ // 2^{53}-1, the largest number that can be exactly represented by double.
+ shouldBe("new WheelEvent('eventType', { " + attr + ": 9007199254740991 })." + attr, MAX_CLIENT_SIZE);
+ // 2^{64}-1
+ shouldBe("new WheelEvent('eventType', { " + attr + ": 18446744073709551615 })." + attr, MAX_CLIENT_SIZE);
+ shouldBe("new WheelEvent('eventType', { " + attr + ": 123.45 })." + attr, "123");
+ shouldThrow("new WheelEvent('eventType', { " + attr + ": NaN })." + attr);
+
+ // Non-numeric values.
+ shouldBe("new WheelEvent('eventType', { " + attr + ": undefined })." + attr, "0");
+ shouldBe("new WheelEvent('eventType', { " + attr + ": null })." + attr, "0");
+ shouldBe("new WheelEvent('eventType', { " + attr + ": '' })." + attr, "0");
+ shouldBe("new WheelEvent('eventType', { " + attr + ": '12345' })." + attr, "12345");
+ shouldThrow("new WheelEvent('eventType', { " + attr + ": '12345a' })." + attr);
+ shouldThrow("new WheelEvent('eventType', { " + attr + ": 'abc' })." + attr);
+ shouldBe("new WheelEvent('eventType', { " + attr + ": [] })." + attr, "0");
+ shouldBe("new WheelEvent('eventType', { " + attr + ": [12345] })." + attr, "12345");
+ shouldThrow("new WheelEvent('eventType', { " + attr + ": [12345, 67890] })." + attr);
+ shouldThrow("new WheelEvent('eventType', { " + attr + ": {} })." + attr);
+ shouldThrow("new WheelEvent('eventType', { " + attr + ": {moemoe: 12345} })." + attr);
+ shouldBe("new WheelEvent('eventType', { " + attr + ": {valueOf: function () { return 12345; }} })." + attr, "12345");
+});
+
+// wheelDeltaX and wheelDeltaY are passed.
+["wheelDeltaX", "wheelDeltaY"].forEach(function (attr) {
// numbers within the long range.
shouldBe("new WheelEvent('eventType', { " + attr + ": 0 })." + attr, "0");
shouldBe("new WheelEvent('eventType', { " + attr + ": 2147483647 })." + attr, attr == "clientX" || attr == "clientY" ? MAX_CLIENT_SIZE : "2147483647");

Powered by Google App Engine
This is Rietveld 408576698