aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-03-12 16:28:48 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-03-24 21:30:14 +0100
commit2b8042182d77241ffe7e6b4edf4e727315f93147 (patch)
tree2963574a13e1e9b886ebac9babdb1201cbf28461 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
parent674992d07c3efaf7da7797e4b4a2a8e0b98b1813 (diff)
Check that QJSValue to set conversion works
Also, fix the check to actually test the correct capabilities by using the containerCapabilities function; testing _iteratorCapabilities only worked by chance so far. Task-number: QTBUG-82743 Change-Id: I64f20c6bf1e47737c7b927f79e1e78c1a1603741 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 3a4fba8002..16ea659fe9 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -5696,25 +5696,31 @@ class TestItem : public QObject
{
Q_OBJECT
Q_PROPERTY( QVector<QPointF> positions MEMBER m_points )
+ Q_PROPERTY( QSet<QByteArray> barrays MEMBER m_barrays )
public:
TestItem() = default;
QVector< QPointF > m_points;
+ QSet<QByteArray> m_barrays;
};
Q_DECLARE_METATYPE(QVector<QPointF>);
+Q_DECLARE_METATYPE(QSet<QByteArray>);
void tst_qqmllanguage::arrayToContainer()
{
QQmlEngine engine;
qmlRegisterType<TestItem>("qt.test", 1, 0, "TestItem");
QVector<QPointF> points { QPointF (2.0, 3.0) };
+ QSet<QByteArray> barrays { QByteArray("hello"), QByteArray("world") };
engine.rootContext()->setContextProperty("test", QVariant::fromValue(points));
QQmlComponent component(&engine, testFileUrl("arrayToContainer.qml"));
VERIFY_ERRORS(0);
- QScopedPointer<TestItem> root(qobject_cast<TestItem *>(component.createWithInitialProperties( {{"vector", QVariant::fromValue(points)}} )));
+ QScopedPointer<TestItem> root(qobject_cast<TestItem *>(component.createWithInitialProperties( {{"vector", QVariant::fromValue(points)}, {"myset", QVariant::fromValue(barrays)} } )));
QVERIFY(root);
QCOMPARE(root->m_points.at(0), QPointF (2.0, 3.0) );
+ QVERIFY(root->m_barrays.contains("hello"));
+ QVERIFY(root->m_barrays.contains("world"));
}
class EnumTester : public QObject