diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-12-09 15:37:01 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-12-10 09:48:26 +0000 |
commit | eb500f9cd9756f035b3d74b3a58a1a78e229988d (patch) | |
tree | d7bf456602afe72107301dfc23ac03af2f9e6597 /tests/auto/shared | |
parent | 3b7fb484d5dd99181c62f520b8317c6439d059a6 (diff) |
Move ApplicationHelper to visualtestutil.h and rename it
This class is useful for other auto tests, like Popup's.
Change-Id: Ie193c07e5b53b67493fceba9a1c32798db2f4e34
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/shared')
-rw-r--r-- | tests/auto/shared/util.pri | 2 | ||||
-rw-r--r-- | tests/auto/shared/visualtestutil.h | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/tests/auto/shared/util.pri b/tests/auto/shared/util.pri index 747bdf64..5e6b06b6 100644 --- a/tests/auto/shared/util.pri +++ b/tests/auto/shared/util.pri @@ -1,4 +1,4 @@ -QT += core-private gui-private qml-private quick-private +QT += core-private gui-private qml-private quick-private labstemplates-private HEADERS += $$PWD/visualtestutil.h \ $$PWD/util.h diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h index 7a35ac76..b3fecf8e 100644 --- a/tests/auto/shared/visualtestutil.h +++ b/tests/auto/shared/visualtestutil.h @@ -42,6 +42,10 @@ #include <QtQuick/private/qquickitem_p.h> +#include <QtLabsTemplates/private/qquickapplicationwindow_p.h> + +#include "util.h" + namespace QQuickVisualTestUtil { QQuickItem *findVisibleChild(QQuickItem *parent, const QString &objectName); @@ -104,6 +108,28 @@ namespace QQuickVisualTestUtil items << qobject_cast<QQuickItem*>(findItem<T>(parent, objectName, indexes[i])); return items; } + + class QQuickApplicationHelper + { + public: + QQuickApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath) : + component(&engine) + { + component.loadUrl(testCase->testFileUrl(testFilePath)); + QObject *rootObject = component.create(); + cleanup.reset(rootObject); + QVERIFY2(rootObject, qPrintable(QString::fromLatin1("Failed to create ApplicationWindow: %1").arg(component.errorString()))); + + window = qobject_cast<QQuickApplicationWindow*>(rootObject); + QVERIFY(window); + QVERIFY(!window->isVisible()); + } + + QQmlEngine engine; + QQmlComponent component; + QScopedPointer<QObject> cleanup; + QQuickApplicationWindow *window; + }; } #define QQUICK_VERIFY_POLISH(item) \ |