Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
5 xmlns:html="http://www.w3.org/1999/xhtml"
6 title="Test for Bug 159346">
7 <!--
8 https://bugzilla.mozilla.org/show_bug.cgi?id=159346
9 -->
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
12 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
14 <scrollbar id="scrollbar" curpos="0" maxpos="500"/>
16 <script class="testbody" type="application/javascript">
17 <![CDATA[
19 var scrollbar = document.getElementById("scrollbar");
20 var downButton =
21 document.getAnonymousElementByAttribute(scrollbar, "sbattr",
22 "scrollbar-down-bottom");
24 function init()
25 {
26 downButton.style.display = "-moz-box";
27 SimpleTest.executeSoon(doTest1);
28 }
30 function getCurrentPos()
31 {
32 return Number(scrollbar.getAttribute("curpos"));
33 }
35 function doTest1()
36 {
37 var lastPos = 0;
39 synthesizeMouseAtCenter(downButton, { type: "mousedown" });
40 ok(getCurrentPos() > lastPos,
41 "scrollbar didn't change curpos by mousedown #1");
42 lastPos = getCurrentPos();
44 setTimeout(function () {
45 ok(getCurrentPos() > lastPos,
46 "scrollbar didn't change curpos by auto repeat #1");
47 synthesizeMouseAtCenter(downButton, { type: "mouseup" });
48 lastPos = getCurrentPos();
50 setTimeout(function () {
51 is(getCurrentPos(), lastPos,
52 "scrollbar changed curpos after mouseup #1");
53 SimpleTest.executeSoon(doTest2);
54 }, 1000);
55 }, 1000);
56 }
58 function doTest2()
59 {
60 SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 0);
62 scrollbar.setAttribute("curpos", 0);
63 var lastPos = 0;
65 synthesizeMouseAtCenter(downButton, { type: "mousedown" });
66 ok(getCurrentPos() > lastPos,
67 "scrollbar didn't change curpos by mousedown #2");
68 lastPos = getCurrentPos();
70 synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
71 lastPos = getCurrentPos();
73 setTimeout(function () {
74 is(getCurrentPos(), lastPos,
75 "scrollbar changed curpos by auto repeat when cursor is outside of scrollbar button #2");
76 synthesizeMouseAtCenter(downButton, { type: "mousemove" });
77 lastPos = getCurrentPos();
79 setTimeout(function () {
80 ok(getCurrentPos() > lastPos,
81 "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #2");
82 synthesizeMouseAtCenter(downButton, { type: "mouseup" });
83 SimpleTest.executeSoon(doTest3);
84 }, 1000);
85 }, 1000);
86 }
88 function doTest3()
89 {
90 SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 1);
92 scrollbar.setAttribute("curpos", 0);
93 var lastPos = 0;
95 synthesizeMouseAtCenter(downButton, { type: "mousedown" });
96 ok(getCurrentPos() > lastPos,
97 "scrollbar didn't change curpos by mousedown #3");
98 synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
99 lastPos = getCurrentPos();
101 setTimeout(function () {
102 ok(getCurrentPos() > lastPos,
103 "scrollbar didn't change curpos by auto repeat when cursor is outside of scrollbar button #3");
104 synthesizeMouseAtCenter(downButton, { type: "mousemove" });
105 lastPos = getCurrentPos();
107 setTimeout(function () {
108 ok(getCurrentPos() > lastPos,
109 "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #3");
110 synthesizeMouseAtCenter(downButton, { type: "mouseup" });
112 SpecialPowers.clearUserPref("ui.scrollbarButtonAutoRepeatBehavior");
113 SimpleTest.finish();
114 }, 1000);
115 }, 1000);
116 }
118 SimpleTest.waitForExplicitFinish();
120 ]]>
121 </script>
123 <body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
124 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159346">Mozilla Bug 159346</a>
125 <p id="display"></p>
127 <pre id="test">
128 </pre>
129 <script>
130 addLoadEvent(init);
131 </script>
132 </body>
135 </window>