summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelistview
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2010-12-02 12:13:07 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2010-12-02 12:13:07 (GMT)
commit655bae506d4d2743ed016c78a767afa2150057a9 (patch)
tree9ccc2b4a56792616a2c48045faa9bd7081126167 /tests/auto/declarative/qdeclarativelistview
parent16252a59afa58b0cb4b0ffb02a330dcf002c9750 (diff)
parentf6f8ba94d5f82b8df723a217a3d0ecb50e570cbc (diff)
downloadQt-655bae506d4d2743ed016c78a767afa2150057a9.zip
Qt-655bae506d4d2743ed016c78a767afa2150057a9.tar.gz
Qt-655bae506d4d2743ed016c78a767afa2150057a9.tar.bz2
Merge remote branch 'origin/master' into file-engine-refactor
master's version of conflicting def files picked. Conflicts: src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtNetworku.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtGuiu.def
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistview')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml31
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp21
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml
new file mode 100644
index 0000000..e0303ec
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml
@@ -0,0 +1,31 @@
+import QtQuick 1.0
+
+ListView {
+ id: view
+ width: 300; height: 200
+ focus: true
+ keyNavigationWraps: true
+
+ model: 100
+
+ preferredHighlightBegin: 90
+ preferredHighlightEnd: 110
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlight: Component {
+ Rectangle {
+ border.color: "blue"
+ border.width: 3
+ color: "transparent"
+ width: 300; height: 15
+ }
+ }
+
+ delegate: Component {
+ Item {
+ height: 15 + (view.currentIndex == index ? 20 : 0)
+ width: 200
+ Text { text: 'Index: ' + index; anchors.verticalCenter: parent.verticalCenter }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index a4b4f21..37d836d 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -101,6 +101,7 @@ private slots:
void footer();
void resizeView();
void sizeLessThan1();
+ void QTBUG_14821();
private:
template <class T> void items();
@@ -1768,6 +1769,26 @@ void tst_QDeclarativeListView::sizeLessThan1()
delete canvas;
}
+void tst_QDeclarativeListView::QTBUG_14821()
+{
+ QDeclarativeView *canvas = createView();
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug14821.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(canvas->rootObject());
+ QVERIFY(listview != 0);
+
+ QDeclarativeItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ listview->decrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 99);
+
+ listview->incrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 0);
+}
+
void tst_QDeclarativeListView::qListModelInterface_items()
{
items<TestModel>();