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

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: No Change 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-basic-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2f00fe2684d5a5d286012237d035d538128dc258 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:scroll; white-space:nowrap;">
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698