From 089dd16fb6ea44d68201780e05cf08d0c5add580 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 30 May 2017 20:56:09 +0200 Subject: 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 Reviewed-by: Mitch Curtis --- tests/auto/accessibility/tst_accessibility.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'tests/auto/accessibility') 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(qmlAttachedPropertiesObject(item, false)); - if (!acc) - acc = item->findChild(); - 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(item, false); - QVERIFY(!acc); #endif } -- cgit v1.2.3