summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/bounds
diff options
context:
space:
mode:
Diffstat (limited to 'accessible/tests/mochitest/bounds')
-rw-r--r--accessible/tests/mochitest/bounds/a11y.ini8
-rw-r--r--accessible/tests/mochitest/bounds/test_list.html81
-rw-r--r--accessible/tests/mochitest/bounds/test_select.html85
-rw-r--r--accessible/tests/mochitest/bounds/test_zoom.html96
-rw-r--r--accessible/tests/mochitest/bounds/test_zoom_text.html77
5 files changed, 347 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/bounds/a11y.ini b/accessible/tests/mochitest/bounds/a11y.ini
new file mode 100644
index 000000000..d60bd46a5
--- /dev/null
+++ b/accessible/tests/mochitest/bounds/a11y.ini
@@ -0,0 +1,8 @@
+[DEFAULT]
+support-files =
+ !/accessible/tests/mochitest/*.js
+
+[test_list.html]
+[test_select.html]
+[test_zoom.html]
+[test_zoom_text.html]
diff --git a/accessible/tests/mochitest/bounds/test_list.html b/accessible/tests/mochitest/bounds/test_list.html
new file mode 100644
index 000000000..38a79689b
--- /dev/null
+++ b/accessible/tests/mochitest/bounds/test_list.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Accessible boundaries when page is zoomed</title>
+ <link rel="stylesheet" type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ 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()
+ {
+ // Inside list
+ var li = getAccessible("insidelist_item");
+ testBounds(li);
+
+ var [xLI, yLI, widthLI, heightLI] = getBounds(li);
+ var bullet = li.firstChild;
+ var [x, y, width, height] = getBounds(bullet);
+ is(x, xLI,
+ "Bullet x should match to list item x");
+ ok(y >= yLI,
+ "Bullet y= " + y + " should be not less than list item y=" + yLI);
+ ok(width < widthLI,
+ "Bullet width should be lesser list item width");
+ ok(height <= heightLI,
+ "Bullet height= " + height + " should be not greater than list item height=" + heightLI);
+
+ // Outside list
+ li = getAccessible("outsidelist_item");
+ var [xLIElm, yLIElm, widthLIElm, heightLIElm] = getBoundsForDOMElm(li);
+ [xLI, yLI, widthLI, heightLI] = getBounds(li);
+
+ ok(xLI < xLIElm,
+ "Outside list item x=" + xLI + " should be lesser than list item element x=" + xLIElm);
+ is(yLI, yLIElm,
+ "Outside list item y should match to list item element y");
+ ok(widthLI > widthLIElm,
+ "Outside list item width=" + widthLI + " should be greater than list item element width=" + widthLIElm);
+ is(heightLI, heightLIElm,
+ "Outside list item height should match to list item element height");
+
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addA11yLoadEvent(doTest);
+ </script>
+</head>
+<body>
+
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=754627"
+ title="GetBounds on bullet return wrong values">
+ Mozilla Bug 754627
+ </a>
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test">
+ </pre>
+
+ <ul style="list-style-position: inside;">
+ <li id="insidelist_item">item</li>
+ </ul>
+
+ <ul style="list-style-position: outside;">
+ <li id="outsidelist_item">item</li>
+ </ul>
+
+</body>
+</html>
diff --git a/accessible/tests/mochitest/bounds/test_select.html b/accessible/tests/mochitest/bounds/test_select.html
new file mode 100644
index 000000000..395dad1b6
--- /dev/null
+++ b/accessible/tests/mochitest/bounds/test_select.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Accessible boundaries when page is zoomed</title>
+ <link rel="stylesheet" type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ 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"
+ src="../events.js"></script>
+
+ <script type="application/javascript">
+ function openComboboxNCheckBounds(aID)
+ {
+ this.combobox = getAccessible(aID);
+ this.comboboxList = this.combobox.firstChild;
+ this.comboboxOption = this.comboboxList.firstChild;
+
+ this.eventSeq = [
+ new invokerChecker(EVENT_FOCUS, this.comboboxOption)
+ ];
+
+ this.invoke = function openComboboxNCheckBounds_invoke()
+ {
+ getNode(aID).focus();
+ synthesizeKey("VK_DOWN", { altKey: true });
+ }
+
+ this.finalCheck = function openComboboxNCheckBounds_invoke()
+ {
+ testBounds(this.comboboxOption);
+ }
+
+ this.getID = function openComboboxNCheckBounds_getID()
+ {
+ return "open combobox and test boundaries";
+ }
+ }
+
+ //gA11yEventDumpToConsole = true;
+
+ var gQueue = null;
+
+ function doTest()
+ {
+ // Combobox
+ testBounds("combobox");
+
+ // Option boundaries matches to combobox boundaries when collapsed.
+ var selectBounds = getBoundsForDOMElm("combobox");
+ testBounds("option1", selectBounds);
+
+ // Open combobox and test option boundaries.
+ gQueue = new eventQueue();
+ gQueue.push(new openComboboxNCheckBounds("combobox"));
+ gQueue.invoke(); // Will call SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addA11yLoadEvent(doTest);
+ </script>
+</head>
+<body>
+
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test">
+ </pre>
+
+ <select id="combobox">
+ <option id="option1">item1</option>
+ <option>item2</option>
+ </select>
+</body>
+</html>
diff --git a/accessible/tests/mochitest/bounds/test_zoom.html b/accessible/tests/mochitest/bounds/test_zoom.html
new file mode 100644
index 000000000..fc2dee482
--- /dev/null
+++ b/accessible/tests/mochitest/bounds/test_zoom.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Accessible boundaries when page is zoomed</title>
+ <link rel="stylesheet" type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ 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="../events.js"></script>
+ <script type="application/javascript"
+ src="../layout.js"></script>
+ <script type="application/javascript"
+ src="../browser.js"></script>
+
+ <script type="application/javascript">
+ //gA11yEventDumpToConsole = true;
+ //enableLogging("tree,verbose");
+ function doPreTest()
+ {
+ var tabDocument = currentTabDocument();
+ var imgMap = tabDocument.getElementById("imgmap");
+ waitForImageMap(imgMap, doTest);
+ }
+
+ function doTest()
+ {
+ // Bug 746176: Failure of this whole test file on OS X.
+ if (MAC) {
+ todo(false, "Fix bug 746176 on Mac");
+ closeBrowserWindow();
+ SimpleTest.finish();
+ return;
+ }
+
+ var tabDocument = currentTabDocument();
+ var p1 = tabDocument.getElementById("p1");
+ var p2 = tabDocument.getElementById("p2");
+
+ var imgMap = tabDocument.getElementById("imgmap");
+ var imgMapAcc = getAccessible(imgMap);
+ var area = imgMapAcc.firstChild;
+
+ testBounds(p1);
+ testBounds(p2);
+ testBounds(area);
+
+ zoomDocument(tabDocument, 2.0);
+
+ testBounds(p1);
+ testBounds(p2);
+ testBounds(area);
+
+ closeBrowserWindow();
+ SimpleTest.finish();
+ }
+
+ var url = "data:text/html,<html><body>";
+ url += "<p id='p1'>para 1</p><p id='p2'>para 2</p>";
+ url += "<map name='atoz_map' id='map'>";
+ url += " <area id='area1' href='http%3A%2F%2Fmozilla.org'";
+ url += " coords=17,0,30,14' alt='mozilla.org' shape='rect'>";
+ url += "</map>";
+ url += "<img id='imgmap' width='447' height='15'";
+ url += " usemap='%23atoz_map'";
+ url += " src='chrome%3A%2F%2Fmochitests%2Fcontent%2Fa11y%2Faccessible%2Fletters.gif'>";
+ url += "</body></html>";
+
+ SimpleTest.waitForExplicitFinish();
+ openBrowserWindow(doPreTest,
+ url,
+ { left: 0, top: 0, width: 600, height: 600 });
+ </script>
+
+</head>
+<body>
+
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=650241"
+ title="Location returned by accessibles incorrect when page zoomed">
+ Mozilla Bug 650241
+ </a>
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test">
+ </pre>
+</body>
+</html>
diff --git a/accessible/tests/mochitest/bounds/test_zoom_text.html b/accessible/tests/mochitest/bounds/test_zoom_text.html
new file mode 100644
index 000000000..1637f344e
--- /dev/null
+++ b/accessible/tests/mochitest/bounds/test_zoom_text.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The text range boundary when page is zoomed</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
+ <link rel="stylesheet" type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ 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"
+ src="../browser.js"></script>
+
+ <script type="application/javascript">
+ function testTextNode(aDoc, aContainerID)
+ {
+ var hyperTextNode = aDoc.getElementById(aContainerID);
+ var textNode = hyperTextNode.firstChild;
+
+ var [x, y, width, height] = getBounds(textNode);
+ testTextBounds(hyperTextNode, 0, -1, [x, y, width, height],
+ COORDTYPE_SCREEN_RELATIVE);
+ }
+
+ function doTest()
+ {
+ var tabDocument = currentTabDocument();
+ testTextNode(tabDocument, "p1");
+ testTextNode(tabDocument, "p2");
+
+ zoomDocument(tabDocument, 2.0);
+
+ testTextNode(tabDocument, "p1");
+
+ zoomDocument(tabDocument, 1.0);
+
+ closeBrowserWindow();
+ SimpleTest.finish();
+ }
+
+ var url = "data:text/html,<html>" +
+ "<meta http-equiv='Content-Type' content='text/html;charset=utf-8'>" +
+ "</meta><body>" +
+ "<p id='p1' style='font-family: monospace;'>Tilimilitryamdiya</p>" +
+ "<p id='p2'>ل</p>"
+ "</body></html>";
+
+ SimpleTest.waitForExplicitFinish();
+ openBrowserWindow(doTest,
+ url,
+ { left: 0, top: 0, width: 600, height: 600 });
+
+ </script>
+
+</head>
+<body>
+
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
+ title="Text range boundaries are incorrect when page is zoomed">
+ Mozilla Bug 727942
+ </a>
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test">
+ </pre>
+</body>
+</html>