summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/shared/debugutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/shared/debugutil.cpp')
-rw-r--r--tests/auto/declarative/shared/debugutil.cpp81
1 files changed, 1 insertions, 80 deletions
diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp
index 66f04e5..c0c3eca 100644
--- a/tests/auto/declarative/shared/debugutil.cpp
+++ b/tests/auto/declarative/shared/debugutil.cpp
@@ -47,11 +47,11 @@
#include "debugutil_p.h"
-#include <iostream>
bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
QTimer timer;
+ timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
QObject::connect(receiver, member, &loop, SLOT(quit()));
timer.start(timeout);
@@ -59,25 +59,6 @@ bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member,
return timer.isActive();
}
-
-QDeclarativeDebugTestData::QDeclarativeDebugTestData(QEventLoop *el)
- : exitCode(-1), loop(el)
-{
-}
-
-QDeclarativeDebugTestData::~QDeclarativeDebugTestData()
-{
- qDeleteAll(items);
-}
-
-void QDeclarativeDebugTestData::testsFinished(int code)
-{
- exitCode = code;
- loop->quit();
-}
-
-
-
QDeclarativeDebugTestService::QDeclarativeDebugTestService(const QString &s, QObject *parent)
: QDeclarativeDebugService(s, parent), enabled(false)
{
@@ -117,63 +98,3 @@ void QDeclarativeDebugTestClient::messageReceived(const QByteArray &ba)
emit serverMessage(ba);
}
-
-tst_QDeclarativeDebug_Thread::tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory)
- : m_data(data), m_factory(factory)
-{
-}
-
-void tst_QDeclarativeDebug_Thread::run()
-{
- bool ok = false;
-
- QDeclarativeDebugConnection conn;
- conn.connectToHost("127.0.0.1", 3768);
- ok = conn.waitForConnected();
- Q_ASSERT(ok);
-
- QEventLoop loop;
- connect(m_data, SIGNAL(engineCreated()), &loop, SLOT(quit()));
- loop.exec();
-
- m_data->conn = &conn;
-
- Q_ASSERT(m_factory);
- QObject *test = m_factory->createTest(m_data);
- Q_ASSERT(test);
- int code = QTest::qExec(test, QCoreApplication::arguments());
- delete test;
- emit testsFinished(code);
-}
-
-int QDeclarativeDebugTest::runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml)
-{
- qputenv("QML_DEBUG_SERVER_PORT", "3768");
-
- QEventLoop loop;
- QDeclarativeDebugTestData data(&loop);
-
- tst_QDeclarativeDebug_Thread thread(&data, factory);
- QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int)));
-
- QDeclarativeDebugService::notifyOnServerStart(&thread, "start");
-
- QDeclarativeEngine engine; // blocks until client connects
-
- foreach (const QByteArray &code, qml) {
- QDeclarativeComponent c(&engine);
- c.setData(code, QUrl::fromLocalFile(""));
- Q_ASSERT(c.isReady()); // fails if bad syntax
- data.items << qobject_cast<QDeclarativeItem*>(c.create());
- }
-
- // start the test
- data.engine = &engine;
- emit data.engineCreated();
-
- loop.exec();
- thread.wait();
-
- return data.exitCode;
-}
-