diff options
author | Chris Adams <christopher.adams@nokia.com> | 2011-11-04 14:13:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-11 08:20:53 +0100 |
commit | 43c516be86fb0b825b27144a68d837b87c3e1a23 (patch) | |
tree | a597cccb04b53b259de497d7143479847c821816 /tests/auto/declarative/qdeclarativeecmascript | |
parent | 851412e58ee70d76ecf405d113a1d29d82157e53 (diff) |
Remove unused codepaths from QV8SequenceWrapper
The object equality comparison callback does not allow an object with
a sequence resource to be equal to an object with a variant resource.
As such, the SequenceType::isEqual(QVariant) codepaths are not needed.
Also, QVariantList conversion is handled by toBasicVariant() in the
QV8Engine, and thus we don't need conversion code for this type in
the sequence wrapper.
Change-Id: I2ec599c5ad6cfdb715cd4e0aae3f0cc3bb36cfdf
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
3 files changed, 18 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/sequenceConversion.threads.qml b/tests/auto/declarative/qdeclarativeecmascript/data/sequenceConversion.threads.qml index 5c4afe0574..aefad89ca4 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/sequenceConversion.threads.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/sequenceConversion.threads.qml @@ -43,6 +43,11 @@ Item { worker.sendSequence(msco.urlListProperty); } + function testVariantSequence() { + msco.variantListProperty = [ "one", true, 3, "four" ]; + worker.sendSequence(msco.variantListProperty); + } + WorkerScript { id: worker source: "threadScript.js" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 12563d6588..06cc561c7f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -1160,9 +1160,10 @@ class MySequenceConversionObject : public QObject Q_PROPERTY (QList<bool> boolListProperty READ boolListProperty WRITE setBoolListProperty NOTIFY boolListPropertyChanged) Q_PROPERTY (QList<QString> stringListProperty READ stringListProperty WRITE setStringListProperty NOTIFY stringListPropertyChanged) Q_PROPERTY (QList<QUrl> urlListProperty READ urlListProperty WRITE setUrlListProperty NOTIFY urlListPropertyChanged) - Q_PROPERTY (QStringList qstringListProperty READ qstringListProperty WRITE setQStringListProperty NOTIFY qstringListPropertyChanged) + Q_PROPERTY (QList<QPoint> pointListProperty READ pointListProperty WRITE setPointListProperty NOTIFY pointListPropertyChanged) + Q_PROPERTY (QList<QVariant> variantListProperty READ variantListProperty WRITE setVariantListProperty NOTIFY variantListPropertyChanged) public: MySequenceConversionObject() @@ -1173,9 +1174,10 @@ public: m_boolList << true << false << true << false; m_stringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth"); m_urlList << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com"); - m_qstringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth"); + m_pointList << QPoint(1, 2) << QPoint(3, 4) << QPoint(5, 6); + m_variantList << QVariant(QLatin1String("one")) << QVariant(true) << QVariant(3); } ~MySequenceConversionObject() {} @@ -1196,6 +1198,8 @@ public: void setQStringListProperty(const QStringList &list) { m_qstringList = list; emit qstringListPropertyChanged(); } QList<QPoint> pointListProperty() const { return m_pointList; } void setPointListProperty(const QList<QPoint> &list) { m_pointList = list; emit pointListPropertyChanged(); } + QList<QVariant> variantListProperty() const { return m_variantList; } + void setVariantListProperty(const QList<QVariant> &list) { m_variantList = list; emit variantListPropertyChanged(); } // now for "copy resource" sequences: Q_INVOKABLE QList<int> generateIntSequence() const { QList<int> retn; retn << 1 << 2 << 3; return retn; } @@ -1218,6 +1222,7 @@ signals: void urlListPropertyChanged(); void qstringListPropertyChanged(); void pointListPropertyChanged(); + void variantListPropertyChanged(); private: QList<int> m_intList; @@ -1226,9 +1231,10 @@ private: QList<bool> m_boolList; QList<QString> m_stringList; QList<QUrl> m_urlList; + QStringList m_qstringList; - QStringList m_qstringList; // not a supported sequence type, but QStringList support is hardcoded. QList<QPoint> m_pointList; // not a supported sequence type + QList<QVariant> m_variantList; // not a supported sequence type, but QVariantList support is hardcoded. }; class MyDeleteObject : public QObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 88e0b2acb5..cccbdb0ccb 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -4239,6 +4239,10 @@ void tst_qdeclarativeecmascript::sequenceConversionThreads() QTRY_VERIFY(object->property("finished").toBool()); QVERIFY(object->property("success").toBool()); + QMetaObject::invokeMethod(object, "testVariantSequence"); + QTRY_VERIFY(object->property("finished").toBool()); + QVERIFY(object->property("success").toBool()); + delete object; } |