1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/events/test/test_bug422132.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,96 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=422132 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 422132</title> 1.11 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.15 +</head> 1.16 +<body> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422132">Mozilla Bug 422132</a> 1.18 +<p id="display"></p> 1.19 +<div id="target" style="font-size: 0; width: 200px; height: 200px; overflow: auto;"> 1.20 + <div style="width: 1000px; height: 1000px;"></div> 1.21 +</div> 1.22 +<div id="content" style="display: none"> 1.23 + 1.24 +</div> 1.25 +<pre id="test"> 1.26 +<script class="testbody" type="text/javascript"> 1.27 + 1.28 +/** Test for Bug 422132 **/ 1.29 + 1.30 +SimpleTest.waitForExplicitFinish(); 1.31 +SimpleTest.waitForFocus(runTests, window); 1.32 + 1.33 +function hitEventLoop(aFunc, aTimes) 1.34 +{ 1.35 + if (--aTimes) { 1.36 + setTimeout(hitEventLoop, 0, aFunc, aTimes); 1.37 + } else { 1.38 + setTimeout(aFunc, 20); 1.39 + } 1.40 +} 1.41 + 1.42 +function runTests() 1.43 +{ 1.44 + SpecialPowers.setBoolPref("general.smoothScroll", false); 1.45 + SpecialPowers.setIntPref("mousewheel.min_line_scroll_amount", 1); 1.46 + SpecialPowers.setIntPref("mousewheel.transaction.timeout", 100000); 1.47 + 1.48 + var target = document.getElementById("target"); 1.49 + 1.50 + var scrollLeft = target.scrollLeft; 1.51 + var scrollTop = target.scrollTop; 1.52 + synthesizeWheel(target, 10, 10, 1.53 + { deltaMode: WheelEvent.DOM_DELTA_PIXEL, 1.54 + deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 }); 1.55 + hitEventLoop(function () { 1.56 + is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5px delta value"); 1.57 + is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5px delta value"); 1.58 + scrollLeft = target.scrollLeft; 1.59 + scrollTop = target.scrollTop; 1.60 + synthesizeWheel(target, 10, 10, 1.61 + { deltaMode: WheelEvent.DOM_DELTA_PIXEL, 1.62 + deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 }); 1.63 + hitEventLoop(function () { 1.64 + ok(target.scrollLeft > scrollLeft, 1.65 + "not scrolled to right by 0.5px delta value with pending 0.5px delta"); 1.66 + ok(target.scrollTop > scrollTop, 1.67 + "not scrolled to bottom by 0.5px delta value with pending 0.5px delta"); 1.68 + scrollLeft = target.scrollLeft; 1.69 + scrollTop = target.scrollTop; 1.70 + synthesizeWheel(target, 10, 10, 1.71 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.72 + deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 }); 1.73 + hitEventLoop(function () { 1.74 + is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5 line delta value"); 1.75 + is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5 line delta value"); 1.76 + scrollLeft = target.scrollLeft; 1.77 + scrollTop = target.scrollTop; 1.78 + synthesizeWheel(target, 10, 10, 1.79 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.80 + deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }); 1.81 + hitEventLoop(function () { 1.82 + ok(target.scrollLeft > scrollLeft, 1.83 + "not scrolled to right by 0.5 line delta value with pending 0.5 line delta"); 1.84 + ok(target.scrollTop > scrollTop, 1.85 + "not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta"); 1.86 + SpecialPowers.clearUserPref("general.smoothScroll"); 1.87 + SpecialPowers.clearUserPref("mousewheel.min_line_scroll_amount"); 1.88 + SpecialPowers.clearUserPref("mousewheel.transaction.timeout"); 1.89 + SimpleTest.finish(); 1.90 + }, 20); 1.91 + }, 20); 1.92 + }, 20); 1.93 + }, 20); 1.94 +} 1.95 + 1.96 +</script> 1.97 +</pre> 1.98 +</body> 1.99 +</html>