diff options
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qqmllistmodel/data/urls.qml | 19 | ||||
-rw-r--r-- | tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp | 11 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllistmodel/data/urls.qml b/tests/auto/qml/qqmllistmodel/data/urls.qml new file mode 100644 index 0000000000..b7fe57402e --- /dev/null +++ b/tests/auto/qml/qqmllistmodel/data/urls.qml @@ -0,0 +1,19 @@ +import QtQuick 2 +import QtQml.Models 2 + +Item { + id: root + readonly property url url1: "http://qt-project.org" + property var result1 + property var result2 + ListModel {id: myModel} + + Component.onCompleted: { + myModel.append({"url": new URL("http://qt.io")}) + myModel.append({"url": url1}) + const entry1 = myModel.get(0) + root.result1 = entry1.url; + const entry2 = myModel.get(1) + root.result2 = entry2.url; + } +} diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index c2f9cfbc11..3d0aaf1147 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -121,6 +121,7 @@ private slots: void empty_element_warning_data(); void datetime(); void datetime_data(); + void url(); void about_to_be_signals(); void modify_through_delegate(); void bindingsOnGetResult(); @@ -1392,6 +1393,16 @@ void tst_qqmllistmodel::datetime_data() QTest::newRow("dt4") << "{append({'date':dt0});setProperty(0,'date',dt1);get(0).date}" << dt1; } +void tst_qqmllistmodel::url() +{ + QQmlEngine engine; + QQmlComponent comp(&engine, testFileUrl("urls.qml")); + QScopedPointer<QObject> o {comp.create()}; + QVERIFY(o); + QCOMPARE(o->property("result1").toUrl(), QUrl("http://qt.io")); + QCOMPARE(o->property("result2").toUrl(), QUrl("http://qt-project.org")); +} + void tst_qqmllistmodel::datetime() { QFETCH(QString, qml); |