Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=422132 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 422132</title> |
michael@0 | 8 | <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422132">Mozilla Bug 422132</a> |
michael@0 | 15 | <p id="display"></p> |
michael@0 | 16 | <div id="target" style="font-size: 0; width: 200px; height: 200px; overflow: auto;"> |
michael@0 | 17 | <div style="width: 1000px; height: 1000px;"></div> |
michael@0 | 18 | </div> |
michael@0 | 19 | <div id="content" style="display: none"> |
michael@0 | 20 | |
michael@0 | 21 | </div> |
michael@0 | 22 | <pre id="test"> |
michael@0 | 23 | <script class="testbody" type="text/javascript"> |
michael@0 | 24 | |
michael@0 | 25 | /** Test for Bug 422132 **/ |
michael@0 | 26 | |
michael@0 | 27 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 28 | SimpleTest.waitForFocus(runTests, window); |
michael@0 | 29 | |
michael@0 | 30 | function hitEventLoop(aFunc, aTimes) |
michael@0 | 31 | { |
michael@0 | 32 | if (--aTimes) { |
michael@0 | 33 | setTimeout(hitEventLoop, 0, aFunc, aTimes); |
michael@0 | 34 | } else { |
michael@0 | 35 | setTimeout(aFunc, 20); |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function runTests() |
michael@0 | 40 | { |
michael@0 | 41 | SpecialPowers.setBoolPref("general.smoothScroll", false); |
michael@0 | 42 | SpecialPowers.setIntPref("mousewheel.min_line_scroll_amount", 1); |
michael@0 | 43 | SpecialPowers.setIntPref("mousewheel.transaction.timeout", 100000); |
michael@0 | 44 | |
michael@0 | 45 | var target = document.getElementById("target"); |
michael@0 | 46 | |
michael@0 | 47 | var scrollLeft = target.scrollLeft; |
michael@0 | 48 | var scrollTop = target.scrollTop; |
michael@0 | 49 | synthesizeWheel(target, 10, 10, |
michael@0 | 50 | { deltaMode: WheelEvent.DOM_DELTA_PIXEL, |
michael@0 | 51 | deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 }); |
michael@0 | 52 | hitEventLoop(function () { |
michael@0 | 53 | is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5px delta value"); |
michael@0 | 54 | is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5px delta value"); |
michael@0 | 55 | scrollLeft = target.scrollLeft; |
michael@0 | 56 | scrollTop = target.scrollTop; |
michael@0 | 57 | synthesizeWheel(target, 10, 10, |
michael@0 | 58 | { deltaMode: WheelEvent.DOM_DELTA_PIXEL, |
michael@0 | 59 | deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 }); |
michael@0 | 60 | hitEventLoop(function () { |
michael@0 | 61 | ok(target.scrollLeft > scrollLeft, |
michael@0 | 62 | "not scrolled to right by 0.5px delta value with pending 0.5px delta"); |
michael@0 | 63 | ok(target.scrollTop > scrollTop, |
michael@0 | 64 | "not scrolled to bottom by 0.5px delta value with pending 0.5px delta"); |
michael@0 | 65 | scrollLeft = target.scrollLeft; |
michael@0 | 66 | scrollTop = target.scrollTop; |
michael@0 | 67 | synthesizeWheel(target, 10, 10, |
michael@0 | 68 | { deltaMode: WheelEvent.DOM_DELTA_LINE, |
michael@0 | 69 | deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 }); |
michael@0 | 70 | hitEventLoop(function () { |
michael@0 | 71 | is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5 line delta value"); |
michael@0 | 72 | is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5 line delta value"); |
michael@0 | 73 | scrollLeft = target.scrollLeft; |
michael@0 | 74 | scrollTop = target.scrollTop; |
michael@0 | 75 | synthesizeWheel(target, 10, 10, |
michael@0 | 76 | { deltaMode: WheelEvent.DOM_DELTA_LINE, |
michael@0 | 77 | deltaX: 0.5, deltaY: 0.5, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }); |
michael@0 | 78 | hitEventLoop(function () { |
michael@0 | 79 | ok(target.scrollLeft > scrollLeft, |
michael@0 | 80 | "not scrolled to right by 0.5 line delta value with pending 0.5 line delta"); |
michael@0 | 81 | ok(target.scrollTop > scrollTop, |
michael@0 | 82 | "not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta"); |
michael@0 | 83 | SpecialPowers.clearUserPref("general.smoothScroll"); |
michael@0 | 84 | SpecialPowers.clearUserPref("mousewheel.min_line_scroll_amount"); |
michael@0 | 85 | SpecialPowers.clearUserPref("mousewheel.transaction.timeout"); |
michael@0 | 86 | SimpleTest.finish(); |
michael@0 | 87 | }, 20); |
michael@0 | 88 | }, 20); |
michael@0 | 89 | }, 20); |
michael@0 | 90 | }, 20); |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | </script> |
michael@0 | 94 | </pre> |
michael@0 | 95 | </body> |
michael@0 | 96 | </html> |