aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-07-04 17:01:02 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2014-08-08 10:45:12 +0200
commit6333e0913fc0078c0221a8909ced8df03a568992 (patch)
tree40661d956eb9a87ba3f695811de0e3c591ab7583 /tests/auto/qml/debugger
parent94669499fd943fc72095afd739a21cd8e675f14f (diff)
Add support for conditional breakpoints and evaluate.
Also centralized the context state saver and added line number saving, so that the JS jobs for evaluation of breakpoint conditions don't change the state of the current engine context. Task-number: QTBUG-37119 Task-number: QTCREATORBUG-11516 Change-Id: Ia21b3d64e239e5b67f3c07e1c006d8e6748f29b6 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/qml/debugger')
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index fef020704f..8763c4fa55 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -187,7 +187,7 @@ private slots:
void setBreakpointInScriptOnComment();
void setBreakpointInScriptOnEmptyLine();
void setBreakpointInScriptOnOptimizedBinding();
-// void setBreakpointInScriptWithCondition(); // Not supported yet.
+ void setBreakpointInScriptWithCondition();
void setBreakpointInScriptThatQuits();
//void setBreakpointInFunction(); //NOT SUPPORTED
// void setBreakpointOnEvent();
@@ -1082,13 +1082,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
}
-#if 0
void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
{
- QFAIL("conditional breakpoints are not yet supported");
-
- //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
-
int out = 10;
int sourceLine = 50;
QVERIFY(init(CONDITION_QMLFILE));
@@ -1102,23 +1097,26 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
QString jsonString = client->response;
QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
- QVariantMap body = value.value("body").toMap();
-
- int frameIndex = body.value("index").toInt();
-
- //Verify the value of 'result'
- client->evaluate(QLatin1String("a"),frameIndex);
+ {
+ QVariantMap body = value.value("body").toMap();
+ int frameIndex = body.value("index").toInt();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ //Verify the value of 'result'
+ client->evaluate(QLatin1String("a"),frameIndex);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ }
jsonString = client->response;
- value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- body = value.value("body").toMap();
-
- QVERIFY(body.value("value").toInt() > out);
+ QJSValue val = client->parser.call(QJSValueList() << QJSValue(jsonString));
+ QVERIFY(val.isObject());
+ QJSValue body = val.property(QStringLiteral("body"));
+ QVERIFY(body.isObject());
+ val = body.property("value");
+ QVERIFY(val.isNumber());
+
+ const int a = val.toInt();
+ QVERIFY(a > out);
}
-#endif
void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
{