summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/other/CMakeLists.txt3
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp29
2 files changed, 27 insertions, 5 deletions
diff --git a/tests/auto/other/CMakeLists.txt b/tests/auto/other/CMakeLists.txt
index 8255406bb5..5f49dacdc0 100644
--- a/tests/auto/other/CMakeLists.txt
+++ b/tests/auto/other/CMakeLists.txt
@@ -21,8 +21,7 @@ endif()
if(TARGET Qt::Network)
add_subdirectory(networkselftest)
endif()
-# QTBUG-87674 # special case
-if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets AND NOT ANDROID)
+if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets)
add_subdirectory(qaccessibility)
endif()
if(TARGET Qt::Gui)
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 49d0ce212d..a593a91525 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -269,13 +269,21 @@ void tst_QAccessibility::onClicked()
click_count++;
}
+static bool initAccessibility()
+{
+ QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
+ if (pfIntegration->accessibility()) {
+ pfIntegration->accessibility()->setActive(true);
+ return true;
+ }
+ return false;
+}
+
void tst_QAccessibility::initTestCase()
{
QTestAccessibility::initialize();
- QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
- if (!pfIntegration->accessibility())
+ if (!initAccessibility())
QSKIP("This platform does not support accessibility");
- pfIntegration->accessibility()->setActive(true);
}
void tst_QAccessibility::cleanupTestCase()
@@ -286,6 +294,17 @@ void tst_QAccessibility::cleanupTestCase()
void tst_QAccessibility::init()
{
QTestAccessibility::clearEvents();
+#ifdef Q_OS_ANDROID
+ // On Android a11y state is not explicitly set by calling
+ // QPlatformAccessibility::setActive(), there is another flag that is
+ // controlled from the Java side. The state of this flag is queried
+ // during event processing, so a11y state can be reset to false while
+ // we do QTest::qWait().
+ // To overcome the issue in unit-tests, re-enable a11y before each test.
+ // A more precise fix will require re-enabling it after every qWait() or
+ // processEvents() call, but the current tests pass with such condition.
+ initAccessibility();
+#endif
}
void tst_QAccessibility::cleanup()
@@ -1978,6 +1997,10 @@ void tst_QAccessibility::mdiSubWindowTest()
mdiArea.setActiveSubWindow(testWindow);
+#ifdef Q_OS_ANDROID // on Android QMdiSubWindow is maximized by default
+ testWindow->showNormal();
+#endif
+
// state
QAccessible::State state;
state.focusable = true;