diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-02-15 08:24:36 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-02-15 08:24:36 (GMT) |
commit | 22157cb26419ddcaa927cbfa88ad04486b1d1ee0 (patch) | |
tree | f84ff6878248c791319fc6be1f1956f2177b5bdb /tests/auto/declarative/shared/debugutil.cpp | |
parent | fa6dc19b9212706532f3f88da0fb3542e9c3eafe (diff) | |
parent | a14b8805945c5e00be26092406a468fd8b8acc14 (diff) | |
download | Qt-22157cb26419ddcaa927cbfa88ad04486b1d1ee0.zip Qt-22157cb26419ddcaa927cbfa88ad04486b1d1ee0.tar.gz Qt-22157cb26419ddcaa927cbfa88ad04486b1d1ee0.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests/auto/declarative/shared/debugutil.cpp')
-rw-r--r-- | tests/auto/declarative/shared/debugutil.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index aa0cd31..0010508 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -47,6 +47,8 @@ #include "debugutil_p.h" +#include <iostream> + bool QmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) { QEventLoop loop; QTimer timer; @@ -117,21 +119,22 @@ void QmlDebugTestClient::messageReceived(const QByteArray &ba) tst_QmlDebug_Thread::tst_QmlDebug_Thread(QmlDebugTestData *data, QmlTestFactory *factory) - : m_ready(false), m_data(data), m_factory(factory) + : m_data(data), m_factory(factory) { } void tst_QmlDebug_Thread::run() { - QTest::qWait(1000); + bool ok = false; QmlDebugConnection conn; conn.connectToHost("127.0.0.1", 3768); - bool ok = conn.waitForConnected(5000); + ok = conn.waitForConnected(); Q_ASSERT(ok); - while (!m_ready) - QTest::qWait(100); + QEventLoop loop; + connect(m_data, SIGNAL(engineCreated()), &loop, SLOT(quit())); + loop.exec(); m_data->conn = &conn; @@ -139,10 +142,10 @@ void tst_QmlDebug_Thread::run() QObject *test = m_factory->createTest(m_data); Q_ASSERT(test); int code = QTest::qExec(test, QCoreApplication::arguments()); + delete test; emit testsFinished(code); } - int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml) { qputenv("QML_DEBUG_SERVER_PORT", "3768"); @@ -152,7 +155,8 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml tst_QmlDebug_Thread thread(&data, factory); QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int))); - thread.start(); + + QmlDebugService::notifyOnServerStart(&thread, "start"); QmlEngine engine; // blocks until client connects @@ -165,7 +169,7 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml // start the test data.engine = &engine; - thread.m_ready = true; + emit data.engineCreated(); loop.exec(); thread.wait(); @@ -173,4 +177,3 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml return data.exitCode; } - |