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

Unified Diff: LayoutTests/fast/events/wheelevent-basic.html

Issue 23034006: WheelEvent's deltaX/deltaY should report real amount of pixels scrolled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo in test Created 7 years, 4 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: LayoutTests/fast/events/wheelevent-basic.html
diff --git a/LayoutTests/fast/events/wheelevent-basic.html b/LayoutTests/fast/events/wheelevent-basic.html
index d9059776c21464bc94d002975e3cc570cecfd022..167e48d266dd6f8e9f7ce123c18cbff7fdc34b2b 100644
--- a/LayoutTests/fast/events/wheelevent-basic.html
+++ b/LayoutTests/fast/events/wheelevent-basic.html
@@ -4,8 +4,10 @@
<link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEvent">
<script src="../js/resources/js-test-pre.js"></script>
<script>
-var deltaX = 10;
-var deltaY = 120;
+var deltaX = 0;
+var deltaY = 0;
+var expectedDeltaX;
+var expectedDeltaY;
var testDiv;
function runTest() {
@@ -23,48 +25,49 @@ function runTest() {
testDiv.addEventListener('wheel', wheelHandler);
if (window.eventSender) {
eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
- eventSender.mouseScrollBy(deltaX, deltaY);
+ eventSender.mouseScrollBy(-1, -2);
+ expectedDeltaX = testDiv.scrollLeft;
+ expectedDeltaY = testDiv.scrollTop;
+ shouldBeTrue("deltaX > 0");
+ shouldBe("deltaX", "expectedDeltaX");
+ shouldBeTrue("deltaY > 0");
+ shouldBe("deltaY", "expectedDeltaY");
} else {
debug("FAIL: This test requires window.eventSender.");
- finishJSTest();
}
}
var testEvent;
-var tickMultiplier = 120;
-var expectedDeltaX = -deltaX * tickMultiplier;
-var expectedDeltaY = -deltaY * tickMultiplier;
function wheelHandler(e) {
testEvent = e;
shouldBe("testEvent.__proto__", "WheelEvent.prototype");
shouldBe("testEvent.__proto__.__proto__", "MouseEvent.prototype");
- shouldBe("testEvent.deltaX", "expectedDeltaX");
- shouldBe("testEvent.deltaY", "expectedDeltaY");
+ if (e.deltaX)
+ deltaX = e.deltaX;
+ if (e.deltaY)
+ deltaY = e.deltaY;
shouldBe("testEvent.deltaZ", "0");
shouldBe("testEvent.deltaMode", "WheelEvent.DOM_DELTA_PIXEL")
-
- testDiv.removeEventListener("wheel", wheelHandler);
- finishJSTest();
}
</script>
</head>
<body>
<span id="parent">
- <div id="target" style="border:solid 1px green; width:220px; height:70px; overflow:scroll">
- TOP TOP TOP TOP TOP TOP TOP
- Scroll mouse wheel over here
- Scroll mouse wheel over here
- Scroll mouse wheel over here
- Scroll mouse wheel over here
- Scroll mouse wheel over here
- Scroll mouse wheel over here
- END END END END END END END
+ <div id="target" style="border:solid 1px green; width:220px; height:70px; overflow-x:scroll; overflow-y:scroll; white-space: nowrap;">
arv (Not doing code reviews) 2013/08/22 14:15:49 "overflow: scroll" is shorthand for "overflow-x: s
do-not-use 2013/08/22 14:46:03 Oh, I did not know that. I will fix it.
do-not-use 2013/08/22 15:08:21 Done.
+ TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP<br/>
+ Scroll mouse wheel over here<br/>
+ Scroll mouse wheel over here<br/>
+ Scroll mouse wheel over here<br/>
+ Scroll mouse wheel over here<br/>
+ Scroll mouse wheel over here<br/>
+ Scroll mouse wheel over here<br/>
+ END END END END END END END END END END END END END END<br/>
</div>
</span>
+<div id="console"></div>
<script>
description("Tests the basic functionality of the standard wheel event");
-window.jsTestIsAsync = true;
runTest();
</script>
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-basic-expected.txt » ('j') | Source/core/dom/WheelEvent.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698