diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-04-22 04:47:24 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-04-22 04:47:24 (GMT) |
commit | 2366667fc97eb6a56203b2dd7dac776ff4164abd (patch) | |
tree | b2acb6cc6bfe475d7e619e4788973b61fff775e0 /tests/auto/declarative/qmllist | |
parent | 2c762f3b8b284a7c6dc0c499b7052013bad5b707 (diff) | |
download | Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.zip Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.gz Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.bz2 |
Initial import of kinetic-dui branch from the old kinetic
Diffstat (limited to 'tests/auto/declarative/qmllist')
-rw-r--r-- | tests/auto/declarative/qmllist/qmllist.pro | 3 | ||||
-rw-r--r-- | tests/auto/declarative/qmllist/tst_qmllist.cpp | 38 |
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" |