diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-04-18 09:38:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-05-02 15:46:10 +0000 |
commit | 057e37dba9e06c70012ed36e5998880ac277c06f (patch) | |
tree | bb03e8ffcc3b909001884c9e151dc462252820b4 /tests/auto/qml/qqmlconsole | |
parent | 1236abb3b3abab65984e32094bbaba4395667e0b (diff) |
Fix console.log for sequence types such as QStringList
The output should be the same as if we were printing an array, with
brackets.
Task-number: QTBUG-67776
Change-Id: I942df66a2908f82ea8ba1ce65676413569cf6f02
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlconsole')
-rw-r--r-- | tests/auto/qml/qqmlconsole/data/logging.qml | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlconsole/data/logging.qml b/tests/auto/qml/qqmlconsole/data/logging.qml index d55c99bcbd..0764ad7545 100644 --- a/tests/auto/qml/qqmlconsole/data/logging.qml +++ b/tests/auto/qml/qqmlconsole/data/logging.qml @@ -67,6 +67,8 @@ QtObject { console.log(1, "pong!", new Object); console.log(1, ["ping","pong"], new Object, 2); + console.log(contextStringListProperty); + try { console.log(exception); } catch (e) { diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp index 0d915f98f8..5391e19f50 100644 --- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp +++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp @@ -29,6 +29,7 @@ #include <QDebug> #include <QQmlEngine> #include <QQmlComponent> +#include <QQmlContext> #include <QLoggingCategory> #include "../../shared/util.h" @@ -81,11 +82,15 @@ void tst_qqmlconsole::logging() // QTest::ignoreMessage(QtDebugMsg, "[object Object]"); QTest::ignoreMessage(QtDebugMsg, "1 pong! [object Object]"); QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] [object Object] 2"); + QTest::ignoreMessage(QtDebugMsg, "[Hello,World]"); + + QScopedPointer<QQmlContext> loggingContext(new QQmlContext(engine.rootContext())); + QStringList stringList; stringList << QStringLiteral("Hello") << QStringLiteral("World"); + loggingContext->setContextProperty("contextStringListProperty", stringList); QQmlComponent component(&engine, testUrl); - QObject *object = component.create(); + QScopedPointer<QObject> object(component.create(loggingContext.data())); QVERIFY(object != nullptr); - delete object; } void tst_qqmlconsole::categorized_logging() |