diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-05-30 20:56:09 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-05-31 12:15:45 +0000 |
commit | 089dd16fb6ea44d68201780e05cf08d0c5add580 (patch) | |
tree | f4602acdd8f67d196f9e28cd43b3ca93bf0d92ea /tests/auto/accessibility | |
parent | 108946db94bada1577a40946571827c2e93a3b63 (diff) |
Accessibility: cleanup and fix the attached property handling
Previously qmlAttachedPropertiesObject() refused to create attached
properties object instances for objects that were not created in QML.
QQuickControl & friends created a "fallback" instance of the accessible
attached properties object, which made tst_accessible pass, but since
QQuickAccessibleAttached was not aware of the instance, accessibility
did not work for these controls that created the instance by hand.
In qtdeclarative commit 4be38ab, qmlAttachedPropertiesObject() has been
changed to allow creating attached properties for objects instantiated
in C++. This allows us to remove the non-functional fallback instance.
Change-Id: I8a86388dc4dee4721284d47aefc15940a75e6c8d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/accessibility')
-rw-r--r-- | tests/auto/accessibility/tst_accessibility.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 4208a366..614566e6 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -113,16 +113,6 @@ void tst_accessibility::a11y_data() QTest::newRow("WeekNumberColumn") << "weeknumbercolumn" << 0x0 << "WeekNumberColumn"; //QAccessible::NoRole } -#if QT_CONFIG(accessibility) -static QQuickAccessibleAttached *accessibleAttached(QQuickItem *item) -{ - QQuickAccessibleAttached *acc = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false)); - if (!acc) - acc = item->findChild<QQuickAccessibleAttached *>(); - return acc; -} -#endif - void tst_accessibility::a11y() { QFETCH(QString, name); @@ -152,7 +142,7 @@ void tst_accessibility::a11y() QVERIFY(item); #if QT_CONFIG(accessibility) - QQuickAccessibleAttached *acc = accessibleAttached(item); + QQuickAccessibleAttached *acc = QQuickAccessibleAttached::attachedProperties(item); if (name != QLatin1Literal("dayofweekrow") && name != QLatin1Literal("monthgrid") && name != QLatin1Literal("weeknumbercolumn")) { @@ -161,7 +151,7 @@ void tst_accessibility::a11y() } else { QVERIFY(!acc); QAccessible::setActive(true); - acc = accessibleAttached(item); + acc = QQuickAccessibleAttached::attachedProperties(item); } } QVERIFY(acc); @@ -170,8 +160,6 @@ void tst_accessibility::a11y() #else Q_UNUSED(role) Q_UNUSED(text) - QObject *acc = qmlAttachedPropertiesObject<QObject>(item, false); - QVERIFY(!acc); #endif } |