summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-07-17 16:40:01 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-07-17 17:05:04 (GMT)
commitc70fba2e0c2e00171baa46bbb0bb2e6ba0115ec6 (patch)
tree49e4ca5ed7bf93cf74a84fec88127851fdc3d6b3 /tests
parent079f46af1a5821f981fcb53bf7484885f18b5b86 (diff)
downloadQt-c70fba2e0c2e00171baa46bbb0bb2e6ba0115ec6.zip
Qt-c70fba2e0c2e00171baa46bbb0bb2e6ba0115ec6.tar.gz
Qt-c70fba2e0c2e00171baa46bbb0bb2e6ba0115ec6.tar.bz2
Test case for QDirIterator regression introduced in 4.5.0
Task-number: 258230 Reviewed-by: Olivier Goffart
Diffstat (limited to 'tests')
-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 e916e8b..2d5758e 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;