summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicslistview
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-09 06:17:09 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-09 06:17:09 (GMT)
commitef74c8d03c4b0e2a36bd11e5d76154e2754d3f7f (patch)
tree2bfc4a775cf09ffd3482620208591d662d01ca30 /tests/auto/declarative/qmlgraphicslistview
parent208567d44c5140ca0d4350fde42948e6fca5dc58 (diff)
downloadQt-ef74c8d03c4b0e2a36bd11e5d76154e2754d3f7f.zip
Qt-ef74c8d03c4b0e2a36bd11e5d76154e2754d3f7f.tar.gz
Qt-ef74c8d03c4b0e2a36bd11e5d76154e2754d3f7f.tar.bz2
More ListView tests.
Diffstat (limited to 'tests/auto/declarative/qmlgraphicslistview')
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/data/listview.qml38
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp13
2 files changed, 43 insertions, 8 deletions
diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
index 3ef1be1..075e464 100644
--- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
+++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
@@ -32,10 +32,42 @@ Rectangle {
text: wrapper.y
}
color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ },
+ Component {
+ id: animatedDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
ListView.onRemove: SequentialAnimation {
- PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: true }
+ ScriptAction { script: print("Fix PropertyAction with attached properties") }
+/*
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" }
- PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: false }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+*/
}
}
}
@@ -47,7 +79,7 @@ Rectangle {
width: 240
height: 320
model: testModel
- delegate: myDelegate
+ delegate: animate ? myDelegate : animatedDelegate
highlightMoveSpeed: 1000
}
}
diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
index afef47a..dc339ea 100644
--- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
+++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
@@ -54,7 +54,6 @@ public:
tst_QmlGraphicsListView();
private slots:
- void itemList();
// Test both QListModelInterface and QAbstractItemModel model types
void qListModelInterface_items();
void qAbstractItemModel_items();
@@ -71,6 +70,7 @@ private slots:
void qListModelInterface_moved();
void qAbstractItemModel_moved();
+ void itemList();
void currentIndex();
void enforceRange();
void spacing();
@@ -80,7 +80,7 @@ private:
template <class T> void items();
template <class T> void changed();
template <class T> void inserted();
- template <class T> void removed();
+ template <class T> void removed(bool animated);
template <class T> void moved();
QmlView *createView(const QString &filename);
template<typename T>
@@ -398,7 +398,7 @@ void tst_QmlGraphicsListView::inserted()
}
template <class T>
-void tst_QmlGraphicsListView::removed()
+void tst_QmlGraphicsListView::removed(bool animated)
{
QmlView *canvas = createView(SRCDIR "/data/listview.qml");
@@ -408,6 +408,7 @@ void tst_QmlGraphicsListView::removed()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("animate", QVariant(animated));
canvas->execute();
qApp->processEvents();
@@ -911,12 +912,14 @@ void tst_QmlGraphicsListView::qAbstractItemModel_inserted()
void tst_QmlGraphicsListView::qListModelInterface_removed()
{
- removed<TestModel>();
+ removed<TestModel>(false);
+ removed<TestModel>(true);
}
void tst_QmlGraphicsListView::qAbstractItemModel_removed()
{
- removed<TestModel2>();
+ removed<TestModel2>(false);
+ removed<TestModel2>(true);
}
void tst_QmlGraphicsListView::qListModelInterface_moved()