diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-07 13:13:08 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-07 13:14:27 (GMT) |
commit | 7c8980ee041e874a6c430f01b2daff4955517b03 (patch) | |
tree | aa19249a7fb469176fb22adfa9a1b702ae3be6c0 /tests/auto/qdiriterator/tst_qdiriterator.cpp | |
parent | 8031eada2f81963865390b4d899631b09d4ca6f3 (diff) | |
parent | a05f73499a187c67a394893e2cc74516ccbc46f5 (diff) | |
download | Qt-7c8980ee041e874a6c430f01b2daff4955517b03.zip Qt-7c8980ee041e874a6c430f01b2daff4955517b03.tar.gz Qt-7c8980ee041e874a6c430f01b2daff4955517b03.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
src/gui/text/qfontengine_mac.mm
tests/auto/qdiriterator/tst_qdiriterator.cpp
Diffstat (limited to 'tests/auto/qdiriterator/tst_qdiriterator.cpp')
-rw-r--r-- | tests/auto/qdiriterator/tst_qdiriterator.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp index bdf0c3b..3691a90 100644 --- a/tests/auto/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp @@ -126,6 +126,7 @@ private slots: void uncPaths_data(); void uncPaths(); #endif + void qtbug15421_hiddenDirs_hiddenFiles(); }; tst_QDirIterator::tst_QDirIterator() @@ -173,6 +174,20 @@ tst_QDirIterator::tst_QDirIterator() createLink("nothing", "entrylist/brokenlink.lnk"); # endif #endif + + createDirectory("qtbug15421_hiddenDirs_hiddenFiles"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/normalFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenFile"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/normalFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenFile"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/normalDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenDirectory"); } tst_QDirIterator::~tst_QDirIterator() @@ -578,6 +593,46 @@ void tst_QDirIterator::uncPaths() } #endif +void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() +{ + // In Unix it is easy to create hidden files, but in Windows it requires + // a special call since hidden files need to be "marked" while in Unix + // anything starting by a '.' is a hidden file. + // For that reason this test is not run in Windows. +#if defined Q_OS_WIN || Q_OS_WINCE + QSKIP("To create hidden files a special call is required in Windows.", SkipAll); +#else + // Only files + { + int matches = 0; + int failures = 0; + QDirIterator di("qtbug15421_hiddenDirs_hiddenFiles", QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (di.hasNext()) { + ++matches; + QString filename = di.next(); + if (QFileInfo(filename).isDir()) + ++failures; // search was only supposed to find files + } + QCOMPARE(matches, 6); + QCOMPARE(failures, 0); + } + // Only directories + { + int matches = 0; + int failures = 0; + QDirIterator di("qtbug15421_hiddenDirs_hiddenFiles", QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (di.hasNext()) { + ++matches; + QString filename = di.next(); + if (!QFileInfo(filename).isDir()) + ++failures; // search was only supposed to find files + } + QCOMPARE(matches, 6); + QCOMPARE(failures, 0); + } +#endif // Q_OS_WIN || Q_OS_WINCE +} + QTEST_MAIN(tst_QDirIterator) #include "tst_qdiriterator.moc" |