aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest/quicktest.cpp
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-03-08 14:04:25 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-13 02:02:49 +0100
commit5f018216f680e8226b46aa3939abec52047eaee7 (patch)
tree111c5966c9bb2a2a0163f2af624f5d8e78e13de8 /src/qmltest/quicktest.cpp
parent07160d02c3b6e2840621544b19dd79a201a06201 (diff)
Remove the rest of qtquick 1.0 code from qmltest
Change-Id: I0d20583faf1a75f287dcd866b11457254d250354 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qmltest/quicktest.cpp')
-rw-r--r--src/qmltest/quicktest.cpp95
1 files changed, 39 insertions, 56 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index e6c27eec00..2e32a60b2d 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -43,14 +43,10 @@
#include "quicktestresult_p.h"
#include <QtTest/qtestsystem.h>
#include "qtestoptions_p.h"
-#include <QApplication>
#include <QtQml/qqml.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcontext.h>
-#if defined(QML_VERSION) && QML_VERSION >= 0x020000
#include <QtQuick/qquickview.h>
-#define QUICK_TEST_SCENEGRAPH 1
-#endif
#include <QtQml/qjsvalue.h>
#include <QtQml/qjsengine.h>
#include <QtGui/qopengl.h>
@@ -160,12 +156,10 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// Look for QML-specific command-line options.
// -import dir Specify an import directory.
// -input dir Specify the input directory for test cases.
- // -qtquick1 Run with QtQuick 1 rather than QtQuick 2.
// -translation file Specify the translation file.
QStringList imports;
QString testPath;
QString translationFile;
- bool qtQuick2 = true;
int outargc = 1;
int index = 1;
while (index < argc) {
@@ -177,9 +171,6 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
index += 2;
} else if (strcmp(argv[index], "-opengl") == 0) {
++index;
- } else if (strcmp(argv[index], "-qtquick1") == 0) {
- qtQuick2 = false;
- ++index;
} else if (strcmp(argv[index], "-translation") == 0 && (index + 1) < argc) {
translationFile = stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
index += 2;
@@ -255,57 +246,49 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// Scan through all of the "tst_*.qml" files and run each of them
// in turn with a QQuickView.
-#ifdef QUICK_TEST_SCENEGRAPH
- if (qtQuick2) {
- QQuickView view;
- QTestRootObject rootobj;
- QEventLoop eventLoop;
- QObject::connect(view.engine(), SIGNAL(quit()),
- &rootobj, SLOT(quit()));
- QObject::connect(view.engine(), SIGNAL(quit()),
- &eventLoop, SLOT(quit()));
- view.rootContext()->setContextProperty
- (QLatin1String("qtest"), &rootobj);
- foreach (const QString &path, imports)
- view.engine()->addImportPath(path);
+ QQuickView view;
+ QTestRootObject rootobj;
+ QEventLoop eventLoop;
+ QObject::connect(view.engine(), SIGNAL(quit()),
+ &rootobj, SLOT(quit()));
+ QObject::connect(view.engine(), SIGNAL(quit()),
+ &eventLoop, SLOT(quit()));
+ view.rootContext()->setContextProperty
+ (QLatin1String("qtest"), &rootobj);
+ foreach (const QString &path, imports)
+ view.engine()->addImportPath(path);
- foreach (QString file, files) {
- QFileInfo fi(file);
- if (!fi.exists())
- continue;
+ foreach (QString file, files) {
+ QFileInfo fi(file);
+ if (!fi.exists())
+ continue;
- rootobj.setHasTestCase(false);
- rootobj.setWindowShown(false);
- rootobj.hasQuit = false;
- QString path = fi.absoluteFilePath();
- if (path.startsWith(QLatin1String(":/")))
- view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));
- else
- view.setSource(QUrl::fromLocalFile(path));
+ rootobj.setHasTestCase(false);
+ rootobj.setWindowShown(false);
+ rootobj.hasQuit = false;
+ QString path = fi.absoluteFilePath();
+ if (path.startsWith(QLatin1String(":/")))
+ view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));
+ else
+ view.setSource(QUrl::fromLocalFile(path));
- if (QTest::printAvailableFunctions)
- continue;
- if (view.status() == QQuickView::Error) {
- handleCompileErrors(fi, view);
- continue;
- }
- if (!rootobj.hasQuit) {
- // If the test already quit, then it was performed
- // synchronously during setSource(). Otherwise it is
- // an asynchronous test and we need to show the window
- // and wait for the quit indication.
- view.show();
- QTest::qWaitForWindowShown(&view);
- rootobj.setWindowShown(true);
- if (!rootobj.hasQuit && rootobj.hasTestCase())
- eventLoop.exec();
- }
+ if (QTest::printAvailableFunctions)
+ continue;
+ if (view.status() == QQuickView::Error) {
+ handleCompileErrors(fi, view);
+ continue;
+ }
+ if (!rootobj.hasQuit) {
+ // If the test already quit, then it was performed
+ // synchronously during setSource(). Otherwise it is
+ // an asynchronous test and we need to show the window
+ // and wait for the quit indication.
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ rootobj.setWindowShown(true);
+ if (!rootobj.hasQuit && rootobj.hasTestCase())
+ eventLoop.exec();
}
- } else
-#endif
- {
- qWarning("No suitable QtQuick1 implementation is available!");
- return 1;
}
// Flush the current logging stream.