diff options
Diffstat (limited to 'tests/auto/qml/qqmlconsole')
-rw-r--r-- | tests/auto/qml/qqmlconsole/data/logging.qml | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp | 8 |
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 1f929d311b..f5eaeb442a 100644 --- a/tests/auto/qml/qqmlconsole/data/logging.qml +++ b/tests/auto/qml/qqmlconsole/data/logging.qml @@ -31,6 +31,8 @@ import QtQuick 2.0 QtObject { id:root + required property var customObject + required property var stringListProperty function consoleCount() { console.count("console.count", "Ignore additional argument"); @@ -67,7 +69,7 @@ QtObject { console.log(1, "pong!", new Object); console.log(1, ["ping","pong"], new Object, 2); - console.log(contextStringListProperty); + console.log(stringListProperty); console.log(customObject); console.log([[1,2,3,[2,2,2,2],4],[5,6,7,8]]); diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp index b157314071..48613d04f1 100644 --- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp +++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp @@ -95,16 +95,16 @@ void tst_qqmlconsole::logging() 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())); + QScopedPointer<QObject> object(component.createWithInitialProperties({ + {"customObject", QVariant::fromValue(customObject)}, + {"stringListProperty", stringList} + })); QVERIFY(object != nullptr); } |