Skip to content

Commit

Permalink
QmlDebugging: Modify test JSDebug test cases
Browse files Browse the repository at this point in the history
Add signals that are emitted on debugger responses for
flaky auto tests.

Change-Id: Ic59f559083b2b19fb8eec920dcb76f23125639a8
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
  • Loading branch information
Aurindam Jana authored and Qt by Nokia committed Mar 13, 2012
1 parent fd1e8c8 commit 69a1bf1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
Expand Up @@ -303,6 +303,8 @@ class QJSDebugClient : public QQmlDebugClient
void breakAfterCompileRequested();
void result();
void stopped();
void scriptsResult();
void evaluateResult();

private:
void sendMessage(const QByteArray &);
Expand Down Expand Up @@ -939,6 +941,12 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
} else {
// DO NOTHING
}
//Emit separate signals for scripts ane evaluate
//as the associated test cases are flaky
if (debugCommand == "scripts")
emit scriptsResult();
if (debugCommand == "evaluate")
emit evaluateResult();

} else if (type == QLatin1String(EVENT)) {
QString event(value.value(QLatin1String(EVENT)).toString());
Expand Down Expand Up @@ -1685,8 +1693,8 @@ void tst_QQmlDebugJS::evaluateInGlobalScope()
QVERIFY(init());

client->connect();
client->evaluate(QLatin1String("print('Hello World')"), true);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
client->evaluate(QLatin1String("console.log('Hello World')"), true);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));

//Verify the value of 'print'
QString jsonString(client->response);
Expand Down Expand Up @@ -1720,7 +1728,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
int frameIndex = body.value("index").toInt();

client->evaluate(QLatin1String("root.a"), frameIndex);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));

//Verify the value of 'timer.interval'
jsonString = client->response;
Expand Down Expand Up @@ -1759,7 +1767,7 @@ void tst_QQmlDebugJS::getScripts()
client->connect();

client->scripts();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(scriptsResult())));
QString jsonString(client->response);
QVariantMap value = client->parser.call(QJSValueList()
<< QJSValue(jsonString)).toVariant().toMap();
Expand Down

0 comments on commit 69a1bf1

Please sign in to comment.