summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index a388f0a..63bc90c 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -823,7 +823,7 @@ void tst_QFileSystemModel::sort()
out2 << "The magic number is : " << 49 << " but i write some stuff in the file \n";
tempFile2.close();
- myModel->setRootPath(QDir::rootPath());
+ myModel->setRootPath("");
myModel->setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
tree->setSortingEnabled(true);
tree->setModel(myModel);
@@ -846,11 +846,22 @@ void tst_QFileSystemModel::sort()
tree->expand(myModel->index(dirPath, 0));
QTest::qWait(500);
QModelIndex parent = myModel->index(dirPath, 0);
+ QList<QString> expectedOrder;
+ expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + "." << dirPath + QChar('/') + "..";
//File dialog Mode means sub trees are not sorted, only the current root
- if (fileDialogMode)
- QVERIFY(dirPath + QChar('/') + myModel->index(0, 1, parent).data(QFileSystemModel::FileNameRole).toString() != tempFile2.fileName());
- else
- QCOMPARE(dirPath + QChar('/') + myModel->index(0, 1, parent).data(QFileSystemModel::FileNameRole).toString(), tempFile2.fileName());
+ if (fileDialogMode) {
+ QList<QString> actualRows;
+ for(int i = 0; i < myModel->rowCount(parent); ++i)
+ {
+ actualRows << dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString();
+ }
+ QVERIFY(actualRows != expectedOrder);
+ } else {
+ for(int i = 0; i < myModel->rowCount(parent); ++i)
+ {
+ QVERIFY(dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString() == expectedOrder.at(i));
+ }
+ }
delete tree;
delete myModel;