summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other/qaccessibility/tst_qaccessibility.cpp')
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 99e3fc5bf2..2f5936f1ad 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -68,20 +68,6 @@ static inline void setFrameless(QWidget *w)
w->setWindowFlags(flags);
}
-#if defined(Q_OS_WINCE)
-extern "C" bool SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
-#define SPI_GETPLATFORMTYPE 257
-inline bool IsValidCEPlatform() {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(*tszPlatform), tszPlatform, 0)) {
- QString platform = QString::fromWCharArray(tszPlatform);
- if ((platform == QLatin1String("PocketPC")) || (platform == QLatin1String("Smartphone")))
- return false;
- }
- return true;
-}
-#endif
-
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
int index, const QRect &domain)
{
@@ -1315,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();
}
@@ -1352,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);
@@ -1469,10 +1472,6 @@ void tst_QAccessibility::menuTest()
QCOMPARE(iHelp->role(), QAccessible::MenuItem);
QCOMPARE(iAction->role(), QAccessible::MenuItem);
#ifndef Q_OS_MAC
-#ifdef Q_OS_WINCE
- if (!IsValidCEPlatform())
- QSKIP("Tests do not work on Mobile platforms due to native menus");
-#endif
QCOMPARE(mw.mapFromGlobal(interface->rect().topLeft()), mw.menuBar()->geometry().topLeft());
QCOMPARE(interface->rect().size(), mw.menuBar()->size());
@@ -3561,10 +3560,6 @@ void tst_QAccessibility::dockWidgetTest()
void tst_QAccessibility::comboBoxTest()
{
-#if defined(Q_OS_WINCE)
- if (!IsValidCEPlatform())
- QSKIP("Test skipped on Windows Mobile test hardware");
-#endif
{ // not editable combobox
QComboBox combo;
combo.addItems(QStringList() << "one" << "two" << "three");