Bug 1597742: Add tests for HyperTextAccessible::ScrollSubstringToPoint. r=MarcoZ

Differential Revision: https://phabricator.services.mozilla.com/D60207

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2020-01-17 05:34:12 +00:00
Родитель ec3fa36450
Коммит e5ff62b3c3
2 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -2,4 +2,5 @@
support-files =
!/accessible/tests/mochitest/*.js
[test_scrollSubstringToPoint.html]
[test_zoom.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>