summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmllist
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qmllist')
-rw-r--r--tests/auto/declarative/qmllist/qmllist.pro3
-rw-r--r--tests/auto/declarative/qmllist/tst_qmllist.cpp38
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllist/qmllist.pro
new file mode 100644
index 0000000..e5558f1
--- /dev/null
+++ b/tests/auto/declarative/qmllist/qmllist.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmllist.cpp
diff --git a/tests/auto/declarative/qmllist/tst_qmllist.cpp b/tests/auto/declarative/qmllist/tst_qmllist.cpp
new file mode 100644
index 0000000..541ca64
--- /dev/null
+++ b/tests/auto/declarative/qmllist/tst_qmllist.cpp
@@ -0,0 +1,38 @@
+#include <qtest.h>
+#include <QtDeclarative/qml.h>
+#include <QtDeclarative/qmlprivate.h>
+
+class tst_QmlList : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QmlList() {}
+
+private slots:
+ void interface();
+};
+
+void tst_QmlList::interface()
+{
+ QmlConcreteList<QObject*> list;
+ QObject *obj = new QObject;
+ obj->setObjectName("foo");
+ list.append(obj);
+ QVERIFY(list.count() == 1);
+ QCOMPARE(list.at(0), obj);
+
+ QmlPrivate::ListInterface *li = (QmlPrivate::ListInterface*)&list;
+
+ void *ptr[1];
+ li->at(0, ptr);
+ QVERIFY(li->count() == 1);
+ QCOMPARE(ptr[0], obj);
+
+ li->removeAt(0);
+ QVERIFY(li->count() == 0);
+ QVERIFY(list.count() == 0);
+}
+
+QTEST_MAIN(tst_QmlList)
+
+#include "tst_qmllist.moc"