aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/accessibility/tst_accessibility.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-20 12:41:55 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-21 15:33:51 +0000
commitbc546e14688c7056ac36b6f478fde852b5afaf46 (patch)
tree75cf4ed7146a362b11a9531d5314f03d738a3a96 /tests/auto/accessibility/tst_accessibility.cpp
parent8e1df766cf9e74661b50de4f4ed489af5b4edfc8 (diff)
QQuickControl: dynamically create a11y attached object
Using QAccessible::ActivationObserver approach. Change-Id: Ib99c1f9b7b0c37a3e8a4747db265c9df77acc1f8 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/accessibility/tst_accessibility.cpp')
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 7baec700..873a86c1 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -86,8 +86,8 @@ void tst_accessibility::a11y_data()
QTest::newRow("Switch") << "switch" << 0x0000002B << "Switch"; //QAccessible::Button
QTest::newRow("TabBar") << "tabbar" << 0x0000003C << ""; //QAccessible::PageTabList
QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab
- QTest::newRow("TextArea") << "textarea" << 0x0000002A << "TextArea"; //QAccessible::Accessible.EditableText
- QTest::newRow("TextField") << "textfield" << 0x0000002A << "TextField"; //QAccessible::Accessible.EditableText
+ QTest::newRow("TextArea") << "textarea" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
+ QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar
QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button
@@ -110,9 +110,7 @@ void tst_accessibility::a11y()
QQmlComponent component(&engine);
QString fn = name;
#ifdef QT_NO_ACCESSIBILITY
- if (name == QLatin1Literal("textarea")
- || name == QLatin1Literal("textfield")
- || name == QLatin1Literal("dayofweekrow")
+ if (name == QLatin1Literal("dayofweekrow")
|| name == QLatin1Literal("monthgrid")
|| name == QLatin1Literal("weeknumbercolumn"))
fn += QLatin1Literal("-2");
@@ -133,6 +131,13 @@ void tst_accessibility::a11y()
#ifndef QT_NO_ACCESSIBILITY
QQuickAccessibleAttached *acc = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false));
+ if (name != QLatin1Literal("dayofweekrow")
+ && name != QLatin1Literal("monthgrid")
+ && name != QLatin1Literal("weeknumbercolumn")) {
+ QVERIFY(!acc);
+ QAccessible::setActive(true);
+ acc = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false));
+ }
QVERIFY(acc);
QCOMPARE(acc->role(), (QAccessible::Role)role);
QCOMPARE(acc->name(), text);