aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-14 18:10:38 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-19 11:28:32 +0000
commit8fe2e6795d9030a7c6f660a0e57b0d85fc36a1f1 (patch)
tree42ebf836c262f8d1efc06241742807caa8808d4d /tests
parentb7521acd2c77f9f7ace8d49cf1e11affe2ccbd21 (diff)
Clean up data format for V4 debug connection
This changes the type announced for functions to the actual JavaScript type "function". The type for null is also wrong: it should be "object". However, older QtCreators cannot distinguish between null and {} if null gets the correct type, unless you explicitly compare x === null in an expression evaluator. For this reason the fake "null" type is kept for now. Also, the value field of undefined is now set as QJsonValue::Undefined which causes it to be omitted when sent over the wire. This is the logical thing to do. In addition we add type and value fields for all data members mentioned in a response, not only the ones specifically asked for. The value field is the actual value for any primitives (including strings), or the number of properties for composite types: objects, arrays, functions. In turn, the "ref" members are omitted for primitive types, so that we don't have to hold references to them in the debug service anymore. Even old QtCreators can deal with verbatim data members without "ref". Task-number: QTBUG-47746 Task-number: QTBUG-47747 Change-Id: I773e6418c39cd9814aadb5fb5ef7e109f9a4e618 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qv4debugger/tst_qv4debugger.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
index ca308a4f49..7772d16234 100644
--- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
@@ -564,10 +564,8 @@ void tst_qv4debugger::readObject()
QVERIFY(b_props.at(0).isObject());
QJsonObject b_head = b_props.at(0).toObject();
QCOMPARE(b_head.value("name").toString(), QStringLiteral("head"));
- QVERIFY(b_head.contains("ref"));
- QJsonObject b_head_value = frame0.collector->lookupRef(b_head.value("ref").toInt());
- QCOMPARE(b_head_value.value("type").toString(), QStringLiteral("number"));
- QCOMPARE(b_head_value.value("value").toDouble(), 1.0);
+ QCOMPARE(b_head.value("type").toString(), QStringLiteral("number"));
+ QCOMPARE(b_head.value("value").toDouble(), 1.0);
QVERIFY(b_props.at(1).isObject());
QJsonObject b_tail = b_props.at(1).toObject();
QCOMPARE(b_tail.value("name").toString(), QStringLiteral("tail"));
@@ -580,16 +578,12 @@ void tst_qv4debugger::readObject()
QCOMPARE(b_tail_props.size(), 2);
QJsonObject b_tail_head = b_tail_props.at(0).toObject();
QCOMPARE(b_tail_head.value("name").toString(), QStringLiteral("head"));
- QVERIFY(b_tail_head.contains("ref"));
- QJsonObject b_tail_head_value = frame0.collector->lookupRef(b_tail_head.value("ref").toInt());
- QCOMPARE(b_tail_head_value.value("type").toString(), QStringLiteral("string"));
- QCOMPARE(b_tail_head_value.value("value").toString(), QStringLiteral("asdf"));
+ QCOMPARE(b_tail_head.value("type").toString(), QStringLiteral("string"));
+ QCOMPARE(b_tail_head.value("value").toString(), QStringLiteral("asdf"));
QJsonObject b_tail_tail = b_tail_props.at(1).toObject();
QCOMPARE(b_tail_tail.value("name").toString(), QStringLiteral("tail"));
- QVERIFY(b_tail_tail.contains("ref"));
-
- QJsonObject b_tail_tail_value = frame0.collector->lookupRef(b_tail_tail.value("ref").toInt());
- QCOMPARE(b_tail_tail_value.value("type").toString(), QStringLiteral("null"));
+ QCOMPARE(b_tail_tail.value("type").toString(), QStringLiteral("null"));
+ QVERIFY(b_tail_tail.value("value").isNull());
}
void tst_qv4debugger::readContextInAllFrames()