diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-09-17 03:46:44 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-09-17 03:46:44 (GMT) |
commit | 7e6b2b2b95bc1db77544b898ec45ea4a2683e435 (patch) | |
tree | 00e90673f5dcb95373558d6a75f08dbb340e388b /tests | |
parent | ff075380d7ec1472fcdff06b3f39ffdc02b7f112 (diff) | |
download | Qt-7e6b2b2b95bc1db77544b898ec45ea4a2683e435.zip Qt-7e6b2b2b95bc1db77544b898ec45ea4a2683e435.tar.gz Qt-7e6b2b2b95bc1db77544b898ec45ea4a2683e435.tar.bz2 |
Moving items in a PathView caused PathView.onPath to be set to false.
Check that we no longer hold a reference to the item before setting
onPath to false.
Task-number: QTBUG-13689
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/datamodel.qml | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 23 |
2 files changed, 16 insertions, 8 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml index a5c3772..fb3c910 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml @@ -21,6 +21,7 @@ PathView { Rectangle { id: wrapper objectName: "wrapper" + property bool onPath: PathView.onPath width: 20; height: 20; color: name Text { objectName: "myText" diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 74d2f0a..cbfbfbd 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -152,27 +152,27 @@ public: QString number(int index) const { return list.at(index).second; } void addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); + beginInsertRows(QModelIndex(), list.count(), list.count()); list.append(QPair<QString,QString>(name, number)); - emit endInsertRows(); + endInsertRows(); } void insertItem(int index, const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), index, index); + beginInsertRows(QModelIndex(), index, index); list.insert(index, QPair<QString,QString>(name, number)); - emit endInsertRows(); + endInsertRows(); } void removeItem(int index) { - emit beginRemoveRows(QModelIndex(), index, index); + beginRemoveRows(QModelIndex(), index, index); list.removeAt(index); - emit endRemoveRows(); + endRemoveRows(); } void moveItem(int from, int to) { - emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); list.move(from, to); - emit endMoveRows(); + endMoveRows(); } void modifyItem(int idx, const QString &name, const QString &number) { @@ -411,6 +411,13 @@ void tst_QDeclarativePathView::dataModel() QVERIFY(text); QCOMPARE(text->text(), model.name(3)); + model.moveItem(3, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); + QList<QDeclarativeItem*> items = findItems<QDeclarativeItem>(pathview, "wrapper"); + foreach (QDeclarativeItem *item, items) { + QVERIFY(item->property("onPath").toBool()); + } + delete canvas; } |