summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-13 05:06:52 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-13 05:06:52 (GMT)
commit2c393c60f0d309edab31cd1998a0baf6d5749d9d (patch)
tree145fce682d16eff9df38ad8415deb7d938a1e3aa /tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
parentee4278059939902482c7f457089aaf484358113b (diff)
downloadQt-2c393c60f0d309edab31cd1998a0baf6d5749d9d.zip
Qt-2c393c60f0d309edab31cd1998a0baf6d5749d9d.tar.gz
Qt-2c393c60f0d309edab31cd1998a0baf6d5749d9d.tar.bz2
More GridView autotests
Diffstat (limited to 'tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp')
-rw-r--r--tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
index d99b16f..d09aad7 100644
--- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
+++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#include <qmlengine.h>
+#include <qmlcomponent.h>
#include <QtTest/QtTest>
#include <private/qlistmodelinterface_p.h>
#include <qmlview.h>
@@ -60,6 +63,8 @@ private slots:
void moved();
void currentIndex();
void changeFlow();
+ void defaultValues();
+ void properties();
private:
QmlView *createView(const QString &filename);
@@ -690,6 +695,52 @@ void tst_QmlGraphicsGridView::changeFlow()
delete canvas;
}
+void tst_QmlGraphicsGridView::defaultValues()
+{
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/gridview3.qml"));
+ QmlGraphicsGridView *obj = qobject_cast<QmlGraphicsGridView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->model() == QVariant());
+ QVERIFY(obj->delegate() == 0);
+ QCOMPARE(obj->currentIndex(), -1);
+ QVERIFY(obj->currentItem() == 0);
+ QCOMPARE(obj->count(), 0);
+ QVERIFY(obj->highlight() == 0);
+ QVERIFY(obj->highlightItem() == 0);
+ QCOMPARE(obj->highlightFollowsCurrentItem(), true);
+ QVERIFY(obj->flow() == 0);
+ QCOMPARE(obj->isWrapEnabled(), false);
+ QCOMPARE(obj->cacheBuffer(), 0);
+ QCOMPARE(obj->cellWidth(), 100); //### Should 100 be the default?
+ QCOMPARE(obj->cellHeight(), 100);
+ delete obj;
+}
+
+void tst_QmlGraphicsGridView::properties()
+{
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/gridview2.qml"));
+ QmlGraphicsGridView *obj = qobject_cast<QmlGraphicsGridView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->model() != QVariant());
+ QVERIFY(obj->delegate() != 0);
+ QCOMPARE(obj->currentIndex(), 0);
+ QVERIFY(obj->currentItem() != 0);
+ QCOMPARE(obj->count(), 4);
+ QVERIFY(obj->highlight() != 0);
+ QVERIFY(obj->highlightItem() != 0);
+ QCOMPARE(obj->highlightFollowsCurrentItem(), false);
+ QVERIFY(obj->flow() == 0);
+ QCOMPARE(obj->isWrapEnabled(), true);
+ QCOMPARE(obj->cacheBuffer(), 200);
+ QCOMPARE(obj->cellWidth(), 100);
+ QCOMPARE(obj->cellHeight(), 100);
+ delete obj;
+}
+
QmlView *tst_QmlGraphicsGridView::createView(const QString &filename)
{
QmlView *canvas = new QmlView(0);