summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/windows/uia
diff options
context:
space:
mode:
Diffstat (limited to 'accessible/tests/browser/windows/uia')
-rw-r--r--accessible/tests/browser/windows/uia/browser.toml11
-rw-r--r--accessible/tests/browser/windows/uia/browser_controlType.js30
-rw-r--r--accessible/tests/browser/windows/uia/browser_elementFromPoint.js34
-rw-r--r--accessible/tests/browser/windows/uia/head.js18
4 files changed, 93 insertions, 0 deletions
diff --git a/accessible/tests/browser/windows/uia/browser.toml b/accessible/tests/browser/windows/uia/browser.toml
new file mode 100644
index 0000000000..f7974d69c7
--- /dev/null
+++ b/accessible/tests/browser/windows/uia/browser.toml
@@ -0,0 +1,11 @@
+[DEFAULT]
+subsuite = "a11y"
+skip-if = [
+ "os != 'win'",
+ "headless",
+]
+support-files = ["head.js"]
+
+["browser_controlType.js"]
+
+["browser_elementFromPoint.js"]
diff --git a/accessible/tests/browser/windows/uia/browser_controlType.js b/accessible/tests/browser/windows/uia/browser_controlType.js
new file mode 100644
index 0000000000..16db892581
--- /dev/null
+++ b/accessible/tests/browser/windows/uia/browser_controlType.js
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+/* eslint-disable camelcase */
+const UIA_ButtonControlTypeId = 50000;
+const UIA_DocumentControlTypeId = 50030;
+/* eslint-enable camelcase */
+
+addAccessibleTask(
+ `
+<button id="button">button</button>
+ `,
+ async function (browser, docAcc) {
+ let controlType = await runPython(`
+ global doc
+ doc = getDocUia()
+ return doc.CurrentControlType
+ `);
+ is(controlType, UIA_DocumentControlTypeId, "doc has correct control type");
+ controlType = await runPython(`
+ button = findUiaByDomId(doc, "button")
+ return button.CurrentControlType
+ `);
+ is(controlType, UIA_ButtonControlTypeId, "button has correct control type");
+ },
+ { chrome: true, topLevel: true, iframe: true, remoteIframe: true }
+);
diff --git a/accessible/tests/browser/windows/uia/browser_elementFromPoint.js b/accessible/tests/browser/windows/uia/browser_elementFromPoint.js
new file mode 100644
index 0000000000..e2fda4ab30
--- /dev/null
+++ b/accessible/tests/browser/windows/uia/browser_elementFromPoint.js
@@ -0,0 +1,34 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+addAccessibleTask(
+ `
+<button id="button">button</p>
+<a id="a" href="#">a</a>
+ `,
+ async function (browser, docAcc) {
+ ok(
+ await runPython(`
+ global doc
+ doc = getDocUia()
+ button = findUiaByDomId(doc, "button")
+ rect = button.CurrentBoundingRectangle
+ found = uiaClient.ElementFromPoint(POINT(rect.left + 1, rect.top + 1))
+ return uiaClient.CompareElements(button, found)
+ `),
+ "ElementFromPoint on button returns button"
+ );
+ ok(
+ await runPython(`
+ a = findUiaByDomId(doc, "a")
+ rect = a.CurrentBoundingRectangle
+ found = uiaClient.ElementFromPoint(POINT(rect.left + 1, rect.top + 1))
+ return uiaClient.CompareElements(a, found)
+ `),
+ "ElementFromPoint on a returns a"
+ );
+ }
+);
diff --git a/accessible/tests/browser/windows/uia/head.js b/accessible/tests/browser/windows/uia/head.js
new file mode 100644
index 0000000000..afc50984bd
--- /dev/null
+++ b/accessible/tests/browser/windows/uia/head.js
@@ -0,0 +1,18 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+// Load the shared-head file first.
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
+ this
+);
+
+// Loading and common.js from accessible/tests/mochitest/ for all tests, as
+// well as promisified-events.js.
+loadScripts(
+ { name: "common.js", dir: MOCHITESTS_DIR },
+ { name: "promisified-events.js", dir: MOCHITESTS_DIR }
+);