summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/mac/browser_bounds.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /accessible/tests/browser/mac/browser_bounds.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/mac/browser_bounds.js')
-rw-r--r--accessible/tests/browser/mac/browser_bounds.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/accessible/tests/browser/mac/browser_bounds.js b/accessible/tests/browser/mac/browser_bounds.js
new file mode 100644
index 0000000000..09343d7c9d
--- /dev/null
+++ b/accessible/tests/browser/mac/browser_bounds.js
@@ -0,0 +1,77 @@
+/* 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";
+
+/**
+ * Test position, size for onscreen content
+ */
+addAccessibleTask(
+ `I am some extra content<br>
+ <div id="hello" style="display:inline;">hello</div><br>
+ <div id="world" style="display:inline;">hello world<br>I am some text</div>`,
+ async (browser, accDoc) => {
+ const hello = getNativeInterface(accDoc, "hello");
+ const world = getNativeInterface(accDoc, "world");
+ ok(hello.getAttributeValue("AXFrame"), "Hello's frame attr is not null");
+ ok(world.getAttributeValue("AXFrame"), "World's frame attr is not null");
+
+ // AXSize and AXPosition are composed of AXFrame components, so we
+ // test them here instead of calling AXFrame directly.
+ const [helloWidth, helloHeight] = hello.getAttributeValue("AXSize");
+ const [worldWidth, worldHeight] = world.getAttributeValue("AXSize");
+ ok(helloWidth > 0, "Hello has a positive width");
+ ok(helloHeight > 0, "Hello has a positive height");
+ ok(worldWidth > 0, "World has a positive width");
+ ok(worldHeight > 0, "World has a positive height");
+ ok(helloHeight < worldHeight, "Hello has a smaller height than world");
+ ok(helloWidth < worldWidth, "Hello has a smaller width than world");
+
+ // Note: these are mac screen coords, so our origin is bottom left
+ const [helloX, helloY] = hello.getAttributeValue("AXPosition");
+ const [worldX, worldY] = world.getAttributeValue("AXPosition");
+ ok(helloX > 0, "Hello has a positive X");
+ ok(helloY > 0, "Hello has a positive Y");
+ ok(worldX > 0, "World has a positive X");
+ ok(worldY > 0, "World has a positive Y");
+ ok(helloY > worldY, "Hello has a larger Y than world");
+ ok(helloX == worldX, "Hello and world have the same X");
+ }
+);
+
+/**
+ * Test position, size for offscreen content
+ */
+addAccessibleTask(
+ `I am some extra content<br>
+ <div id="hello" style="display:inline; position:absolute; left:-2000px;">hello</div><br>
+ <div id="world" style="display:inline; position:absolute; left:-2000px;">hello world<br>I am some text</div>`,
+ async (browser, accDoc) => {
+ const hello = getNativeInterface(accDoc, "hello");
+ const world = getNativeInterface(accDoc, "world");
+ ok(hello.getAttributeValue("AXFrame"), "Hello's frame attr is not null");
+ ok(world.getAttributeValue("AXFrame"), "World's frame attr is not null");
+
+ // AXSize and AXPosition are composed of AXFrame components, so we
+ // test them here instead of calling AXFrame directly.
+ const [helloWidth, helloHeight] = hello.getAttributeValue("AXSize");
+ const [worldWidth, worldHeight] = world.getAttributeValue("AXSize");
+ ok(helloWidth > 0, "Hello has a positive width");
+ ok(helloHeight > 0, "Hello has a positive height");
+ ok(worldWidth > 0, "World has a positive width");
+ ok(worldHeight > 0, "World has a positive height");
+ ok(helloHeight < worldHeight, "Hello has a smaller height than world");
+ ok(helloWidth < worldWidth, "Hello has a smaller width than world");
+
+ // Note: these are mac screen coords, so our origin is bottom left
+ const [helloX, helloY] = hello.getAttributeValue("AXPosition");
+ const [worldX, worldY] = world.getAttributeValue("AXPosition");
+ ok(helloX < 0, "Hello has a negative X");
+ ok(helloY > 0, "Hello has a positive Y");
+ ok(worldX < 0, "World has a negative X");
+ ok(worldY > 0, "World has a positive Y");
+ ok(helloY > worldY, "Hello has a larger Y than world");
+ ok(helloX == worldX, "Hello and world have the same X");
+ }
+);