summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <dangelog@gmail.com>2012-04-01 18:47:56 +0100
committerQt by Nokia <qt-info@nokia.com>2012-04-07 19:45:39 +0200
commite6e4456de0506aa9896b687dc858eb9ae03d8917 (patch)
treec8e5ff10dc6d4b8420b4a6ba6e4f40182746916b /tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
parent7ae76153cb53230c426ff26e545e4e98b27ffb59 (diff)
QFileSystemModel: fix sorting
When sorting a model recursively, the children of a QFileSystemNode are extracted from their parent in a QHash order; then filtered, then sorted (using a stable sort) depending on the sorting column. This means that the order of the children comparing to equal for the chosen sort are shown in the order they were picked from the iteration on the QHash, which isn't reliable at all. Moreover, the criteria used in QFileSystemModelSorter for sorting are too loose: when sorting by any column but the name, if the result is "equality", then the file names should be used to determine the sort order. This patch removes the stable sort in favour of a full sort, and fixes the criteria of soring inside QFileSystemModelSorter. Change-Id: Idd9aece22f2ebbe77ec40d372b43cde4c200ff38 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 1a3d083864..5eaf8b1b2c 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -863,7 +863,7 @@ void tst_QFileSystemModel::sort()
QTest::qWait(500);
QModelIndex parent = myModel->index(dirPath, 0);
QList<QString> expectedOrder;
- expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + "." << dirPath + QChar('/') + "..";
+ expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + ".." << dirPath + QChar('/') + ".";
//File dialog Mode means sub trees are not sorted, only the current root
if (fileDialogMode) {
// FIXME: we were only able to disableRecursiveSort in developer builds, so we can only