diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-15 23:09:31 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-15 23:09:31 (GMT) |
commit | 5aa1cbcdacd19b2e526e358eddac1b7d55a994b5 (patch) | |
tree | 4aba78405e3d98081662fcb934f673acd1b79d42 /tests/auto/qdiriterator | |
parent | 8592bcc80b7ec245b485fa54f8bd41c4484e93e0 (diff) | |
parent | 7e4a9187bb11b794e45d95d2e9fae026d6b0d07d (diff) | |
download | Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.zip Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.tar.gz Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.tar.bz2 |
Merge remote branch 'origin/4.8' into qa-review-master
Conflicts:
tests/auto/qaccessibility/tst_qaccessibility.cpp
tests/auto/qsslsocket/tst_qsslsocket.cpp
Diffstat (limited to 'tests/auto/qdiriterator')
-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" |