diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-10-06 03:59:19 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-10-06 04:02:07 (GMT) |
commit | 0030599cbe39c9fc7d6f2632b4e66a54b1b46417 (patch) | |
tree | bb05e0eaaf09e8274ce57ce8fd286f6625b07b98 /tests | |
parent | bb8ba98542e1ed363d4218b9a9a4e68a6c4b5337 (diff) | |
download | Qt-0030599cbe39c9fc7d6f2632b4e66a54b1b46417.zip Qt-0030599cbe39c9fc7d6f2632b4e66a54b1b46417.tar.gz Qt-0030599cbe39c9fc7d6f2632b4e66a54b1b46417.tar.bz2 |
Ensure PathView updates positions when path changes.
Fixes regression caused by optimization added in commit
35a51442ed21f58c06b21293eeb56e843251ee82.
Task-number: QTBUG-14239
Reviewed-by: Martin Jones
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml | 18 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml new file mode 100644 index 0000000..0c99e7f --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml @@ -0,0 +1,18 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + + PathView { + id: view + objectName: "pathView" + anchors.fill: parent + model: 10 + delegate: Rectangle { objectName: "wrapper"; color: "green"; width: 100; height: 100 } + path: Path { + startX: view.width/2; startY: 0 + PathLine { x: view.width/2; y: view.height } + } + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 65007a6..3a2a577 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -86,6 +86,7 @@ private slots: void package(); void emptyModel(); void closed(); + void pathUpdate(); private: QDeclarativeView *createView(); @@ -808,6 +809,23 @@ void tst_QDeclarativePathView::closed() } } +// QTBUG-14239 +void tst_QDeclarativePathView::pathUpdate() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdate.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView"); + QVERIFY(pathView); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(pathView, "wrapper", 0); + QVERIFY(item); + QCOMPARE(item->x(), 150.0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); |