summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdiriterator/tst_qdiriterator.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-07-17 18:40:01 +0200
committerJoão Abecasis <joao@abecasis.name>2009-07-17 19:05:04 +0200
commitc70fba2e0c2e00171baa46bbb0bb2e6ba0115ec6 (patch)
tree49e4ca5ed7bf93cf74a84fec88127851fdc3d6b3 /tests/auto/qdiriterator/tst_qdiriterator.cpp
parent079f46af1a5821f981fcb53bf7484885f18b5b86 (diff)
Test case for QDirIterator regression introduced in 4.5.0
Task-number: 258230 Reviewed-by: Olivier Goffart
Diffstat (limited to 'tests/auto/qdiriterator/tst_qdiriterator.cpp')
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp
index e916e8bc8b..2d5758e99e 100644
--- a/tests/auto/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp
@@ -183,17 +183,28 @@ void tst_QDirIterator::iterateRelativeDirectory()
QFETCH(QStringList, entries);
QDirIterator it(dirName, nameFilters, filters, flags);
- QStringList iteratorList;
- while (it.hasNext())
- iteratorList << it.next();
-
- // The order of QDirIterator returning items differs on some platforms.
- // Thus it is not guaranteed that all paths will be returned relative
- // and we need to assure we have two valid StringLists to compare. So
- // we make all entries absolute for comparison.
QStringList list;
- foreach(QString item, iteratorList)
- list.append(QFileInfo(item).canonicalFilePath());
+ while (it.hasNext()) {
+ QString next = it.next();
+
+ QString fileName = it.fileName();
+ QString filePath = it.filePath();
+ QString path = it.path();
+
+ QFileInfo info = it.fileInfo();
+
+ QCOMPARE(path, dirName);
+ QCOMPARE(next, filePath);
+
+ QCOMPARE(info, QFileInfo(next));
+ QCOMPARE(fileName, info.fileName());
+ QCOMPARE(filePath, info.filePath());
+
+ // Using canonical file paths for final comparison
+ list << info.canonicalFilePath();
+ }
+
+ // The order of items returned by QDirIterator is not guaranteed.
list.sort();
QStringList sortedEntries;