diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-09-25 11:41:44 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2014-10-21 20:32:52 +0200 |
commit | f28755240b9d72eb748c2f9469a58601bffdecf1 (patch) | |
tree | 6833b7e166be3480662e31ebe3da0f3e9daaa13d /tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp | |
parent | dbbb514a084440c05d17e44c7992726d94b26750 (diff) |
Support Accessible.ignored on non-leaf items
Ignoring items with children will make the children appear as children of
the parent of the ignored item.
Since setAccessibleFlagAndListener now only sets the flag we also rename
the function to just setAccessible
Change-Id: I79fc311509a3e454b4698274c63ad0e879fb93e3
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp')
-rw-r--r-- | tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index c514f96d24..921c81ae89 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -106,6 +106,7 @@ private slots: void basicPropertiesTest(); void hitTest(); void checkableTest(); + void ignoredTest(); }; tst_QQuickAccessible::tst_QQuickAccessible() @@ -456,6 +457,38 @@ void tst_QQuickAccessible::checkableTest() QTestAccessibility::clearEvents(); } +void tst_QQuickAccessible::ignoredTest() +{ + QScopedPointer<QQuickView> window(new QQuickView()); + window->setSource(testFileUrl("ignored.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + + QQuickItem *contentItem = window->contentItem(); + QVERIFY(contentItem); + QQuickItem *rootItem = contentItem->childItems().first(); + QVERIFY(rootItem); + + // the window becomes active + QAccessible::State activatedChange; + activatedChange.active = true; + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window.data()); + QVERIFY(iface); + QAccessibleInterface *rectangleA = iface->child(0); + + QCOMPARE(rectangleA->role(), QAccessible::StaticText); + QCOMPARE(rectangleA->text(QAccessible::Name), QLatin1String("A")); + static const char *expected = "BEFIHD"; + // check if node "C" and "G" is skipped and that the order is as expected. + for (int i = 0; i < rectangleA->childCount(); ++i) { + QAccessibleInterface *child = rectangleA->child(i); + QCOMPARE(child->text(QAccessible::Name), QString(QLatin1Char(expected[i]))); + } + QTestAccessibility::clearEvents(); +} + QTEST_MAIN(tst_QQuickAccessible) #include "tst_qquickaccessible.moc" |