diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-11-04 14:11:00 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-11-04 16:51:38 +0100 |
commit | e4147992df243dbd2e7049a109b840928c4f256a (patch) | |
tree | 4776577164cb3c585670fbd91f925d0092da6a9d /tests/auto/other | |
parent | 16b9f9a9aaf7455fe3134d4517511c280aad3ee9 (diff) |
tst_QAccessibilityMac: Wait for accessible window to become available
It may take some time before the shown window is available through the
accessible hierarchy, so do an asynchronous test for that to happen.
Pick-to: 6.4
Change-Id: I3f312ae636505b805899973678b1bf10a65f96b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm index 64a48bf3c6..39ffe504c7 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm @@ -419,10 +419,9 @@ void tst_QAccessibilityMac::singleWidgetTest() TestAXObject *appObject = [TestAXObject getApplicationAXObject]; QVERIFY(appObject); - NSArray *windows = [appObject windowList]; - QVERIFY([windows count] == 1); + QTRY_VERIFY(appObject.windowList.count == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windows objectAtIndex: 0]; + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; @@ -449,10 +448,9 @@ void tst_QAccessibilityMac::lineEditTest() TestAXObject *appObject = [TestAXObject getApplicationAXObject]; QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - QVERIFY([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; @@ -510,10 +508,9 @@ void tst_QAccessibilityMac::hierarchyTest() TestAXObject *appObject = [TestAXObject getApplicationAXObject]; QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - QVERIFY([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; @@ -572,10 +569,9 @@ void tst_QAccessibilityMac::notificationsTest() TestAXObject *appObject = [TestAXObject getApplicationAXObject]; QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - QVERIFY([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; @@ -616,10 +612,9 @@ void tst_QAccessibilityMac::checkBoxTest() TestAXObject *appObject = [TestAXObject getApplicationAXObject]; QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - QVERIFY([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; |