diff options
author | Dongmei Wang <dongmei.wang@theqtcompany.com> | 2016-01-22 20:19:28 -0800 |
---|---|---|
committer | Dongmei Wang <dongmei.wang@theqtcompany.com> | 2016-04-24 01:32:23 +0000 |
commit | 18291af42caf18165f99dd0300738576b96379a6 (patch) | |
tree | dade97f9818ab92e865ac27026c2f1e141b2b892 /tests/auto/other | |
parent | 2ddad99979f19ad731b29fd4de6ff7c673068440 (diff) |
QTabBar: Add setAccessibleTabName() and accessibleTabName()
Currently, a tab's text is used as its accessibleName.
When a tab's text is empty, there is no API to set
the tab's accessibleName. The two APIs are added to
set and return the accessibleName property of a tab.
Task-number: QTBUG-46530
Change-Id: Idf88b5f905fe66c6365ea0eeb650e74211db90e1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 046c77d6c3..2f5936f1ad 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1301,6 +1301,16 @@ void tst_QAccessibility::tabTest() child2->actionInterface()->doAction(QAccessibleActionInterface::pressAction()); QCOMPARE(tabBar->currentIndex(), 1); + // Test that setAccessibleTabName changes a tab's accessible name + tabBar->setAccessibleTabName(0, "AccFoo"); + tabBar->setAccessibleTabName(1, "AccBar"); + QCOMPARE(child1->text(QAccessible::Name), QLatin1String("AccFoo")); + QCOMPARE(child2->text(QAccessible::Name), QLatin1String("AccBar")); + tabBar->setCurrentIndex(0); + QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccFoo")); + tabBar->setCurrentIndex(1); + QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccBar")); + delete tabBar; QTestAccessibility::clearEvents(); } @@ -1338,10 +1348,17 @@ void tst_QAccessibility::tabWidgetTest() QCOMPARE(tabButton1Interface->text(QAccessible::Name), QLatin1String("Tab 1")); QAccessibleInterface* tabButton2Interface = tabBarInterface->child(1); - QVERIFY(tabButton1Interface); + QVERIFY(tabButton2Interface); QCOMPARE(tabButton2Interface->role(), QAccessible::PageTab); QCOMPARE(tabButton2Interface->text(QAccessible::Name), QLatin1String("Tab 2")); + // Test that setAccessibleTabName changes a tab's accessible name + tabWidget->setCurrentIndex(0); + tabWidget->tabBar()->setAccessibleTabName(0, "Acc Tab"); + QCOMPARE(tabButton1Interface->role(), QAccessible::PageTab); + QCOMPARE(tabButton1Interface->text(QAccessible::Name), QLatin1String("Acc Tab")); + QCOMPARE(tabBarInterface->text(QAccessible::Name), QLatin1String("Acc Tab")); + QAccessibleInterface* tabButtonLeft = tabBarInterface->child(2); QVERIFY(tabButtonLeft); QCOMPARE(tabButtonLeft->role(), QAccessible::PushButton); |