aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2012-06-05 13:34:40 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-28 14:05:28 +0200
commitcc878137fcf984eb1d6ecec74d4b807e49874d8b (patch)
tree25b51c0056cb7b41ed95898effa2892beccda6fa /tests
parentb94b5531b0684965a205d6b0ec744c3482de3940 (diff)
Console API: Print JS object
Calling console.log(), console.debug(), print() etc would only print out "Object" if a JS Object was passed as an argument. This patch calls the toString() on the object. Change-Id: Iadf8b4d1fe81c3e2c7bd65e3c153a930fd994bef Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlconsole/data/logging.qml1
-rw-r--r--tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp11
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlconsole/data/logging.qml b/tests/auto/qml/qqmlconsole/data/logging.qml
index 44009b5db9..11f11f492c 100644
--- a/tests/auto/qml/qqmlconsole/data/logging.qml
+++ b/tests/auto/qml/qqmlconsole/data/logging.qml
@@ -62,6 +62,7 @@ QtObject {
var a = [1, 2];
var b = {a: "hello", d: 1 };
+ b.toString = function() { return JSON.stringify(b) }
var c
var d = 12;
var e = function() { return 5;};
diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
index d96da678e2..1f17113d4a 100644
--- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
+++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
@@ -77,15 +77,16 @@ void tst_qqmlconsole::logging()
QTest::ignoreMessage(QtDebugMsg, ": 2");
QTest::ignoreMessage(QtDebugMsg, "[1,2]");
- QTest::ignoreMessage(QtDebugMsg, "Object");
+ QTest::ignoreMessage(QtDebugMsg, "{\"a\":\"hello\",\"d\":1}");
QTest::ignoreMessage(QtDebugMsg, "undefined");
QTest::ignoreMessage(QtDebugMsg, "12");
QTest::ignoreMessage(QtDebugMsg, "function () { return 5;}");
QTest::ignoreMessage(QtDebugMsg, "true");
- QTest::ignoreMessage(QtDebugMsg, "Object");
- QTest::ignoreMessage(QtDebugMsg, "Object");
- QTest::ignoreMessage(QtDebugMsg, "1 pong! Object");
- QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] Object 2");
+ // Printing QML object prints out the class/type of QML object with the memory address
+// QTest::ignoreMessage(QtDebugMsg, "QtObject_QML_0(0xABCD..)");
+ QTest::ignoreMessage(QtDebugMsg, "[object Object]");
+ QTest::ignoreMessage(QtDebugMsg, "1 pong! [object Object]");
+ QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] [object Object] 2");
QQmlComponent component(&engine, testUrl);
QObject *object = component.create();