aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2011-10-14 13:07:37 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-14 05:08:43 +0200
commit8cbd59e253474899ffa2b7d3d04d8c5a6b09a099 (patch)
treeb1d1c32061b4f6bcf19d41848269a04b2f7d2f45 /src/qmltest
parent52d9a57814f840859b89e540554990d0e86894b7 (diff)
only use one QSGView instance for all qml test cases
Change-Id: I9296e30d216b57d8cf2a11e94030781f03594aa6 Reviewed-on: http://codereview.qt-project.org/6646 Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'src/qmltest')
-rw-r--r--src/qmltest/quicktest.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 862da0ca05..150304028d 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -175,21 +175,23 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// in turn with a QDeclarativeView.
#ifdef QUICK_TEST_SCENEGRAPH
if (qtQuick2) {
+ QSGView 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 (QString path, imports)
+ view.engine()->addImportPath(path);
+
foreach (QString file, files) {
QFileInfo fi(file);
if (!fi.exists())
continue;
- QSGView 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 (QString path, imports)
- view.engine()->addImportPath(path);
+
QString path = fi.absoluteFilePath();
if (path.startsWith(QLatin1String(":/")))
view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));
@@ -220,8 +222,7 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// an asynchronous test and we need to show the window
// and wait for the quit indication.
view.show();
- //QTest::qWaitForWindowShown(&view);
- QTest::qWait(50);
+ QTest::qWaitForWindowShown(&view);
rootobj.setWindowShown(true);
if (!rootobj.hasQuit)
eventLoop.exec();