diff options
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; } - |