From 6a02fb09af8dce6ca533e816d2223e070b30f294 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 16 May 2017 19:08:28 +0200 Subject: QQmlIRBuilder: Only query type name cache for type names The behavior here was always incorrect: type names must start with an uppercase letter, so querying the type name cache with a lowercase string is wrong. However, this was turned into a larger problem by making more extensive use of QQmlTypeNameCache in e74a1d0b342f2c95dc3a543c8c9ec07fd52d8fe0, as it contained a lot of new types (including composite types, which previously were only in the cache if they were singletons). Task-number: QTBUG-60547 Change-Id: I40be2d535e99d3e1af250d995d7149ecbe2965d7 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml | 11 +++++++++++ .../qml/qqmlecmascript/data/qtbug60547/components/Counter.qml | 4 ++++ tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml | 8 ++++++++ tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 11 +++++++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml create mode 100644 tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml create mode 100644 tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml new file mode 100644 index 0000000000..5f022f605a --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import "components" + +QtObject { + id: root + property int counter + function increment() { + counter++ + return counter + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml new file mode 100644 index 0000000000..3c5e65a340 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +QtObject {} + diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml new file mode 100644 index 0000000000..b09366e9df --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml @@ -0,0 +1,8 @@ +import QtQml 2.0 + +TestObject { + Component.onCompleted: { + increment() + } +} + diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 72179d243f..7b9a43dc38 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -337,6 +337,7 @@ private slots: void instanceof(); void freeze_empty_object(); void singleBlockLoops(); + void qtbug_60547(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -8250,6 +8251,16 @@ void tst_qqmlecmascript::singleBlockLoops() QVERIFY(!component.isError()); } +// 'counter' was incorrectly resolved as a type rather than a variable. +// This fix ensures it looks up the right thing. +void tst_qqmlecmascript::qtbug_60547() +{ + QQmlComponent component(&engine, testFileUrl("qtbug60547/main.qml")); + QScopedPointer object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); + QCOMPARE(object->property("counter"), QVariant(int(1))); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" -- cgit v1.2.3 From 5f49b2b3bb30678a26341e1f45e0cfd6a6fd2c57 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 11 May 2017 17:19:14 +0200 Subject: QML Settings: fix JS array handling Before Qt 5.4, JS arrays were passed as QVariantLists. Since Qt 5.4, they are passed as QJSValues instead. Use QJSValue::toVariant() (the same way as QQuickItemView::setModel(QVariant) which was fixed in cf959b4b) to convert JS values to QSettings-compatible variants. Task-number: QTBUG-45316 Change-Id: Icc6f8ad09bfef089d9efcf5b90e3783bb3f73a9f Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlsettings/data/aliases.qml | 4 + tests/auto/qml/qqmlsettings/data/cpp-aliases.qml | 2 + tests/auto/qml/qqmlsettings/data/types.qml | 6 + tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp | 206 ++++++----------------- 4 files changed, 65 insertions(+), 153 deletions(-) (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qqmlsettings/data/aliases.qml b/tests/auto/qml/qqmlsettings/data/aliases.qml index 18bd7a0e07..dd11147532 100644 --- a/tests/auto/qml/qqmlsettings/data/aliases.qml +++ b/tests/auto/qml/qqmlsettings/data/aliases.qml @@ -38,8 +38,10 @@ QtObject { property double doubleProperty: 3.45 property string stringProperty: "foo" property url urlProperty: "http://www.qt-project.org" + property var objectProperty: {"foo":"bar"} property var intListProperty: [1, 2, 3] property var stringListProperty: ["a", "b", "c"] + property var objectListProperty: [{"a":"b"}, {"c":"d"}] property date dateProperty: "2000-01-02" // QTBUG-32295: Expected property type //property time timeProperty: "12:34:56" @@ -58,8 +60,10 @@ QtObject { property alias doubleProperty: root.doubleProperty property alias stringProperty: root.stringProperty property alias urlProperty: root.urlProperty + property alias objectProperty: root.objectProperty property alias intListProperty: root.intListProperty property alias stringListProperty: root.stringListProperty + property alias objectListProperty: root.objectListProperty property alias dateProperty: root.dateProperty // QTBUG-32295: Expected property type //property alias timeProperty: root.timeProperty diff --git a/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml b/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml index 8540838fb9..f5b18d1825 100644 --- a/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml +++ b/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml @@ -40,8 +40,10 @@ CppObject { property alias doubleProperty: obj.doubleProperty property alias stringProperty: obj.stringProperty property alias urlProperty: obj.urlProperty + property alias objectProperty: obj.objectProperty property alias intListProperty: obj.intListProperty property alias stringListProperty: obj.stringListProperty + property alias objectListProperty: obj.objectListProperty property alias dateProperty: obj.dateProperty // QTBUG-32295: Expected property type //property alias timeProperty: obj.timeProperty diff --git a/tests/auto/qml/qqmlsettings/data/types.qml b/tests/auto/qml/qqmlsettings/data/types.qml index d1301af057..c4efa0be7c 100644 --- a/tests/auto/qml/qqmlsettings/data/types.qml +++ b/tests/auto/qml/qqmlsettings/data/types.qml @@ -38,8 +38,10 @@ QtObject { property double doubleProperty property string stringProperty property url urlProperty + property var objectProperty property var intListProperty property var stringListProperty + property var objectListProperty property date dateProperty // QTBUG-32295: Expected property type // property time timeProperty @@ -64,8 +66,10 @@ QtObject { to.doubleProperty = from.doubleProperty to.stringProperty = from.stringProperty to.urlProperty = from.urlProperty + to.objectProperty = from.objectProperty to.intListProperty = from.intListProperty to.stringListProperty = from.stringListProperty + to.objectListProperty = from.objectListProperty to.dateProperty = from.dateProperty //to.timeProperty = from.timeProperty to.sizeProperty = from.sizeProperty @@ -84,8 +88,10 @@ QtObject { property double doubleProperty: 3.45 property string stringProperty: "foo" property url urlProperty: "http://www.qt-project.org" + property var objectProperty: {"foo":"bar"} property var intListProperty: [1, 2, 3] property var stringListProperty: ["a", "b", "c"] + property var objectListProperty: [{"a":"b"}, {"c":"d"}] property date dateProperty: "2000-01-02" // QTBUG-32295: Expected property type //property time timeProperty: "12:34:56" diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp index c2e20f8892..e08389045c 100644 --- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp +++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp @@ -55,25 +55,36 @@ private slots: void initial(); }; +// ### Replace keyValueMap("foo", "bar") with QVariantMap({{"foo", "bar"}}) +// when C++11 uniform initialization can be used (not supported by MSVC 2013). +static QVariantMap keyValueMap(const QString &key, const QString &value) +{ + QVariantMap var; + var.insert(key, value); + return var; +} + class CppObject : public QObject { Q_OBJECT - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged) - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty NOTIFY boolPropertyChanged) - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty NOTIFY realPropertyChanged) - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty NOTIFY doublePropertyChanged) - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringPropertyChanged) - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty NOTIFY urlPropertyChanged) - Q_PROPERTY(QVariant varProperty READ varProperty WRITE setVarProperty NOTIFY varPropertyChanged) - Q_PROPERTY(QVariantList intListProperty READ intListProperty WRITE setIntListProperty NOTIFY intListPropertyChanged) - Q_PROPERTY(QVariantList stringListProperty READ stringListProperty WRITE setStringListProperty NOTIFY stringListPropertyChanged) - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty NOTIFY datePropertyChanged) - // QTBUG-32295: Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty NOTIFY timePropertyChanged) - Q_PROPERTY(QSizeF sizeProperty READ sizeProperty WRITE setSizeProperty NOTIFY sizePropertyChanged) - Q_PROPERTY(QPointF pointProperty READ pointProperty WRITE setPointProperty NOTIFY pointPropertyChanged) - Q_PROPERTY(QRectF rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty NOTIFY colorPropertyChanged) - Q_PROPERTY(QFont fontProperty READ fontProperty WRITE setFontProperty NOTIFY fontPropertyChanged) + Q_PROPERTY(int intProperty MEMBER m_intProperty NOTIFY intPropertyChanged) + Q_PROPERTY(bool boolProperty MEMBER m_boolProperty NOTIFY boolPropertyChanged) + Q_PROPERTY(qreal realProperty MEMBER m_realProperty NOTIFY realPropertyChanged) + Q_PROPERTY(double doubleProperty MEMBER m_doubleProperty NOTIFY doublePropertyChanged) + Q_PROPERTY(QString stringProperty MEMBER m_stringProperty NOTIFY stringPropertyChanged) + Q_PROPERTY(QUrl urlProperty MEMBER m_urlProperty NOTIFY urlPropertyChanged) + Q_PROPERTY(QVariant varProperty MEMBER m_varProperty NOTIFY varPropertyChanged) + Q_PROPERTY(QVariantMap objectProperty MEMBER m_objectProperty NOTIFY objectPropertyChanged) + Q_PROPERTY(QVariantList intListProperty MEMBER m_intListProperty NOTIFY intListPropertyChanged) + Q_PROPERTY(QVariantList stringListProperty MEMBER m_stringListProperty NOTIFY stringListPropertyChanged) + Q_PROPERTY(QVariantList objectListProperty MEMBER m_objectListProperty NOTIFY objectListPropertyChanged) + Q_PROPERTY(QDate dateProperty MEMBER m_dateProperty NOTIFY datePropertyChanged) + // QTBUG-32295: Q_PROPERTY(QTime timeProperty MEMBER m_timeProperty NOTIFY timePropertyChanged) + Q_PROPERTY(QSizeF sizeProperty MEMBER m_sizeProperty NOTIFY sizePropertyChanged) + Q_PROPERTY(QPointF pointProperty MEMBER m_pointProperty NOTIFY pointPropertyChanged) + Q_PROPERTY(QRectF rectProperty MEMBER m_rectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QColor colorProperty MEMBER m_colorProperty NOTIFY colorPropertyChanged) + Q_PROPERTY(QFont fontProperty MEMBER m_fontProperty NOTIFY fontPropertyChanged) public: CppObject(QObject *parent = 0) : QObject(parent), @@ -83,8 +94,10 @@ public: m_doubleProperty(3.45), m_stringProperty("foo"), m_urlProperty("http://www.qt-project.org"), + m_objectProperty(keyValueMap("foo", "bar")), m_intListProperty(QVariantList() << 1 << 2 << 3), m_stringListProperty(QVariantList() << "a" << "b" << "c"), + m_objectListProperty(QVariantList() << keyValueMap("a", "b") << keyValueMap("c", "d")), m_dateProperty(2000, 1, 2), // QTBUG-32295: m_timeProperty(12, 34, 56), m_sizeProperty(12, 34), @@ -94,143 +107,6 @@ public: { } - int intProperty() const { return m_intProperty; } - bool boolProperty() const { return m_boolProperty; } - qreal realProperty() const { return m_realProperty; } - double doubleProperty() const { return m_doubleProperty; } - QString stringProperty() const { return m_stringProperty; } - QUrl urlProperty() const { return m_urlProperty; } - QVariant varProperty() const { return m_varProperty; } - QVariantList intListProperty() const { return m_intListProperty; } - QVariantList stringListProperty() const { return m_stringListProperty; } - QDate dateProperty() const { return m_dateProperty; } - QSizeF sizeProperty() const { return m_sizeProperty; } - QPointF pointProperty() const { return m_pointProperty; } - QRectF rectProperty() const { return m_rectProperty; } - QColor colorProperty() const { return m_colorProperty; } - QFont fontProperty() const { return m_fontProperty; } - -public slots: - void setIntProperty(int arg) - { - if (m_intProperty != arg) { - m_intProperty = arg; - emit intPropertyChanged(arg); - } - } - - void setBoolProperty(bool arg) - { - if (m_boolProperty != arg) { - m_boolProperty = arg; - emit boolPropertyChanged(arg); - } - } - - void setRealProperty(qreal arg) - { - if (m_realProperty != arg) { - m_realProperty = arg; - emit realPropertyChanged(arg); - } - } - - void setDoubleProperty(double arg) - { - if (m_doubleProperty != arg) { - m_doubleProperty = arg; - emit doublePropertyChanged(arg); - } - } - - void setStringProperty(const QString &arg) - { - if (m_stringProperty != arg) { - m_stringProperty = arg; - emit stringPropertyChanged(arg); - } - } - - void setUrlProperty(const QUrl &arg) - { - if (m_urlProperty != arg) { - m_urlProperty = arg; - emit urlPropertyChanged(arg); - } - } - - void setVarProperty(const QVariant &arg) - { - if (m_varProperty != arg) { - m_varProperty = arg; - emit varPropertyChanged(arg); - } - } - - void setIntListProperty(const QVariantList &arg) - { - if (m_intListProperty != arg) { - m_intListProperty = arg; - emit intListPropertyChanged(arg); - } - } - - void setStringListProperty(const QVariantList &arg) - { - if (m_stringListProperty != arg) { - m_stringListProperty = arg; - emit stringListPropertyChanged(arg); - } - } - - void setDateProperty(const QDate &arg) - { - if (m_dateProperty != arg) { - m_dateProperty = arg; - emit datePropertyChanged(arg); - } - } - - void setSizeProperty(const QSizeF &arg) - { - if (m_sizeProperty != arg) { - m_sizeProperty = arg; - emit sizePropertyChanged(arg); - } - } - - void setPointProperty(const QPointF &arg) - { - if (m_pointProperty != arg) { - m_pointProperty = arg; - emit pointPropertyChanged(arg); - } - } - - void setRectProperty(const QRectF &arg) - { - if (m_rectProperty != arg) { - m_rectProperty = arg; - emit rectPropertyChanged(arg); - } - } - - void setColorProperty(const QColor &arg) - { - if (m_colorProperty != arg) { - m_colorProperty = arg; - emit colorPropertyChanged(arg); - } - } - - void setFontProperty(const QFont &arg) - { - if (m_fontProperty != arg) { - m_fontProperty = arg; - emit fontPropertyChanged(arg); - } - } - signals: void intPropertyChanged(int arg); void boolPropertyChanged(bool arg); @@ -239,8 +115,10 @@ signals: void stringPropertyChanged(const QString &arg); void urlPropertyChanged(const QUrl &arg); void varPropertyChanged(const QVariant &arg); + void objectPropertyChanged(const QVariantMap &arg); void intListPropertyChanged(const QVariantList &arg); void stringListPropertyChanged(const QVariantList &arg); + void objectListPropertyChanged(const QVariantList &arg); void datePropertyChanged(const QDate &arg); void sizePropertyChanged(const QSizeF &arg); void pointPropertyChanged(const QPointF &arg); @@ -256,8 +134,10 @@ private: QString m_stringProperty; QUrl m_urlProperty; QVariant m_varProperty; + QVariantMap m_objectProperty; QVariantList m_intListProperty; QVariantList m_stringListProperty; + QVariantList m_objectListProperty; QDate m_dateProperty; QSizeF m_sizeProperty; QPointF m_pointProperty; @@ -316,8 +196,10 @@ void tst_QQmlSettings::types() QCOMPARE(root->property("doubleProperty").toDouble(), static_cast(0.0)); QCOMPARE(root->property("stringProperty").toString(), QString()); QCOMPARE(root->property("urlProperty").toUrl(), QUrl()); + QCOMPARE(root->property("objectProperty").toMap(), QVariantMap()); QCOMPARE(root->property("intListProperty").toList(), QVariantList()); QCOMPARE(root->property("stringListProperty").toList(), QVariantList()); + QCOMPARE(root->property("objectListProperty").toList(), QVariantList()); QCOMPARE(root->property("dateProperty").toDate(), QDate()); // QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime()); QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF()); @@ -333,8 +215,10 @@ void tst_QQmlSettings::types() QCOMPARE(settings->property("doubleProperty").toDouble(), static_cast(3.45)); QCOMPARE(settings->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(settings->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(settings->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(settings->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); + QCOMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); QCOMPARE(settings->property("dateProperty").toDate(), QDate(2000, 01, 02)); // QTBUG-32295: QCOMPARE(settings->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(12, 34)); @@ -351,9 +235,11 @@ void tst_QQmlSettings::types() QCOMPARE(root->property("doubleProperty").toDouble(), static_cast(3.45)); QCOMPARE(root->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(root->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(root->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(root->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(root->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); QCOMPARE(root->property("dateProperty").toDate(), QDate(2000, 01, 02)); + QCOMPARE(root->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); // QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF(12, 34)); QCOMPARE(root->property("pointProperty").toPointF(), QPointF(12, 34)); @@ -368,8 +254,10 @@ void tst_QQmlSettings::types() QVERIFY(root->setProperty("doubleProperty", static_cast(6.78))); QVERIFY(root->setProperty("stringProperty", QStringLiteral("bar"))); QVERIFY(root->setProperty("urlProperty", QUrl("https://codereview.qt-project.org"))); + QVERIFY(root->setProperty("objectProperty", keyValueMap("bar", "baz"))); QVERIFY(root->setProperty("intListProperty", QVariantList() << 4 << 5 << 6)); QVERIFY(root->setProperty("stringListProperty", QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"))); + QVERIFY(root->setProperty("objectListProperty", QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"))); QVERIFY(root->setProperty("dateProperty", QDate(2010, 02, 01))); // QTBUG-32295: QVERIFY(root->setProperty("timeProperty", QTime(6, 56, 34))); QVERIFY(root->setProperty("sizeProperty", QSizeF(56, 78))); @@ -387,8 +275,10 @@ void tst_QQmlSettings::types() QTRY_COMPARE(settings->property("doubleProperty").toDouble(), static_cast(6.78)); QTRY_COMPARE(settings->property("stringProperty").toString(), QStringLiteral("bar")); QTRY_COMPARE(settings->property("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org")); + QTRY_COMPARE(settings->property("objectProperty").toMap(), keyValueMap("bar", "baz")); QTRY_COMPARE(settings->property("intListProperty").toList(), QVariantList() << 4 << 5 << 6); QTRY_COMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")); + QTRY_COMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")); QTRY_COMPARE(settings->property("dateProperty").toDate(), QDate(2010, 02, 01)); // QTBUG-32295: QTRY_COMPARE(settings->property("timeProperty").toDate(), QTime(6, 56, 34)); QTRY_COMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(56, 78)); @@ -404,8 +294,10 @@ void tst_QQmlSettings::types() QTRY_COMPARE(qs.value("doubleProperty").toDouble(), static_cast(6.78)); QTRY_COMPARE(qs.value("stringProperty").toString(), QStringLiteral("bar")); QTRY_COMPARE(qs.value("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org")); + QTRY_COMPARE(qs.value("objectProperty").toMap(), keyValueMap("bar", "baz")); QTRY_COMPARE(qs.value("intListProperty").toList(), QVariantList() << 4 << 5 << 6); QTRY_COMPARE(qs.value("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")); + QTRY_COMPARE(qs.value("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")); QTRY_COMPARE(qs.value("dateProperty").toDate(), QDate(2010, 02, 01)); // QTBUG-32295: QTRY_COMPARE(qs.value("timeProperty").toDate(), QTime(6, 56, 34)); QTRY_COMPARE(qs.value("sizeProperty").toSizeF(), QSizeF(56, 78)); @@ -440,8 +332,10 @@ void tst_QQmlSettings::aliases() QCOMPARE(root->property("doubleProperty").toDouble(), static_cast(3.45)); QCOMPARE(root->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(root->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(root->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(root->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(root->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); + QCOMPARE(root->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); QCOMPARE(root->property("dateProperty").toDate(), QDate(2000, 01, 02)); // QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF(12, 34)); @@ -457,8 +351,10 @@ void tst_QQmlSettings::aliases() QCOMPARE(settings->property("doubleProperty").toDouble(), static_cast(3.45)); QCOMPARE(settings->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(settings->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(settings->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(settings->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); + QCOMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); QCOMPARE(settings->property("dateProperty").toDate(), QDate(2000, 01, 02)); // QTBUG-32295: QCOMPARE(settings->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(12, 34)); @@ -474,8 +370,10 @@ void tst_QQmlSettings::aliases() QVERIFY(settings->setProperty("doubleProperty", static_cast(6.78))); QVERIFY(settings->setProperty("stringProperty", QStringLiteral("bar"))); QVERIFY(settings->setProperty("urlProperty", QUrl("https://codereview.qt-project.org"))); + QVERIFY(settings->setProperty("objectProperty", keyValueMap("bar", "baz"))); QVERIFY(settings->setProperty("intListProperty", QVariantList() << 4 << 5 << 6)); QVERIFY(settings->setProperty("stringListProperty", QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"))); + QVERIFY(settings->setProperty("objectListProperty", QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"))); QVERIFY(settings->setProperty("dateProperty", QDate(2010, 02, 01))); // QTBUG-32295: QVERIFY(settings->setProperty("timeProperty", QTime(6, 56, 34))); QVERIFY(settings->setProperty("sizeProperty", QSizeF(56, 78))); @@ -492,8 +390,10 @@ void tst_QQmlSettings::aliases() QTRY_COMPARE(qs.value("doubleProperty").toDouble(), static_cast(6.78)); QTRY_COMPARE(qs.value("stringProperty").toString(), QStringLiteral("bar")); QTRY_COMPARE(qs.value("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org")); + QTRY_COMPARE(qs.value("objectProperty").toMap(), keyValueMap("bar", "baz")); QTRY_COMPARE(qs.value("intListProperty").toList(), QVariantList() << 4 << 5 << 6); QTRY_COMPARE(qs.value("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")); + QTRY_COMPARE(qs.value("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")); QTRY_COMPARE(qs.value("dateProperty").toDate(), QDate(2010, 02, 01)); // QTBUG-32295: QTRY_COMPARE(qs.value("timeProperty").toDate(), QTime(6, 56, 34)); QTRY_COMPARE(qs.value("sizeProperty").toSizeF(), QSizeF(56, 78)); -- cgit v1.2.3