diff options
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 | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlconsole/data/logging.qml b/tests/auto/qml/qqmlconsole/data/logging.qml index 0764ad7545..1f929d311b 100644 --- a/tests/auto/qml/qqmlconsole/data/logging.qml +++ b/tests/auto/qml/qqmlconsole/data/logging.qml @@ -68,6 +68,8 @@ QtObject { console.log(1, ["ping","pong"], new Object, 2); console.log(contextStringListProperty); + console.log(customObject); + console.log([[1,2,3,[2,2,2,2],4],[5,6,7,8]]); try { console.log(exception); diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp index 817ca0a257..b157314071 100644 --- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp +++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp @@ -51,6 +51,15 @@ private: QQmlEngine engine; }; +struct CustomObject {}; + +QDebug operator<<(QDebug dbg, const CustomObject &) +{ + return dbg << "MY OBJECT"; +} + +Q_DECLARE_METATYPE(CustomObject) + void tst_qqmlconsole::logging() { QUrl testUrl = testFileUrl("logging.qml"); @@ -83,11 +92,17 @@ void tst_qqmlconsole::logging() QTest::ignoreMessage(QtDebugMsg, "1 pong! [object Object]"); QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] [object Object] 2"); QTest::ignoreMessage(QtDebugMsg, "[Hello,World]"); + QTest::ignoreMessage(QtDebugMsg, "QVariant(CustomObject, MY OBJECT)"); + QTest::ignoreMessage(QtDebugMsg, "[[1,2,3,[2,2,2,2],4],[5,6,7,8]]"); QScopedPointer<QQmlContext> loggingContext(new QQmlContext(engine.rootContext())); QStringList stringList; stringList << QStringLiteral("Hello") << QStringLiteral("World"); loggingContext->setContextProperty("contextStringListProperty", stringList); + CustomObject customObject; + QVERIFY(QMetaType::registerDebugStreamOperator<CustomObject>()); + loggingContext->setContextProperty("customObject", QVariant::fromValue(customObject)); + QQmlComponent component(&engine, testUrl); QScopedPointer<QObject> object(component.create(loggingContext.data())); QVERIFY(object != nullptr); |