diff options
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); |