diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-02-17 14:37:43 (GMT) |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-03-23 12:57:22 (GMT) |
commit | 9a5b0d7a579572cd7e7faf869ab1a6684800f592 (patch) | |
tree | a60c301ae132f7e57f7ea74c2266ff3cf1f708be /tests/auto/qaccessibility/tst_qaccessibility.cpp | |
parent | e783275cfb71e7325472b3aea54e109a7a854bf7 (diff) | |
download | Qt-9a5b0d7a579572cd7e7faf869ab1a6684800f592.zip Qt-9a5b0d7a579572cd7e7faf869ab1a6684800f592.tar.gz Qt-9a5b0d7a579572cd7e7faf869ab1a6684800f592.tar.bz2 |
Window and Application fixes for accessibility.
Return app name instead of window title for root accessibility object.
Return Window as accessible type for the main window.
Reviewed-by: Jan-Arve
Diffstat (limited to 'tests/auto/qaccessibility/tst_qaccessibility.cpp')
-rw-r--r-- | tests/auto/qaccessibility/tst_qaccessibility.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index f82502e..6a35843 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -245,6 +245,8 @@ private slots: void actionText(); void doAction(); + void applicationTest(); + void mainWindowTest(); void buttonTest(); void sliderTest(); void scrollBarTest(); @@ -1826,6 +1828,41 @@ void tst_QAccessibility::doAction() #endif } +void tst_QAccessibility::applicationTest() +{ +#ifdef QTEST_ACCESSIBILITY + QLatin1String name = QLatin1String("My Name"); + qApp->setApplicationName(name); + QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(qApp); + QCOMPARE(interface->text(QAccessible::Name, 0), name); + QCOMPARE(interface->role(0), QAccessible::Application); + delete interface; +#else + QSKIP("Test needs accessibility support.", SkipAll); +#endif +} + +void tst_QAccessibility::mainWindowTest() +{ +#ifdef QTEST_ACCESSIBILITY + QMainWindow mw; + mw.resize(300, 200); + mw.show(); // triggers layout + + QLatin1String name = QLatin1String("I am the main window"); + mw.setWindowTitle(name); + QTest::qWaitForWindowShown(&mw); + + QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw); + QCOMPARE(interface->text(QAccessible::Name, 0), name); + QCOMPARE(interface->role(0), QAccessible::Window); + delete interface; + +#else + QSKIP("Test needs accessibility support.", SkipAll); +#endif +} + void tst_QAccessibility::buttonTest() { //#ifdef QTEST_ACCESSIBILITY |