diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-11-02 08:21:37 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-11-02 09:24:53 +0000 |
commit | 08325282ecf445267255abf1aa184a09795cedae (patch) | |
tree | 4219bb9497b92957d92846e938cb75d76f1c20a0 /tests/auto/accessibility/tst_accessibility.cpp | |
parent | 189fe8349943a928dd0af50e90b8232a4bbe6acc (diff) |
Cleanup and speedup tst_accessibility
Before:
Totals: 37 passed, 0 failed, 0 skipped, 0 blacklisted, 6919ms
After:
Totals: 37 passed, 0 failed, 0 skipped, 0 blacklisted, 599ms
Change-Id: I8376d74a265d30956cba1f2e290333a8efd70067
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/accessibility/tst_accessibility.cpp')
-rw-r--r-- | tests/auto/accessibility/tst_accessibility.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index c1c9cb25..1086c17e 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -34,27 +34,21 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QtTest/QSignalSpy> +#include <QtTest/qtest.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> #include <QtQml/qqmlcontext.h> -#include <QtQuick/qquickview.h> #include <QtQuick/private/qquickitem_p.h> #include <QtQuickTemplates2/private/qquickpopup_p.h> #include "../shared/util.h" -#include "../shared/visualtestutil.h" #ifndef QT_NO_ACCESSIBILITY #include <QtQuick/private/qquickaccessibleattached_p.h> #endif -using namespace QQuickVisualTestUtil; - class tst_accessibility : public QQmlDataTest { Q_OBJECT -public: private slots: void a11y_data(); @@ -127,7 +121,6 @@ void tst_accessibility::a11y() QFETCH(int, role); QFETCH(QString, text); - QQmlComponent component(&engine); QString fn = name; #ifdef QT_NO_ACCESSIBILITY if (name == QLatin1Literal("dayofweekrow") @@ -135,20 +128,16 @@ void tst_accessibility::a11y() || name == QLatin1Literal("weeknumbercolumn")) fn += QLatin1Literal("-2"); #endif + + QQmlComponent component(&engine); component.loadUrl(testFileUrl(fn + ".qml")); - QObject* created = component.create(); - QVERIFY2(created, qPrintable(component.errorString())); - QScopedPointer<QObject> cleanup(created); - QVERIFY(!cleanup.isNull()); - QQuickWindow* window = qobject_cast<QQuickWindow*>(created); - QVERIFY(window); - window->show(); - QVERIFY(QTest::qWaitForWindowActive(window)); + QScopedPointer<QObject> object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); - QQuickItem *item = findItem<QQuickItem>(window->contentItem(), name); + QQuickItem *item = qobject_cast<QQuickItem *>(object.data()); if (!item) { - QQuickPopup *popup = window->contentItem()->findChild<QQuickPopup *>(name); + QQuickPopup *popup = qobject_cast<QQuickPopup *>(object.data()); if (popup) item = popup->popupItem(); } |