diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-09 21:27:29 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-09 21:27:30 +0100 |
commit | 9bee6712fc7fd4c8083b4c2c9b1eb0c54d4725dd (patch) | |
tree | 91c2306fc1c8b90fe81f678bbf3618084641c9e3 /tests/auto/widgets/dialogs | |
parent | 50deb8cf70f61e21fb0c35182341477af11adbc1 (diff) | |
parent | a5ad605dfec2ab4e921d5c5843b23916ed5ae3bf (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I840849c072075a69819eb185b20bc42c3de0f825
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r-- | tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 979d5c632e..71efe1d59a 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -43,6 +43,7 @@ #if defined(Q_OS_WIN) # include <qt_windows.h> // for SetFileAttributes #endif +#include <private/qfilesystemengine_p.h> #include <algorithm> @@ -883,6 +884,18 @@ void tst_QFileSystemModel::deleteFile() QVERIFY(!newFile.exists()); } +static QString flipCase(QString s) +{ + for (int i = 0, size = s.size(); i < size; ++i) { + const QChar c = s.at(i); + if (c.isUpper()) + s[i] = c.toLower(); + else if (c.isLower()) + s[i] = c.toUpper(); + } + return s; +} + void tst_QFileSystemModel::caseSensitivity() { QString tmp = flatDirTestPath; @@ -890,9 +903,23 @@ void tst_QFileSystemModel::caseSensitivity() files << "a" << "c" << "C"; QVERIFY(createFiles(tmp, files)); QModelIndex root = model->index(tmp); + QStringList paths; + QModelIndexList indexes; QCOMPARE(model->rowCount(root), 0); for (int i = 0; i < files.count(); ++i) { - QVERIFY(model->index(tmp + '/' + files.at(i)).isValid()); + const QString path = tmp + '/' + files.at(i); + const QModelIndex index = model->index(path); + QVERIFY(index.isValid()); + paths.append(path); + indexes.append(index); + } + + if (!QFileSystemEngine::isCaseSensitive()) { + // QTBUG-31103, QTBUG-64147: Verify that files can be accessed by paths with fLipPeD case. + for (int i = 0; i < paths.count(); ++i) { + const QModelIndex flippedCaseIndex = model->index(flipCase(paths.at(i))); + QCOMPARE(indexes.at(i), flippedCaseIndex); + } } } |