diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /accessible/tests/browser/mac | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-upstream/125.0.1.tar.xz firefox-upstream/125.0.1.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/mac')
10 files changed, 86 insertions, 44 deletions
diff --git a/accessible/tests/browser/mac/browser_app.js b/accessible/tests/browser/mac/browser_app.js index bedefae440..e7e18b5ddd 100644 --- a/accessible/tests/browser/mac/browser_app.js +++ b/accessible/tests/browser/mac/browser_app.js @@ -138,7 +138,7 @@ add_task(async () => { gBrowser, url: "about:license", }, - async browser => { + async () => { let root = await getMacAccessible(document); let rootChildCount = () => root.getAttributeValue("AXChildren").length; @@ -206,8 +206,10 @@ add_task(async () => { is(rootChildCount(), baseRootChildCount + 1, "Root has another child"); // Close popup + let hide = waitForMacEvent("AXUIElementDestroyed"); EventUtils.synthesizeKey("KEY_Escape"); await BrowserTestUtils.waitForPopupEvent(identityPopup, "hidden"); + await hide; // We're back to the base child count is(rootChildCount(), baseRootChildCount, "Root has the base child count"); @@ -225,7 +227,7 @@ add_task(async () => { // eslint-disable-next-line @microsoft/sdl/no-insecure-url url: "http://example.com", }, - async browser => { + async () => { let input = await getMacAccessible("urlbar-input"); is( input.getAttributeValue("AXValue"), @@ -238,6 +240,38 @@ add_task(async () => { }); /** + * Tests attributed text in nav bar has no invisible AXAttachments + */ +add_task(async () => { + await BrowserTestUtils.withNewTab( + { + gBrowser, + // eslint-disable-next-line @microsoft/sdl/no-insecure-url + url: "http://example.com", + }, + async () => { + let root = await getMacAccessible(document); + let navBar = await getMacAccessible("nav-bar"); + let elemRange = root.getParameterizedAttributeValue( + "AXTextMarkerRangeForUIElement", + navBar + ); + let attributedString = root.getParameterizedAttributeValue( + "AXAttributedStringForTextMarkerRange", + elemRange + ); + let attachmentRoles = attributedString.map(s => + s.AXAttachment ? s.AXAttachment.getAttributeValue("AXRole") : null + ); + ok( + !attachmentRoles.includes("AXMenu"), + "Collapsed menu should be embedded in attributed text" + ); + } + ); +}); + +/** * Test context menu */ add_task(async () => { diff --git a/accessible/tests/browser/mac/browser_bounds.js b/accessible/tests/browser/mac/browser_bounds.js index 09343d7c9d..bc7939cfe0 100644 --- a/accessible/tests/browser/mac/browser_bounds.js +++ b/accessible/tests/browser/mac/browser_bounds.js @@ -21,22 +21,26 @@ addAccessibleTask( // 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"); + Assert.greater(helloWidth, 0, "Hello has a positive width"); + Assert.greater(helloHeight, 0, "Hello has a positive height"); + Assert.greater(worldWidth, 0, "World has a positive width"); + Assert.greater(worldHeight, 0, "World has a positive height"); + Assert.less( + helloHeight, + worldHeight, + "Hello has a smaller height than world" + ); + Assert.less(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"); + Assert.greater(helloX, 0, "Hello has a positive X"); + Assert.greater(helloY, 0, "Hello has a positive Y"); + Assert.greater(worldX, 0, "World has a positive X"); + Assert.greater(worldY, 0, "World has a positive Y"); + Assert.greater(helloY, worldY, "Hello has a larger Y than world"); + Assert.equal(helloX, worldX, "Hello and world have the same X"); } ); @@ -57,21 +61,25 @@ addAccessibleTask( // 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"); + Assert.greater(helloWidth, 0, "Hello has a positive width"); + Assert.greater(helloHeight, 0, "Hello has a positive height"); + Assert.greater(worldWidth, 0, "World has a positive width"); + Assert.greater(worldHeight, 0, "World has a positive height"); + Assert.less( + helloHeight, + worldHeight, + "Hello has a smaller height than world" + ); + Assert.less(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"); + Assert.less(helloX, 0, "Hello has a negative X"); + Assert.greater(helloY, 0, "Hello has a positive Y"); + Assert.less(worldX, 0, "World has a negative X"); + Assert.greater(worldY, 0, "World has a positive Y"); + Assert.greater(helloY, worldY, "Hello has a larger Y than world"); + Assert.equal(helloX, worldX, "Hello and world have the same X"); } ); diff --git a/accessible/tests/browser/mac/browser_live_regions.js b/accessible/tests/browser/mac/browser_live_regions.js index 10a03120f8..aa07f003df 100644 --- a/accessible/tests/browser/mac/browser_live_regions.js +++ b/accessible/tests/browser/mac/browser_live_regions.js @@ -131,7 +131,7 @@ addAccessibleTask( <button id="button" aria-label="Start"></button> </div> `, - async (browser, accDoc) => { + async browser => { let liveRegionChanged = waitForMacEvent("AXLiveRegionChanged", "live"); await SpecialPowers.spawn(browser, [], () => { content.document.getElementById("time").textContent = "4:56pm"; diff --git a/accessible/tests/browser/mac/browser_menulist.js b/accessible/tests/browser/mac/browser_menulist.js index b26a0be782..3b0fe8b210 100644 --- a/accessible/tests/browser/mac/browser_menulist.js +++ b/accessible/tests/browser/mac/browser_menulist.js @@ -74,7 +74,7 @@ addAccessibleTask( "First menu item is selected" ); // focus the second item, and verify it is selected - event = waitForMacEvent("AXFocusedUIElementChanged", (iface, data) => { + event = waitForMacEvent("AXFocusedUIElementChanged", iface => { try { return iface.getAttributeValue("AXTitle") == "100%"; } catch (e) { diff --git a/accessible/tests/browser/mac/browser_roles_elements.js b/accessible/tests/browser/mac/browser_roles_elements.js index 791598fed6..b6049e7afd 100644 --- a/accessible/tests/browser/mac/browser_roles_elements.js +++ b/accessible/tests/browser/mac/browser_roles_elements.js @@ -47,6 +47,7 @@ addAccessibleTask( <div id="complementary" role="complementary"></div> <div id="contentinfo" role="contentinfo"></div> <div id="form" role="form"></div> + <div id="form_label" aria-label="form" role="form"></div> <div id="main" role="main"></div> <div id="navigation" role="navigation"></div> <div id="search" role="search"></div> @@ -149,7 +150,8 @@ addAccessibleTask( "AXLandmarkComplementary" ); testRoleAndSubRole(accDoc, "contentinfo", null, "AXLandmarkContentInfo"); - testRoleAndSubRole(accDoc, "form", null, "AXLandmarkForm"); + testRoleAndSubRole(accDoc, "form", null, "AXApplicationGroup"); + testRoleAndSubRole(accDoc, "form_label", null, "AXLandmarkForm"); testRoleAndSubRole(accDoc, "main", null, "AXLandmarkMain"); testRoleAndSubRole(accDoc, "navigation", null, "AXLandmarkNavigation"); testRoleAndSubRole(accDoc, "search", null, "AXLandmarkSearch"); diff --git a/accessible/tests/browser/mac/browser_rotor.js b/accessible/tests/browser/mac/browser_rotor.js index 3f13506757..87ac40592d 100644 --- a/accessible/tests/browser/mac/browser_rotor.js +++ b/accessible/tests/browser/mac/browser_rotor.js @@ -269,7 +269,7 @@ addAccessibleTask( "AXUIElementCountForSearchPredicate", NSDictionary(searchPred) ); - is(4, tableCount, "Found four tables"); + is(tableCount, 3, "Found three tables"); const tables = webArea.getParameterizedAttributeValue( "AXUIElementsForSearchPredicate", @@ -278,7 +278,6 @@ addAccessibleTask( const shapes = getNativeInterface(accDoc, "shapes"); const food = getNativeInterface(accDoc, "food"); const ariaTable = getNativeInterface(accDoc, "ariaTable"); - const grid = getNativeInterface(accDoc, "grid"); is( shapes.getAttributeValue("AXColumnCount"), @@ -295,11 +294,6 @@ addAccessibleTask( tables[2].getAttributeValue("AXColumnCount"), "Found correct third table" ); - is( - grid.getAttributeValue("AXColumnCount"), - tables[3].getAttributeValue("AXColumnCount"), - "Found correct fourth table" - ); } ); diff --git a/accessible/tests/browser/mac/browser_text_leaf.js b/accessible/tests/browser/mac/browser_text_leaf.js index 21deed6212..c65e8c6ebe 100644 --- a/accessible/tests/browser/mac/browser_text_leaf.js +++ b/accessible/tests/browser/mac/browser_text_leaf.js @@ -77,7 +77,11 @@ addAccessibleTask( NSRange(3, 8) ); - ok(smallBounds.size[0] < largeBounds.size[0], "longer range is wider"); + Assert.less( + smallBounds.size[0], + largeBounds.size[0], + "longer range is wider" + ); }, { chrome: true, iframe: true, remoteIframe: true } ); diff --git a/accessible/tests/browser/mac/browser_text_selection.js b/accessible/tests/browser/mac/browser_text_selection.js index a914adba8e..7e2145631c 100644 --- a/accessible/tests/browser/mac/browser_text_selection.js +++ b/accessible/tests/browser/mac/browser_text_selection.js @@ -82,7 +82,7 @@ addAccessibleTask( Hello <a href="#" id="link">World</a>, I <a href="#" style="user-select: none;" id="unselectable_link">love</a> <button id="button">you</button></p>`, - async (browser, accDoc) => { + async browser => { // Set up an AXSelectedTextChanged listener here. It will get resolved // on the first non-root event it encounters, so if we test its data at the end // of this test it will show us the first text-selectable object that was focused, diff --git a/accessible/tests/browser/mac/browser_toggle_radio_check.js b/accessible/tests/browser/mac/browser_toggle_radio_check.js index 1695d73b0d..f9094ac3d7 100644 --- a/accessible/tests/browser/mac/browser_toggle_radio_check.js +++ b/accessible/tests/browser/mac/browser_toggle_radio_check.js @@ -128,7 +128,7 @@ addAccessibleTask( // Changing from checked to mixed fires two events. Make sure we wait until // the second so we're asserting based on the latest state. - evt = waitForMacEvent("AXValueChanged", (iface, data) => { + evt = waitForMacEvent("AXValueChanged", iface => { return ( iface.getAttributeValue("AXDOMIdentifier") == "checkbox" && iface.getAttributeValue("AXValue") == 2 diff --git a/accessible/tests/browser/mac/browser_webarea.js b/accessible/tests/browser/mac/browser_webarea.js index ac6122de14..4872c58845 100644 --- a/accessible/tests/browser/mac/browser_webarea.js +++ b/accessible/tests/browser/mac/browser_webarea.js @@ -8,8 +8,8 @@ loadScripts({ name: "role.js", dir: MOCHITESTS_DIR }); // Test web area role and AXLoadComplete event -addAccessibleTask(``, async (browser, accDoc) => { - let evt = waitForMacEvent("AXLoadComplete", (iface, data) => { +addAccessibleTask(``, async browser => { + let evt = waitForMacEvent("AXLoadComplete", iface => { return iface.getAttributeValue("AXDescription") == "webarea test"; }); await SpecialPowers.spawn(browser, [], () => { @@ -29,16 +29,16 @@ addAccessibleTask(``, async (browser, accDoc) => { }); // Test iframe web area role and AXLayoutComplete event -addAccessibleTask(`<title>webarea test</title>`, async (browser, accDoc) => { +addAccessibleTask(`<title>webarea test</title>`, async browser => { // If the iframe loads before the top level document finishes loading, we'll // get both an AXLayoutComplete event for the iframe and an AXLoadComplete // event for the document. Otherwise, if the iframe loads after the // document, we'll get one AXLoadComplete event. let eventPromise = Promise.race([ - waitForMacEvent("AXLayoutComplete", (iface, data) => { + waitForMacEvent("AXLayoutComplete", iface => { return iface.getAttributeValue("AXDescription") == "iframe document"; }), - waitForMacEvent("AXLoadComplete", (iface, data) => { + waitForMacEvent("AXLoadComplete", iface => { return iface.getAttributeValue("AXDescription") == "webarea test"; }), ]); |