Bug 1597742: Add tests for HyperTextAccessible::ScrollSubstringToPoint. r=MarcoZ
☠☠ backed out by b207525a6976 ☠ ☠
authorJames Teh <jteh@mozilla.com>
Fri, 17 Jan 2020 05:34:12 +0000
changeset 510576 1ad80659be06562493395e5c346abe323fb05962
parent 510575 3cbc74c83a6efb3fb1a5b5b9f5650d69d6b890ce
child 510577 f4cc06c140903d7781f0a8431e40137a40dbd937
push id105373
push usermzehe@mozilla.com
push dateFri, 17 Jan 2020 05:36:20 +0000
treeherderautoland@1ad80659be06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ
bugs1597742
milestone74.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 1597742: Add tests for HyperTextAccessible::ScrollSubstringToPoint. r=MarcoZ Differential Revision: https://phabricator.services.mozilla.com/D60207
accessible/tests/mochitest/scroll/a11y.ini
accessible/tests/mochitest/scroll/test_scrollSubstringToPoint.html
--- a/accessible/tests/mochitest/scroll/a11y.ini
+++ b/accessible/tests/mochitest/scroll/a11y.ini
@@ -1,5 +1,6 @@
 [DEFAULT]
 support-files =
   !/accessible/tests/mochitest/*.js
 
+[test_scrollSubstringToPoint.html]
 [test_zoom.html]
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/scroll/test_scrollSubstringToPoint.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Test scrollSubstringToPoint</title>
+  <link rel="stylesheet" type="text/css"
+        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+  <script type="application/javascript"
+          src="../common.js"></script>
+  <script type="application/javascript"
+          src="../role.js"></script>
+  <script type="application/javascript"
+          src="../layout.js"></script>
+
+  <script type="application/javascript">
+    function doTest() {
+      let [, docY] = getPos(document);
+      let para1 = getAccessible("para1", [nsIAccessibleText]);
+      let [paraX] = getPos(para1);
+
+      // Scroll already visible para2 to top of document.
+      let para2 = getAccessible("para2", [nsIAccessibleText]);
+      para2.scrollSubstringToPoint(0, 0, COORDTYPE_SCREEN_RELATIVE, paraX,
+        docY);
+      testTextPos(para2, 0, [paraX, docY], COORDTYPE_SCREEN_RELATIVE);
+
+      // Scroll now invisible para1 back to top of document.
+      para1.scrollSubstringToPoint(0, 0, COORDTYPE_SCREEN_RELATIVE, paraX,
+        docY);
+      testTextPos(para1, 0, [paraX, docY], COORDTYPE_SCREEN_RELATIVE);
+
+      SimpleTest.finish();
+    }
+
+    addA11yLoadEvent(doTest);
+    SimpleTest.waitForExplicitFinish();
+  </script>
+
+</head>
+<body>
+
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <p id="para1">First paragraph</p>
+  <p id="para2">Second paragraph</p>
+  <p style="padding-bottom: 10000px;">Extra stuff to allow us to scroll down.</p>
+</body>
+</html>