summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdir
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 08:33:52 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-04 09:02:17 (GMT)
commit4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1 (patch)
treeb34985c5716d98f01b9f36fd4a98f2ac9710099f /tests/auto/qdir
parenta0df97c03f26a38af17a42fb44ad6910536c8857 (diff)
parent2076f150995e541308b1d8da936b3e12ab68b886 (diff)
downloadQt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.zip
Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.gz
Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: config.tests/unix/openssl/openssl.pri demos/embedded/embedded.pro examples/itemviews/chart/chart.pro examples/network/network.pro examples/painting/painterpaths/painterpaths.pro examples/threads/mandelbrot/mandelbrot.pro qmake/project.cpp src/3rdparty/libtiff/libtiff/tif_config.h src/corelib/arch/arch.pri src/corelib/global/qglobal.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qcore_unix_p.h src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/corelib/tools/qsharedpointer_impl.h src/corelib/tools/tools.pri src/gui/kernel/qaction.h src/gui/kernel/qapplication.cpp src/gui/painting/qregion.h src/gui/widgets/qlineedit.cpp src/gui/widgets/qlineedit_p.h src/network/socket/qnativesocketengine_unix.cpp tests/auto/qdir/tst_qdir.cpp tests/auto/qdiriterator/tst_qdiriterator.cpp tests/auto/qhttp/qhttp.pro tests/auto/qline/qline.pro tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qresourceengine/qresourceengine.pro tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qstring/qstring.pro tests/auto/qtcpsocket/qtcpsocket.pro tests/auto/qtcpsocket/tst_qtcpsocket.cpp
Diffstat (limited to 'tests/auto/qdir')
-rw-r--r--tests/auto/qdir/tst_qdir.cpp77
1 files changed, 49 insertions, 28 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index 771b0c6..60bb177 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -56,6 +56,10 @@
# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
#endif
+#if defined(Q_OS_VXWORKS)
+#define Q_NO_SYMLINKS
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -374,6 +378,20 @@ void tst_QDir::compare()
QVERIFY(dir == QDir::currentPath());
}
+static QStringList filterLinks(const QStringList &list)
+{
+#ifndef Q_NO_SYMLINKS
+ return list;
+#else
+ QStringList result;
+ foreach (QString str, list) {
+ if (!str.endsWith(QLatin1String(".lnk")))
+ result.append(str);
+ }
+ return result;
+#endif
+}
+
void tst_QDir::entryList_data()
{
QTest::addColumn<QString>("dirName"); // relative from current path or abs
@@ -415,94 +433,95 @@ void tst_QDir::entryList_data()
QTest::newRow("nofilter") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::Files") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Files) << int(QDir::Name)
- << QString("file,linktofile.lnk,writable").split(',');
+ << filterLinks(QString("file,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Dirs) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::Dirs | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Dirs | QDir::NoDotAndDotDot) << int(QDir::Name)
- << QString("directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString("directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::AllDirs") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::AllDirs | QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs | QDir::Dirs) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::AllDirs | QDir::Files") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs | QDir::Files) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::NoSymLinks) << int(QDir::Name)
- << QString(".,..,directory,file,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot) << int(QDir::Name)
- << QString("directory,file,writable").split(',');
+ << filterLinks(QString("directory,file,writable").split(','));
QTest::newRow("QDir::Files | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Files | QDir::NoSymLinks) << int(QDir::Name)
- << QString("file,writable").split(',');
+ << filterLinks(QString("file,writable").split(','));
QTest::newRow("QDir::Dirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Dirs | QDir::NoSymLinks) << int(QDir::Name)
- << QString(".,..,directory").split(',');
+ << filterLinks(QString(".,..,directory").split(','));
QTest::newRow("QDir::Drives | QDir::Files | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Drives | QDir::Files | QDir::NoDotAndDotDot) << int(QDir::Name)
- << QString("file,linktofile.lnk,writable").split(',');
+ << filterLinks(QString("file,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::System") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::System) << int(QDir::Name)
- << QStringList("brokenlink.lnk");
+ << filterLinks(QStringList("brokenlink.lnk"));
QTest::newRow("QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Hidden) << int(QDir::Name)
<< QStringList();
QTest::newRow("QDir::System | QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::System | QDir::Hidden) << int(QDir::Name)
- << QStringList("brokenlink.lnk");
+ << filterLinks(QStringList("brokenlink.lnk"));
QTest::newRow("QDir::AllDirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs | QDir::NoSymLinks) << int(QDir::Name)
- << QString(".,..,directory").split(',');
+ << filterLinks(QString(".,..,directory").split(','));
#ifdef QT3_SUPPORT
QTest::newRow("QDir::All | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::All | QDir::Hidden | QDir::System) << int(QDir::Name)
- << QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::All | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::All | QDir::Readable) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::All | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::All | QDir::Writable) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(','));
#else
QTest::newRow("QDir::AllEntries | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::Hidden | QDir::System) << int(QDir::Name)
- << QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::Readable) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::Writable) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(','));
#endif
QTest::newRow("Namefilters b*") << SRCDIR "entrylist/" << QStringList("d*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("directory").split(',');
+ << filterLinks(QString("directory").split(','));
QTest::newRow("Namefilters f*") << SRCDIR "entrylist/" << QStringList("f*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("file").split(',');
+ << filterLinks(QString("file").split(','));
QTest::newRow("Namefilters link*") << SRCDIR "entrylist/" << QStringList("link*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("linktodirectory.lnk,linktofile.lnk").split(',');
+ << filterLinks(QString("linktodirectory.lnk,linktofile.lnk").split(','));
QTest::newRow("Namefilters *to*") << SRCDIR "entrylist/" << QStringList("*to*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("directory,linktodirectory.lnk,linktofile.lnk").split(',');
+ << filterLinks(QString("directory,linktodirectory.lnk,linktofile.lnk").split(','));
QTest::newRow("Sorting QDir::Name") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("Sorting QDir::Name | QDir::Reversed") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Name | QDir::Reversed)
- << QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(',');
+ << filterLinks(QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(','));
+
QTest::newRow("Sorting QDir::Type") << SRCDIR "types/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Type)
<< QString(".,..,a,b,c,d,e,f,a.a,b.a,c.a,d.a,e.a,f.a,a.b,b.b,c.b,d.b,e.b,f.b,a.c,b.c,c.c,d.c,e.c,f.c").split(',');
@@ -687,6 +706,7 @@ void tst_QDir::entryListSimple()
void tst_QDir::entryListWithSymLinks()
{
+#ifndef Q_NO_SYMLINKS
QFile::remove("myLinkToDir.lnk");
QFile::remove("myLinkToFile.lnk");
QFile::remove("testfile.cpp");
@@ -728,6 +748,7 @@ void tst_QDir::entryListWithSymLinks()
QFile::remove("myLinkToFile.lnk");
QFile::remove("testfile.cpp");
dir.rmdir("myDir");
+#endif
}
void tst_QDir::canonicalPath_data()