Bug 1120705 - Part 2: Tests (v2 Patch), r=roc
author<kgilbert>
Wed, 18 Mar 2015 18:36:00 +0100
changeset 234430 e48cd77481ac00f381850b4d6b9b90d8ef76f469
parent 234429 97aff00e4250d795c74c61026339383ada6f9fe8
child 234431 a648afebfadf15489dd2cdcc24e7daa13389ece1
push id28446
push userkwierso@gmail.com
push dateFri, 20 Mar 2015 02:15:45 +0000
treeherdermozilla-central@3257d9c4b257 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1120705
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1120705 - Part 2: Tests (v2 Patch), r=roc - Ensure that the scrollbar button scrolling is limited by the page size, to maintain context when scrolling small scroll frames.
layout/base/tests/mochitest.ini
layout/base/tests/test_bug1120705.html
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -532,8 +532,10 @@ support-files = bug1080360_inner.html
 [test_bug1078327.html]
 support-files = bug1078327_inner.html
 [test_bug1080361.html]
 support-files = bug1080361_inner.html
 [test_frame_reconstruction_for_pseudo_elements.html]
 [test_touchcaret_visibility.html]
 [test_bug1093686.html]
 support-files = bug1093686_inner.html
+[test_bug1120705.html]
+skip-if = buildapp == 'android' || buildapp == 'b2g' || buildapp == 'b2g-debug' || os == 'mac' # android and b2g do not have clickable scrollbars, mac does not have scrollbar down and up buttons
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug1120705.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 1120705</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<p id="display"></p>
+<select id="sel">
+  <option value="1">1</option>
+  <option value="2">2</option>
+  <option value="3">3</option>
+  <option value="4">4</option>
+  <option value="5">5</option>
+  <option value="6">6</option>
+  <option value="7">7</option>
+  <option value="8">8</option>
+  <option value="9">9</option>
+  <option value="10">10</option>
+  <option value="11">11</option>
+  <option value="12">12</option>
+  <option value="13">13</option>
+  <option value="14">14</option>
+  <option value="15">15</option>
+  <option value="16">16</option>
+  <option value="17">17</option>
+  <option value="18">18</option>
+  <option value="19">19</option>
+  <option value="20">20</option>
+</select>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+
+function clickDownButton() {
+  var sel = document.getElementById("sel");
+  var scrollbar_width = sel.offsetWidth - sel.clientWidth;
+  synthesizeMouse(sel,
+                  sel.offsetWidth - scrollbar_width / 2,
+                  sel.offsetHeight - scrollbar_width / 2,
+                  { type: "mousedown" });
+
+  synthesizeMouse(sel,
+                  sel.offsetWidth - scrollbar_width / 2,
+                  sel.offsetHeight - scrollbar_width / 2,
+                  { type: "mouseup" });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+
+addLoadEvent(function() {
+  SpecialPowers.pushPrefEnv({
+    "set": [["general.smoothScroll", false],
+            ["toolkit.scrollbox.verticalScrollDistance", 3]]},
+    function() {
+      var sel = document.getElementById("sel");
+      sel.size = 2;
+      sel.scrollTo(0, 0);
+      clickDownButton();
+      window.requestAnimationFrame(function() {
+        var restricted_top = sel.scrollTop;
+        isnot(restricted_top, 0,
+              "Expected to scroll when clicking scrollbar button");
+        sel.size = 10;
+        sel.scrollTo(0, 0);
+        clickDownButton();
+        window.requestAnimationFrame(function() {
+          isnot(sel.scrollTop, restricted_top,
+                "Scrollbar button scrolling should be limited by page size");
+          SimpleTest.finish();
+        });
+      });
+    });
+});
+</script>
+</pre>
+</body>
+
+</html>
+