summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-15 22:13:33 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-15 22:13:33 (GMT)
commit792978f693087dfecb1b9a6479e13ab75305d0d6 (patch)
tree906874fe561b06061f6c22f665d3304d1e2026cc /tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
parentfdcb62d5d6a3e295273042555d2551eb491a5b2d (diff)
parent737c0c8d9aa319384ef0bcbed4e709deb2239e75 (diff)
downloadQt-792978f693087dfecb1b9a6479e13ab75305d0d6.zip
Qt-792978f693087dfecb1b9a6479e13ab75305d0d6.tar.gz
Qt-792978f693087dfecb1b9a6479e13ab75305d0d6.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (89 commits) Compile with user defined Qt namespace Fix regression from previous commit Import "content" with as qualifier to support network without qmldir Small fixes to photoviewer demo Fix benchmark. Add basic QUrl benchmarks. Add busy indicator to photoviewer demo Set maximumExtents correctly for highlightRangeMode: StrictlyEnforceRange fix installation of imports libraries QDeclarative::isWritable optimization. Make easing docs more consistent with other grouped property docs. Make the loader a focusscope. Fix typo. Use reliable local server for HTTP testing. Fix installation of imports libraries Change PathView offset property to use range 0 - 1.0 Tweak benchmark Optimization: Use linked list for context children Add new declarative photoviewer demo Remove dead code ...
Diffstat (limited to 'tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp54
1 files changed, 50 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index a1edc53..385d6f5 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -703,6 +703,11 @@ void tst_QDeclarativeGridView::currentIndex()
QCOMPARE(gridview->highlightItem()->x(), hlPosX);
QCOMPARE(gridview->highlightItem()->y(), hlPosY);
+ // insert item before currentIndex
+ gridview->setCurrentIndex(28);
+ model.insertItem(0, "Foo", "1111");
+ QCOMPARE(canvas->rootObject()->property("current").toInt(), 29);
+
delete canvas;
}
@@ -944,7 +949,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex()
}
// Position on a currently visible item
- gridview->positionViewAtIndex(4);
+ gridview->positionViewAtIndex(4, QDeclarativeGridView::Beginning);
QCOMPARE(gridview->contentY(), 60.);
// Confirm items positioned correctly
@@ -958,7 +963,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex()
}
// Position on an item beyond the visible items
- gridview->positionViewAtIndex(21);
+ gridview->positionViewAtIndex(21, QDeclarativeGridView::Beginning);
QCOMPARE(gridview->contentY(), 420.);
// Confirm items positioned correctly
@@ -972,7 +977,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex()
}
// Position on an item that would leave empty space if positioned at the top
- gridview->positionViewAtIndex(31);
+ gridview->positionViewAtIndex(31, QDeclarativeGridView::Beginning);
QCOMPARE(gridview->contentY(), 520.);
// Confirm items positioned correctly
@@ -986,7 +991,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex()
}
// Position at the beginning again
- gridview->positionViewAtIndex(0);
+ gridview->positionViewAtIndex(0, QDeclarativeGridView::Beginning);
QCOMPARE(gridview->contentY(), 0.);
// Confirm items positioned correctly
@@ -999,6 +1004,47 @@ void tst_QDeclarativeGridView::positionViewAtIndex()
QCOMPARE(item->y(), (i/3)*60.);
}
+ // Position at End
+ gridview->positionViewAtIndex(30, QDeclarativeGridView::End);
+ QCOMPARE(gridview->contentY(), 340.);
+
+ // Position in Center
+ gridview->positionViewAtIndex(15, QDeclarativeGridView::Center);
+ QCOMPARE(gridview->contentY(), 170.);
+
+ // Ensure at least partially visible
+ gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible);
+ QCOMPARE(gridview->contentY(), 170.);
+
+ gridview->setContentY(302);
+ gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible);
+ QCOMPARE(gridview->contentY(), 302.);
+
+ gridview->setContentY(360);
+ gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible);
+ QCOMPARE(gridview->contentY(), 300.);
+
+ gridview->setContentY(60);
+ gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible);
+ QCOMPARE(gridview->contentY(), 60.);
+
+ gridview->setContentY(20);
+ gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible);
+ QCOMPARE(gridview->contentY(), 100.);
+
+ // Ensure completely visible
+ gridview->setContentY(120);
+ gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain);
+ QCOMPARE(gridview->contentY(), 120.);
+
+ gridview->setContentY(302);
+ gridview->positionViewAtIndex(15, QDeclarativeGridView::Contain);
+ QCOMPARE(gridview->contentY(), 300.);
+
+ gridview->setContentY(60);
+ gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain);
+ QCOMPARE(gridview->contentY(), 100.);
+
delete canvas;
}