summaryrefslogtreecommitdiff
path: root/tests/tst_qml/tst_qmltest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tst_qml/tst_qmltest.cpp')
-rw-r--r--tests/tst_qml/tst_qmltest.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/tests/tst_qml/tst_qmltest.cpp b/tests/tst_qml/tst_qmltest.cpp
index 38e5411..8d64af8 100644
--- a/tests/tst_qml/tst_qmltest.cpp
+++ b/tests/tst_qml/tst_qmltest.cpp
@@ -1,32 +1,25 @@
-#include <QString>
-#include <QtTest>
-#include <QCoreApplication>
-#include <QtQml>
+#define QUICK_TEST_SOURCE_DIR Context().testSourceDir()
-class QmlTest : public QObject
-{
- Q_OBJECT
+#include <QtQuickTest/QtQuickTest>
-private slots:
- void testCase1()
+class Context
+{
+public:
+ Context()
{
- QQmlEngine engine;
- engine.addImportPath(qApp->applicationDirPath() + "/../../src");
- qDebug() << (qApp->applicationDirPath() + "/../../src");
+ const char importPathVarName[] = "QML2_IMPORT_PATH";
+ QByteArray importPath = qgetenv(importPathVarName);
- QStringListModel modelData;
- QQmlContext *context = new QQmlContext(engine.rootContext());
- context->setContextProperty("myModel", &modelData);
+ if (not importPath.isEmpty())
+ importPath = ':' + importPath;
- QQmlComponent component(&engine);
- component.setData("import QtQuickStreamer 1.0\n"
- "Pipeline { name: 'qmltest' }",
- QUrl());
- qDebug() << component.errors();
- QObject *view = component.create(context);
+ qputenv(importPathVarName, TOP_OUTDIR "/src" + importPath);
}
-};
-QTEST_MAIN(QmlTest)
+ const char *testSourceDir() const
+ {
+ return SRCDIR;
+ }
+};
-#include "tst_qmltest.moc"
+QUICK_TEST_MAIN()