From ef74c8d03c4b0e2a36bd11e5d76154e2754d3f7f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 9 Nov 2009 16:17:09 +1000 Subject: More ListView tests. --- .../qmlgraphicslistview/data/listview.qml | 38 ++++++++++++++++++++-- .../tst_qmlgraphicslistview.cpp | 13 +++++--- 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 void items(); template void changed(); template void inserted(); - template void removed(); + template void removed(bool animated); template void moved(); QmlView *createView(const QString &filename); template @@ -398,7 +398,7 @@ void tst_QmlGraphicsListView::inserted() } template -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(); + removed(false); + removed(true); } void tst_QmlGraphicsListView::qAbstractItemModel_removed() { - removed(); + removed(false); + removed(true); } void tst_QmlGraphicsListView::qListModelInterface_moved() -- cgit v0.12