aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/menu
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-12-09 15:37:01 +0100
committerMitch Curtis <mitch.curtis@theqtcompany.com>2015-12-10 09:48:26 +0000
commiteb500f9cd9756f035b3d74b3a58a1a78e229988d (patch)
treed7bf456602afe72107301dfc23ac03af2f9e6597 /tests/auto/menu
parent3b7fb484d5dd99181c62f520b8317c6439d059a6 (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/menu')
-rw-r--r--tests/auto/menu/tst_menu.cpp30
1 files changed, 4 insertions, 26 deletions
diff --git a/tests/auto/menu/tst_menu.cpp b/tests/auto/menu/tst_menu.cpp
index 5823767a..7b2b8ea6 100644
--- a/tests/auto/menu/tst_menu.cpp
+++ b/tests/auto/menu/tst_menu.cpp
@@ -52,28 +52,6 @@
using namespace QQuickVisualTestUtil;
-class ApplicationHelper
-{
-public:
- ApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath = QLatin1String("applicationwindow.qml")) :
- 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;
-};
-
class tst_menu : public QQmlDataTest
{
Q_OBJECT
@@ -89,7 +67,7 @@ private slots:
void tst_menu::defaults()
{
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickMenu *emptyMenu = helper.window->property("emptyMenu").value<QQuickMenu*>();
QCOMPARE(emptyMenu->isVisible(), false);
@@ -98,7 +76,7 @@ void tst_menu::defaults()
void tst_menu::mouse()
{
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickApplicationWindow *window = helper.window;
window->show();
@@ -170,7 +148,7 @@ void tst_menu::contextMenuKeyboard()
if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls)
QSKIP("This platform only allows tab focus for text controls");
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickApplicationWindow *window = helper.window;
window->show();
@@ -248,7 +226,7 @@ void tst_menu::menuButton()
if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls)
QSKIP("This platform only allows tab focus for text controls");
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickApplicationWindow *window = helper.window;
window->show();