summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfileinfo
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qfileinfo')
-rw-r--r--tests/auto/qfileinfo/qfileinfo.pro3
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp53
2 files changed, 43 insertions, 13 deletions
diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro
index 91b630d..d46a83b 100644
--- a/tests/auto/qfileinfo/qfileinfo.pro
+++ b/tests/auto/qfileinfo/qfileinfo.pro
@@ -6,10 +6,11 @@ QT = core
RESOURCES += qfileinfo.qrc
-wince*: {
+wince*:|symbian*: {
deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp
res.sources = resources\file1 resources\file1.ext1 resources\file1.ext1.ext2
res.path = resources
DEPLOYMENT = deploy res
}
+symbian:TARGET.CAPABILITY=AllFiles
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index e5831fd..ec58b6c 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -170,6 +170,7 @@ tst_QFileInfo::~tst_QFileInfo()
QFile::remove("brokenlink.lnk");
QFile::remove("link.lnk");
QFile::remove("file1");
+ QFile::remove("dummyfile");
}
// Testing get/set functions
@@ -238,6 +239,7 @@ void tst_QFileInfo::copy()
tst_QFileInfo::tst_QFileInfo()
{
+ Q_SET_DEFAULT_IAP
}
void tst_QFileInfo::isFile_data()
@@ -265,6 +267,7 @@ void tst_QFileInfo::isDir_data()
{
// create a broken symlink
QFile::remove("brokenlink.lnk");
+ QFile::remove("dummyfile");
QFile file3("dummyfile");
file3.open(QIODevice::WriteOnly);
if (file3.link("brokenlink.lnk")) {
@@ -286,10 +289,12 @@ void tst_QFileInfo::isDir_data()
QTest::newRow("broken link") << "brokenlink.lnk" << false;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("drive 1") << "c:" << true;
QTest::newRow("drive 2") << "c:/" << true;
//QTest::newRow("drive 2") << "t:s" << false;
+#endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
@@ -313,7 +318,6 @@ void tst_QFileInfo::isRoot_data()
{
QTest::addColumn<QString>("path");
QTest::addColumn<bool>("expected");
-
QTest::newRow("data0") << QDir::currentPath() << false;
QTest::newRow("data1") << "/" << true;
QTest::newRow("data2") << ":/tst_qfileinfo/resources/" << false;
@@ -321,10 +325,11 @@ void tst_QFileInfo::isRoot_data()
QTest::newRow("simple dir") << "resources" << false;
QTest::newRow("simple dir with slash") << "resources/" << false;
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("drive 1") << "c:" << false;
QTest::newRow("drive 2") << "c:/" << true;
+#endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << false;
@@ -392,7 +397,7 @@ void tst_QFileInfo::absolutePath_data()
QTest::addColumn<QString>("filename");
QString drivePrefix;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
drivePrefix = QDir::currentPath().left(2);
#endif
QTest::newRow("0") << "/machine/share/dir1/" << drivePrefix + "/machine/share/dir1" << "";
@@ -427,7 +432,7 @@ void tst_QFileInfo::absFilePath_data()
QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QString curr = QDir::currentPath();
curr.remove(0, 2); // Make it a absolute path with no drive specifier: \depot\qt-4.2\tests\auto\qfileinfo
QTest::newRow(".") << curr << QDir::currentPath();
@@ -486,6 +491,9 @@ void tst_QFileInfo::canonicalFilePath()
if (file.link(link)) {
QFileInfo info1("tst_qfileinfo.cpp");
QFileInfo info2(link + QDir::separator() + "tst_qfileinfo.cpp");
+
+ QVERIFY2(info1.exists(), "If this fails, one reason might be the test system has failed to copy the files.");
+ QVERIFY2(info2.exists(), "If this fails, one reason might be the test system has failed to copy the files.");
QCOMPARE(info1.canonicalFilePath(), info2.canonicalFilePath());
QFileInfo info3(link + QDir::separator() + "link.lnk");
@@ -518,7 +526,7 @@ void tst_QFileInfo::fileName_data()
QTest::newRow("relativeFile") << "tmp.txt" << "tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << "tmp.txt";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "tmp.txt";
#else
QTest::newRow("absFilePath") << "/home/andy/tmp.txt" << "tmp.txt";
@@ -716,8 +724,9 @@ void tst_QFileInfo::permission()
QFETCH(QString, file);
QFETCH(int, perms);
QFETCH(bool, expected);
+ QEXPECT_FAIL("data0", "No user based rights in Symbian OS - SOS needs platform security tests instead", Abort);
QFileInfo fi(file);
- QCOMPARE(fi.permission((QFile::Permissions)perms), expected);
+ QCOMPARE(fi.permission(QFile::Permissions(perms)), expected);
}
void tst_QFileInfo::size_data()
@@ -767,7 +776,7 @@ void tst_QFileInfo::compare_data()
<< QDir::currentPath() + QString::fromLatin1("/tst_qfileinfo.cpp") << true;
QTest::newRow("casesense1") << QString::fromLatin1("tst_qfileInfo.cpp")
<< QDir::currentPath() + QString::fromLatin1("/tst_qfileinfo.cpp")
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
<< true;
#else
<< false;
@@ -788,7 +797,7 @@ void tst_QFileInfo::consistent_data()
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("expected");
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QTest::newRow("slashes") << QString::fromLatin1("\\a\\a\\a\\a") << QString::fromLatin1("/a/a/a/a");
#endif
QTest::newRow("ending slash") << QString::fromLatin1("/a/somedir/") << QString::fromLatin1("/a/somedir/");
@@ -839,6 +848,9 @@ void tst_QFileInfo::fileTimes()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("longfile", "No long filenames on WinCE", Abort);
QEXPECT_FAIL("longfile absolutepath", "No long filenames on WinCE", Abort);
+#elif defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("longfile", "Maximum total filepath cannot exceed 256 characters in Symbian", Abort);
+ QEXPECT_FAIL("longfile absolutepath", "Maximum total filepath cannot exceed 256 characters in Symbian", Abort);
#endif
QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
QTextStream ts(&file);
@@ -882,6 +894,9 @@ void tst_QFileInfo::fileTimes()
#ifdef Q_OS_WINCE
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
#endif
+#ifdef Q_OS_SYMBIAN
+ QEXPECT_FAIL("simple", "Symbian implementation of stat doesn't return read time right", Abort);
+#endif
QVERIFY(fileInfo.lastRead() > beforeRead);
QVERIFY(fileInfo.lastModified() > beforeWrite);
QVERIFY(fileInfo.lastModified() < beforeRead);
@@ -935,6 +950,7 @@ void tst_QFileInfo::isSymLink()
{
QFile::remove("link.lnk");
QFile::remove("brokenlink.lnk");
+ QFile::remove("dummyfile");
QFileInfo info1("tst_qfileinfo.cpp");
QVERIFY( !info1.isSymLink() );
@@ -948,11 +964,13 @@ void tst_QFileInfo::isSymLink()
QFile file3("dummyfile");
file3.open(QIODevice::WriteOnly);
if (file3.link("brokenlink.lnk")) {
+ // In Symbian ARMV5 builds, this will panic with KERN-EXEC 3 inside OpenC fclose() call
+ // in QFSFileEnginePrivate::closeFdFh(), if "dummyfile" exists prior calling to isSymLink
+ // and is not deleted at the beginning of isSymLink.
file3.remove();
QFileInfo info3("brokenlink.lnk");
QVERIFY( info3.isSymLink() );
}
-
}
void tst_QFileInfo::isHidden_data()
@@ -1064,6 +1082,10 @@ void tst_QFileInfo::brokenShortcut()
#ifdef Q_OS_UNIX
void tst_QFileInfo::isWritable()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP("This is a UNIX only test - no passwd in Symbian OS", SkipAll);
+#endif
+
if (::getuid() == 0)
QVERIFY(QFileInfo("/etc/passwd").isWritable());
else
@@ -1073,10 +1095,17 @@ void tst_QFileInfo::isWritable()
void tst_QFileInfo::isExecutable()
{
+#ifdef Q_OS_SYMBIAN
+# if defined(Q_CC_NOKIAX86)
+ QSKIP("Impossible to implement reading/touching of application binaries in Symbian emulator", SkipAll);
+# endif
+ QString appPath = "c:/sys/bin/tst_qfileinfo.exe";
+#else
QString appPath = QCoreApplication::applicationDirPath();
appPath += "/tst_qfileinfo";
-#if defined(Q_OS_WIN)
+# if defined(Q_OS_WIN)
appPath += ".exe";
+# endif
#endif
QFileInfo fi(appPath);
QCOMPARE(fi.isExecutable(), true);