diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 18:46:38 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 19:02:37 +0200 |
commit | c2f8b9535d34da6948ccf45b7d5fd90de2f1bc9e (patch) | |
tree | c6f7e058a985d7c18b51cadc76283caf555071c9 /tests/auto/qml/qqmlqt/tst_qqmlqt.cpp | |
parent | 9e633bbda7608ac0231809e2a6a97ae8f2d849d6 (diff) | |
parent | 803f18f02e5609a1ca00a5b78ea6d3613d44e1a0 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Removed dependencies.yaml because we don't use it yet in wip/cmake.
Fixed conflict in qmlcachegen.cpp.
Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
Diffstat (limited to 'tests/auto/qml/qqmlqt/tst_qqmlqt.cpp')
-rw-r--r-- | tests/auto/qml/qqmlqt/tst_qqmlqt.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 2d8115e867..15ef31464b 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -777,10 +777,6 @@ void tst_qqmlqt::dateTimeFormatting() QQmlEngine eng; - eng.rootContext()->setContextProperty("qdate", date); - eng.rootContext()->setContextProperty("qtime", time); - eng.rootContext()->setContextProperty("qdatetime", dateTime); - QQmlComponent component(&eng, testFileUrl("formatting.qml")); QStringList warnings; @@ -794,7 +790,11 @@ void tst_qqmlqt::dateTimeFormatting() foreach (const QString &warning, warnings) QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); - QObject *object = component.create(); + QObject *object = component.createWithInitialProperties({ + {"qdate", date}, + {"qtime", time}, + {"qdatetime", dateTime} + }); QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); QVERIFY(object != nullptr); @@ -853,7 +853,6 @@ void tst_qqmlqt::dateTimeFormattingVariants() QFETCH(QStringList, expectedResults); QQmlEngine eng; - eng.rootContext()->setContextProperty("qvariant", variant); QQmlComponent component(&eng, testFileUrl("formatting.qml")); QStringList warnings; @@ -867,7 +866,7 @@ void tst_qqmlqt::dateTimeFormattingVariants() foreach (const QString &warning, warnings) QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); - QObject *object = component.create(); + QObject *object = component.createWithInitialProperties({{"qvariant", variant}}); QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); QVERIFY(object != nullptr); @@ -1174,6 +1173,7 @@ void tst_qqmlqt::qtObjectContents() class TimeProvider: public QObject { Q_OBJECT + QML_NAMED_ELEMENT(TimeProvider) Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged) public: @@ -1254,13 +1254,14 @@ void tst_qqmlqt::timeRoundtrip() TimeZoneSwitch tzs(QTest::currentDataTag()); QFETCH(QTime, time); + qmlRegisterTypesAndRevisions<TimeProvider>("Test", 1); TimeProvider tp(time); QQmlEngine eng; - eng.rootContext()->setContextProperty(QLatin1String("tp"), &tp); + //qmlRegisterSingletonInstance("Test", 1, 0, "TimeProvider", &tp); QQmlComponent component(&eng, testFileUrl("timeRoundtrip.qml")); - QObject *obj = component.create(); + QObject *obj = component.createWithInitialProperties({{"tp", QVariant::fromValue(&tp)}}); QVERIFY(obj != nullptr); // QML reads m_getTime and saves the result as m_putTime; this should come out the same, without |