summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-10 06:34:58 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-10 06:34:58 (GMT)
commit7b29dc7daa035a351ba10dcfb879bc3f70434f63 (patch)
treeb92f01415e3cd2f28c11209cba1020734f848e61 /tests
parentb0fb09d29675f701f02fe5bf91fe64ffd0008cf6 (diff)
downloadQt-7b29dc7daa035a351ba10dcfb879bc3f70434f63.zip
Qt-7b29dc7daa035a351ba10dcfb879bc3f70434f63.tar.gz
Qt-7b29dc7daa035a351ba10dcfb879bc3f70434f63.tar.bz2
Ensure currentIndex NOTIFY is emitted when currentIndex changes due to model change.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml1
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml1
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp5
4 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml
index 32833d2..cc3e549 100644
--- a/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml
+++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml
@@ -1,6 +1,7 @@
import Qt 4.6
Rectangle {
+ property int current: grid.currentIndex
width: 240
height: 320
color: "#ffffff"
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index a1edc53..aaf8291 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;
}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml
index 74f5ef4..a6d7610 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml
@@ -1,6 +1,7 @@
import Qt 4.6
Rectangle {
+ property int current: list.currentIndex
width: 240
height: 320
color: "#ffffff"
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 17257ae..e5542c2 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1059,6 +1059,11 @@ void tst_QDeclarativeListView::currentIndex()
QTest::qWait(500);
QCOMPARE(listview->highlightItem()->y(), hlPos);
+ // insert item before currentIndex
+ listview->setCurrentIndex(28);
+ model.insertItem(0, "Foo", "1111");
+ QCOMPARE(canvas->rootObject()->property("current").toInt(), 29);
+
delete canvas;
}