summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp b/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp
index b2d42ff..4c8219a 100644
--- a/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp
+++ b/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp
@@ -41,6 +41,7 @@
#include <qtest.h>
#include <QtDeclarative/qml.h>
#include <private/qmllistaccessor_p.h>
+#include <QDebug>
class tst_QmlListAccessor : public QObject
{
@@ -51,7 +52,7 @@ public:
private slots:
void qmllist();
//void qlist();
- //void qstringlist();
+ void qstringlist();
};
void tst_QmlListAccessor::qmllist()
@@ -71,31 +72,30 @@ void tst_QmlListAccessor::qmllist()
QVariant v = accessor.at(0);
QCOMPARE(qvariant_cast<QObject*>(v), obj);
- accessor.removeAt(3);
- QVERIFY(accessor.count() == 1);
-
- accessor.removeAt(0);
- QVERIFY(accessor.count() == 0);
+ QVERIFY(accessor.isValid());
+}
- accessor.insert(4, qVariantFromValue(obj));
- QVERIFY(accessor.count() == 1);
+void tst_QmlListAccessor::qstringlist()
+{
+ QStringList list;
+ list.append(QLatin1String("Item1"));
+ list.append(QLatin1String("Item2"));
+ QVERIFY(list.count() == 2);
- v = accessor.at(0);
- QCOMPARE(qvariant_cast<QObject*>(v), obj);
+ QmlListAccessor accessor;
+ accessor.setList(list);
- QObject *obj2 = new QObject;
- accessor.append(qVariantFromValue(obj2));
+ QVERIFY(accessor.isValid());
QVERIFY(accessor.count() == 2);
- v = accessor.at(1);
- QCOMPARE(qvariant_cast<QObject*>(v), obj2);
-
- accessor.clear();
- QVERIFY(accessor.count() == 0);
+ QVariant v = accessor.at(0);
+ QCOMPARE(qvariant_cast<QString>(v), QLatin1String("Item1"));
- QVERIFY(accessor.isValid());
+ v = accessor.at(1);
+ QCOMPARE(qvariant_cast<QString>(v), QLatin1String("Item2"));
}
+
QTEST_MAIN(tst_QmlListAccessor)
#include "tst_qmllistaccessor.moc"