diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-08-06 16:07:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-06 18:26:47 +0200 |
commit | f1b9ba8c6ee6b991ef4e513bc4f39045fd55d1e6 (patch) | |
tree | cd587156a07344e98aca0cd1511075fe272bfec5 /tests/auto/qml | |
parent | 27deff6d2b5a9eb1d98cd7b377ab934a35086664 (diff) | |
parent | 1d3b9db5b54d8ae99c6b149c8d3d91eda19b5838 (diff) |
Merge "Merge branch 'stable' into dev" into refs/staging/dev
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index cc55fd721c..e35a9f7c7a 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -89,6 +89,7 @@ private slots: void showFiles(); void resetFiltering(); void refresh(); + void cdUp(); #if defined (Q_OS_WIN) && !defined (Q_OS_WINCE) // WinCE does not have drive concept, so lets execute this test only on desktop Windows. void changeDrive(); @@ -219,6 +220,33 @@ void tst_qquickfolderlistmodel::refresh() QTRY_COMPARE(removeEnd, count-1); // wait for refresh } +void tst_qquickfolderlistmodel::cdUp() +{ + enum { maxIterations = 50 }; + QQmlComponent component(&engine, testFileUrl("basic.qml")); + checkNoErrors(component); + + QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); + QVERIFY(flm != 0); + const QUrl startFolder = flm->property("folder").toUrl(); + QVERIFY(startFolder.isValid()); + + // QTBUG-32139: Ensure navigating upwards terminates cleanly and does not + // return invalid Urls like "file:". + for (int i = 0; ; ++i) { + const QVariant folderV = flm->property("parentFolder"); + const QUrl folder = folderV.toUrl(); + if (!folder.isValid()) + break; + QVERIFY(folder.toString() != QLatin1String("file:")); + QVERIFY2(i < maxIterations, + qPrintable(QString::fromLatin1("Unable to reach root after %1 iterations starting from %2, stuck at %3") + .arg(maxIterations).arg(QDir::toNativeSeparators(startFolder.toLocalFile()), + QDir::toNativeSeparators(folder.toLocalFile())))); + flm->setProperty("folder", folderV); + } +} + #if defined (Q_OS_WIN) && !defined (Q_OS_WINCE) void tst_qquickfolderlistmodel::changeDrive() { |