layout/generic/test/test_bug469613.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/test/test_bug469613.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=469613
     1.9 +-->
    1.10 +<window title="Mozilla Bug 469613"
    1.11 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.12 +
    1.13 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.14 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.15 +<body  xmlns="http://www.w3.org/1999/xhtml">
    1.16 +  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469613">Mozilla Bug 469613</a>
    1.17 +
    1.18 +  <p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +</div>
    1.21 +</body>
    1.22 +
    1.23 +<vbox style="height: 100px; overflow: auto;" id="scrollbox">
    1.24 +  <hbox style="height: 200px;"/>
    1.25 +</vbox>
    1.26 +
    1.27 +<script class="testbody" type="application/javascript;version=1.7"><![CDATA[
    1.28 +
    1.29 +/** Test for Bug 469613 **/
    1.30 +
    1.31 +function doTest() {
    1.32 +  let scrollbox = document.getElementById("scrollbox");
    1.33 +  scrollbox.scrollTop = 0;
    1.34 +
    1.35 +  // Make sure that the "scroll focus" is inside the scrollbox by moving the
    1.36 +  // mouse in the scrollbox.
    1.37 +  synthesizeMouse(scrollbox, 6, 6, { type: "mousemove" });
    1.38 +  synthesizeMouse(scrollbox, 8, 8, { type: "mousemove" });
    1.39 +
    1.40 +  // Now scroll 10px down.
    1.41 +  synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
    1.42 +
    1.43 +  // Send a 0-delta scroll.
    1.44 +  synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
    1.45 +
    1.46 +  setTimeout(function() {
    1.47 +    // Check if the 10px were scrolled.
    1.48 +    todo(false, "Starting a 0-delta scroll shouldn't cancel a pending async scroll is disabled, see bug 752786");
    1.49 +    //is(scrollbox.scrollTop, 10, "Starting a 0-delta scroll shouldn't cancel a pending async scroll.");
    1.50 +
    1.51 +    // Second test
    1.52 +    scrollbox.scrollTop = 20;
    1.53 +
    1.54 +    // Start an async scroll to 30.
    1.55 +    synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
    1.56 +
    1.57 +    // Start a sync scroll to 30.
    1.58 +    scrollbox.scrollTop = 30;
    1.59 +
    1.60 +    is(scrollbox.scrollTop, 30, "Setting scrollTop should have immediate effect, even if there was a pending async scroll to the same position.");
    1.61 +
    1.62 +
    1.63 +    // Third test
    1.64 +    scrollbox.scrollTop = 40;
    1.65 +
    1.66 +    // Start an async scroll to 50.
    1.67 +    synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
    1.68 +
    1.69 +    // Cancel the async scroll.
    1.70 +    scrollbox.scrollTop = 40;
    1.71 +
    1.72 +    // Send a 0-delta scroll.
    1.73 +    synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
    1.74 +
    1.75 +    setTimeout(function() {
    1.76 +      is(scrollbox.scrollTop, 40, "Canceling an async scroll should reset the point of reference for relative scrolls (mDestinationX/Y).");
    1.77 +
    1.78 +      SimpleTest.finish();
    1.79 +    }, 0);
    1.80 +  }, 0);
    1.81 +}
    1.82 +
    1.83 +SimpleTest.waitForExplicitFinish();
    1.84 +addLoadEvent(function() setTimeout(doTest, 0));
    1.85 +
    1.86 +]]></script>
    1.87 +
    1.88 +</window>

mercurial