summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdir/tst_qdir.cpp
diff options
context:
space:
mode:
authorRobert Griebl <rgriebl@trolltech.com>2008-07-30 21:14:24 (GMT)
committerRobert Griebl <rgriebl@trolltech.com>2009-07-29 08:50:20 (GMT)
commitd7b688870aead912690188b324d370b920a7a600 (patch)
treeaac6c19d222ca3bad65cfbb850483a647013c67a /tests/auto/qdir/tst_qdir.cpp
parente5262a0c29c743f2afd4ba249e8adff984c1ca83 (diff)
downloadQt-d7b688870aead912690188b324d370b920a7a600.zip
Qt-d7b688870aead912690188b324d370b920a7a600.tar.gz
Qt-d7b688870aead912690188b324d370b920a7a600.tar.bz2
Port of Qt to VxWorks
This makes Qt work on VxWorks 6.6+ in native (kernel) mode. * compiles with the WindRiver GNU toolchain (Linux only) * works with QWS (tested with the VNC driver only) * tested on PPC hardware and the x86 VxWorks simulator * no q3support, no phonon, no webkit * no QSharedMemory, no QSystemSemaphore, no QProcess * only one QApplication instance (flat address space) * filesystem support depends heavily on the quality of the native driver * QLibrary is just a dummy to make plugins work at all * qmake transparently creates VxWorks munching rules for static ctors * made auto-test cope with missing OS features A special note regarding the Q_FOREACH patch for dcc: when calling foreach(a,c) with c being a function returning a container, the compiler would generate 5 references to some labels (.LXXXX), which are not there (so the linker complains in the end). Seems like dcc doesn't really like the 'true ? 0 : <function call to get type>' statement Reviewed-By: Harald Fernengel
Diffstat (limited to 'tests/auto/qdir/tst_qdir.cpp')
-rw-r--r--tests/auto/qdir/tst_qdir.cpp77
1 files changed, 48 insertions, 29 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index e5b23ab..e900ed0 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -51,7 +51,9 @@
#include "../network-settings.h"
-
+#if defined(Q_OS_VXWORKS)
+#define Q_NO_SYMLINKS
+#endif
//TESTED_CLASS=
//TESTED_FILES=
@@ -370,6 +372,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
@@ -411,94 +427,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(',');
@@ -635,6 +652,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");
@@ -667,6 +685,7 @@ void tst_QDir::entryListWithSymLinks()
QFile::remove("myLinkToFile.lnk");
QFile::remove("testfile.cpp");
dir.rmdir("myDir");
+#endif
}
void tst_QDir::canonicalPath_data()