summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativepathview
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-29 04:23:49 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-29 04:43:08 (GMT)
commit6e061ee6bd2f516e6ae6ed8035fe7afe5abd5566 (patch)
tree7ef551c51f0f7d97a88650c5d5f31334f2ac7569 /tests/auto/declarative/qdeclarativepathview
parentf5287ee035fe0c218de47b77038b881d9c857110 (diff)
downloadQt-6e061ee6bd2f516e6ae6ed8035fe7afe5abd5566.zip
Qt-6e061ee6bd2f516e6ae6ed8035fe7afe5abd5566.tar.gz
Qt-6e061ee6bd2f516e6ae6ed8035fe7afe5abd5566.tar.bz2
Fix path view update on startX(Y) changes in qml
Task-number: QTBUG-10290 Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativepathview')
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml38
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp23
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml
new file mode 100644
index 0000000..ce0f0c9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml
@@ -0,0 +1,38 @@
+import Qt 4.7
+
+Rectangle {
+ width: 800
+ height: 480
+ color: "black"
+ resources: [
+ ListModel {
+ id: appModel
+ ListElement { color: "green" }
+ },
+ Component {
+ id: appDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ color: "green"
+ width: 100
+ height: 100
+ }
+ }
+ ]
+ PathView {
+ id: pathView
+ objectName: "pathView"
+ model: appModel
+ anchors.fill: parent
+
+ transformOrigin: "Top"
+ delegate: appDelegate
+ path: Path {
+ objectName: "path"
+ startX: pathView.width / 2 // startX: 400 <- this works as expected
+ startY: 300
+ PathLine { x: 400; y: 120 }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 0e3a74d..c32e9cc 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -77,6 +77,7 @@ private slots:
void pathChanges();
void componentChanges();
void modelChanges();
+ void pathUpdateOnStartChanged();
private:
@@ -672,6 +673,28 @@ void tst_QDeclarativePathView::modelChanges()
delete canvas;
}
+void tst_QDeclarativePathView::pathUpdateOnStartChanged()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdateOnStartChanged.qml"));
+
+ QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView");
+ QVERIFY(pathView);
+
+ QDeclarativePath *path = canvas->rootObject()->findChild<QDeclarativePath*>("path");
+ QVERIFY(path);
+ QCOMPARE(path->startX(), 400.0);
+ QCOMPARE(path->startY(), 300.0);
+
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(pathView, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->x(), path->startX() - item->width() / 2.0);
+ QCOMPARE(item->y(), path->startY() - item->height() / 2.0);
+
+ delete canvas;
+}
+
QDeclarativeView *tst_QDeclarativePathView::createView()
{
QDeclarativeView *canvas = new QDeclarativeView(0);