diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-08-24 00:25:13 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-08-24 00:27:34 (GMT) |
commit | 35db70bf1c046f880861bbf4f48b8741ced405c4 (patch) | |
tree | be12bd794d3d9c6265bd17e123ab27766b295d2c /tests/auto/declarative/qdeclarativepathview | |
parent | 0d2e88f417275a85b4e22a274fa04bc80742382e (diff) | |
download | Qt-35db70bf1c046f880861bbf4f48b8741ced405c4.zip Qt-35db70bf1c046f880861bbf4f48b8741ced405c4.tar.gz Qt-35db70bf1c046f880861bbf4f48b8741ced405c4.tar.bz2 |
Fix PathView when setting an empty model that is later filled.
Task-number: QTBUG-13017
Reviewed-by: Martin Jones
Diffstat (limited to 'tests/auto/declarative/qdeclarativepathview')
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 24 |
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml b/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml new file mode 100644 index 0000000..177c405 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +PathView { + model: emptyModel +} diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index fdbb16d..e2ccfd2 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -84,7 +84,7 @@ private slots: void modelChanges(); void pathUpdateOnStartChanged(); void package(); - + void emptyModel(); private: QDeclarativeView *createView(); @@ -755,6 +755,28 @@ void tst_QDeclarativePathView::package() delete canvas; } +//QTBUG-13017 +void tst_QDeclarativePathView::emptyModel() +{ + QDeclarativeView *canvas = createView(); + + QStringListModel model; + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("emptyModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/emptymodel.qml")); + qApp->processEvents(); + + QDeclarativePathView *pathview = qobject_cast<QDeclarativePathView*>(canvas->rootObject()); + QVERIFY(pathview != 0); + + QCOMPARE(pathview->offset(), qreal(0.0)); + + delete canvas; +} + + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); |