diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-08-05 10:42:21 +0200 |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-08-05 10:42:21 +0200 |
commit | 1d3b9db5b54d8ae99c6b149c8d3d91eda19b5838 (patch) | |
tree | 9ffbf9d6d2ed6b0aef6155215767c56655ff405b /tests/auto/qml/qquickfolderlistmodel | |
parent | 45792359f25813af18b7416e4c18737ed4b20bff (diff) | |
parent | 0316506d9ddbc3ca9f26f880b9e7fb5d5b0fec36 (diff) |
Merge branch 'stable' into dev
Conflicts:
.qmake.conf
Change-Id: I06f79bcbde13c7b12905492a17dbcbb4a594e557
Diffstat (limited to 'tests/auto/qml/qquickfolderlistmodel')
-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 9308bc6f40..b2a63f064c 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -74,6 +74,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(); @@ -203,6 +204,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() { |