layout/generic/test/test_bug469613.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
michael@0 4 <!--
michael@0 5 https://bugzilla.mozilla.org/show_bug.cgi?id=469613
michael@0 6 -->
michael@0 7 <window title="Mozilla Bug 469613"
michael@0 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 9
michael@0 10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
michael@0 11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
michael@0 12 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469613">Mozilla Bug 469613</a>
michael@0 14
michael@0 15 <p id="display"></p>
michael@0 16 <div id="content" style="display: none">
michael@0 17 </div>
michael@0 18 </body>
michael@0 19
michael@0 20 <vbox style="height: 100px; overflow: auto;" id="scrollbox">
michael@0 21 <hbox style="height: 200px;"/>
michael@0 22 </vbox>
michael@0 23
michael@0 24 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
michael@0 25
michael@0 26 /** Test for Bug 469613 **/
michael@0 27
michael@0 28 function doTest() {
michael@0 29 let scrollbox = document.getElementById("scrollbox");
michael@0 30 scrollbox.scrollTop = 0;
michael@0 31
michael@0 32 // Make sure that the "scroll focus" is inside the scrollbox by moving the
michael@0 33 // mouse in the scrollbox.
michael@0 34 synthesizeMouse(scrollbox, 6, 6, { type: "mousemove" });
michael@0 35 synthesizeMouse(scrollbox, 8, 8, { type: "mousemove" });
michael@0 36
michael@0 37 // Now scroll 10px down.
michael@0 38 synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
michael@0 39
michael@0 40 // Send a 0-delta scroll.
michael@0 41 synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
michael@0 42
michael@0 43 setTimeout(function() {
michael@0 44 // Check if the 10px were scrolled.
michael@0 45 todo(false, "Starting a 0-delta scroll shouldn't cancel a pending async scroll is disabled, see bug 752786");
michael@0 46 //is(scrollbox.scrollTop, 10, "Starting a 0-delta scroll shouldn't cancel a pending async scroll.");
michael@0 47
michael@0 48 // Second test
michael@0 49 scrollbox.scrollTop = 20;
michael@0 50
michael@0 51 // Start an async scroll to 30.
michael@0 52 synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
michael@0 53
michael@0 54 // Start a sync scroll to 30.
michael@0 55 scrollbox.scrollTop = 30;
michael@0 56
michael@0 57 is(scrollbox.scrollTop, 30, "Setting scrollTop should have immediate effect, even if there was a pending async scroll to the same position.");
michael@0 58
michael@0 59
michael@0 60 // Third test
michael@0 61 scrollbox.scrollTop = 40;
michael@0 62
michael@0 63 // Start an async scroll to 50.
michael@0 64 synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
michael@0 65
michael@0 66 // Cancel the async scroll.
michael@0 67 scrollbox.scrollTop = 40;
michael@0 68
michael@0 69 // Send a 0-delta scroll.
michael@0 70 synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
michael@0 71
michael@0 72 setTimeout(function() {
michael@0 73 is(scrollbox.scrollTop, 40, "Canceling an async scroll should reset the point of reference for relative scrolls (mDestinationX/Y).");
michael@0 74
michael@0 75 SimpleTest.finish();
michael@0 76 }, 0);
michael@0 77 }, 0);
michael@0 78 }
michael@0 79
michael@0 80 SimpleTest.waitForExplicitFinish();
michael@0 81 addLoadEvent(function() setTimeout(doTest, 0));
michael@0 82
michael@0 83 ]]></script>
michael@0 84
michael@0 85 </window>

mercurial