summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativepathview
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-08-24 00:25:13 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-08-24 00:27:34 (GMT)
commit35db70bf1c046f880861bbf4f48b8741ced405c4 (patch)
treebe12bd794d3d9c6265bd17e123ab27766b295d2c /tests/auto/declarative/qdeclarativepathview
parent0d2e88f417275a85b4e22a274fa04bc80742382e (diff)
downloadQt-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.qml5
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp24
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);