aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2011-10-17 14:13:01 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-17 14:56:09 +0200
commit2946c6849159be12959151142171fa3b8c87f282 (patch)
treec232403d2a876fa5697303c1728660f671ef3b3c
parentf713037bf192748837f6075b2c60b19ccf3f9ab1 (diff)
Debugger: Make QDeclarativeDebugJS autotest more robust & faster
Also compile it by default (again). Change-Id: I04537e29d48cd1918160fe57220eecf1a72a8e66 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com> Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
-rw-r--r--tests/auto/declarative/debugger/debugger.pro2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml12
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp40
4 files changed, 37 insertions, 19 deletions
diff --git a/tests/auto/declarative/debugger/debugger.pro b/tests/auto/declarative/debugger/debugger.pro
index 3ea5c41775..a9c5bdee99 100644
--- a/tests/auto/declarative/debugger/debugger.pro
+++ b/tests/auto/declarative/debugger/debugger.pro
@@ -4,7 +4,7 @@ PRIVATETESTS += \
qdeclarativeenginedebug \
qdeclarativedebugclient \
qdeclarativedebugservice \
-# qdeclarativedebugjs \
+ qdeclarativedebugjs \
qpacketprotocol
contains(QT_CONFIG, private_tests) {
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml
index 386b366cab..3bfeb1011a 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml
@@ -47,11 +47,11 @@ import "test.js" as Script
Rectangle {
id: root
width: 10; height: 10;
- Component.onCompleted: print("onCompleted")
-
- property int result:0
+ Component.onCompleted: { Script.printMessage("onCompleted"); doSomething(); }
+ property int result: 0
property int someValue: 10
+ property bool raiseException: false
function doSomething() {
var a = root.result;
@@ -63,7 +63,7 @@ Rectangle {
}
Timer {
- interval: 4000; running: true; repeat: true
+ id: timer; interval: 1
onTriggered: {
doSomething();
Script.printMessage("onTriggered");
@@ -77,10 +77,8 @@ Rectangle {
function doSomethingElse() {
result = Script.add(result,8);
- eval("print(root.result)");
- if (root.result > 15)
+ if (raiseException)
dummy();
}
-
}
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro b/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro
index a6f005e84f..236692a799 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro
@@ -18,3 +18,5 @@ DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
CONFIG += insignificant_test
+
+OTHER_FILES += data/test.qml data/test.js
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
index ee4005656e..2386d0be18 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
@@ -291,6 +291,10 @@ void QJSDebugProcess::processAppOutput()
continue;
}
}
+ if (line.startsWith("QDeclarativeDebugServer: Unable to listen on port")) {
+ QFAIL("Application cannot open port 3771: Port is blocked?");
+ break;
+ }
// qWarning() << line;
}
m_mutex.unlock();
@@ -960,7 +964,7 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
if (type == "response") {
if (!value.value("success").toBool()) {
- qDebug() << "Error: The test case will fail since no signal is emitted";
+// qDebug() << "Error: The test case will fail since no signal is emitted";
return;
}
@@ -1169,12 +1173,19 @@ void tst_QDeclarativeDebugJS::setBreakpointInScriptOnCompleted()
void tst_QDeclarativeDebugJS::setBreakpointInScriptOnTimerCallback()
{
+ int sourceLine = 49;
+ client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(QMLFILE), sourceLine, -1, true);
+ client->startDebugging();
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->evaluate("timer.running = true");
+ client->continueDebugging(QJSDebugClient::Continue);
+
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
- int sourceLine = 67;
+ sourceLine = 67;
client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(QMLFILE), sourceLine, -1, true);
- client->startDebugging();
QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
QString jsonString(client->response);
@@ -1325,6 +1336,10 @@ void tst_QDeclarativeDebugJS::changeBreakpoint()
client->continueDebugging(QJSDebugClient::Continue);
//Hit 2nd breakpoint
QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ // start timer
+ client->evaluate("timer.running = true");
+
//Continue with debugging
client->continueDebugging(QJSDebugClient::Continue);
//Should stop at 2nd breakpoint
@@ -1367,6 +1382,8 @@ void tst_QDeclarativeDebugJS::changeBreakpointOnCondition()
client->continueDebugging(QJSDebugClient::Continue);
//Hit 2nd breakpoint
QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
+ // start timer
+ client->evaluate("timer.running = true");
//Continue with debugging
client->continueDebugging(QJSDebugClient::Continue);
//Should stop at 2nd breakpoint
@@ -1431,6 +1448,8 @@ void tst_QDeclarativeDebugJS::clearBreakpoint()
client->continueDebugging(QJSDebugClient::Continue);
//Hit 2nd breakpoint
QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
+ // start timer
+ client->evaluate("timer.running = true");
//Continue with debugging
client->continueDebugging(QJSDebugClient::Continue);
//Should stop at 2nd breakpoint
@@ -1448,13 +1467,12 @@ void tst_QDeclarativeDebugJS::setExceptionBreak()
{
//void setExceptionBreak(QString type, bool enabled = false);
- client->interrupt();
+ int sourceLine = 49;
+ client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(QMLFILE), sourceLine, -1, true);
+ client->setExceptionBreak(QJSDebugClient::All,true);
client->startDebugging();
QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- client->setExceptionBreak(QJSDebugClient::All,true);
- QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(result())));
-
+ client->evaluate("root.raiseException = true");
client->continueDebugging(QJSDebugClient::Continue);
QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped()), 10000));
}
@@ -1507,8 +1525,8 @@ void tst_QDeclarativeDebugJS::stepIn()
{
//void continueDebugging(StepAction stepAction, int stepCount = 1);
- int sourceLine = 67;
- int actualLine = 56;
+ int sourceLine = 61;
+ int actualLine = 78;
client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(QMLFILE), sourceLine, -1, true);
client->startDebugging();
@@ -1531,7 +1549,7 @@ void tst_QDeclarativeDebugJS::stepOut()
//void continueDebugging(StepAction stepAction, int stepCount = 1);
int sourceLine = 56;
- int actualLine = 68;
+ int actualLine = 49;
client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(QMLFILE), sourceLine, -1, true);
client->startDebugging();