summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qfile')
-rw-r--r--tests/auto/qfile/test/test.pro42
-rw-r--r--tests/auto/qfile/tst_qfile.cpp66
2 files changed, 73 insertions, 35 deletions
diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro
index 8d26f5e..80102f0 100644
--- a/tests/auto/qfile/test/test.pro
+++ b/tests/auto/qfile/test/test.pro
@@ -1,20 +1,26 @@
load(qttest_p4)
SOURCES += ../tst_qfile.cpp
+wince*|symbian:{
+ QT = core gui
+ files.sources += ..\dosfile.txt ..\noendofline.txt ..\testfile.txt \
+ ..\testlog.txt ..\two.dots.file ..\tst_qfile.cpp \
+ ..\Makefile ..\forCopying.txt ..\forRenaming.txt
+ files.path = .
+ resour.sources += ..\resources\file1.ext1
+ resour.path = resources
+
+ DEPLOYMENT = files resour
+}
+
wince*:{
-QT = core gui
-files.sources += ..\dosfile.txt ..\noendofline.txt ..\testfile.txt \
- ..\testlog.txt ..\two.dots.file ..\tst_qfile.cpp \
- ..\Makefile ..\forCopying.txt ..\forRenaming.txt
-files.path = .
-resour.sources += ..\resources
-resour.path = .
-
-DEPLOYMENT = files resour
-DEFINES += SRCDIR=\\\"\\\"
+ DEFINES += SRCDIR=\\\"\\\"
+} symbian: {
+ # don't define SRCDIR at all
+ TARGET.EPOCHEAPSIZE = 0x100000 0x3000000
} else {
-QT = core network
-DEFINES += SRCDIR=\\\"$$PWD/../\\\"
+ QT = core network
+ DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
@@ -22,12 +28,12 @@ RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
TARGET = ../tst_qfile
win32 {
- CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qfile
-} else {
- TARGET = ../../release/tst_qfile
- }
- LIBS+=-lole32 -luuid
+ CONFIG(debug, debug|release) {
+ TARGET = ../../debug/tst_qfile
+ } else {
+ TARGET = ../../release/tst_qfile
+ }
+ LIBS+=-lole32 -luuid
}
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 9ee4d7c..597343f 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -50,7 +50,7 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
#include <QHostInfo>
#endif
#include <QProcess>
@@ -73,9 +73,12 @@
#endif
#include <stdio.h>
-
#include "../network-settings.h"
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
Q_DECLARE_METATYPE(QFile::FileError)
//TESTED_CLASS=
@@ -373,7 +376,10 @@ void tst_QFile::open()
QFile f( filename );
QFETCH( bool, ok );
-
+#if defined(Q_OS_SYMBIAN)
+ if (qstrcmp(QTest::currentDataTag(), "noreadfile") == 0)
+ QSKIP("Symbian does not support non-readable files", SkipSingle);
+#endif
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort);
#endif
@@ -585,8 +591,8 @@ void tst_QFile::readLineNullInLine()
void tst_QFile::readAllStdin()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Currently no stdin/out supported for Windows CE or Symbian", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
@@ -611,8 +617,8 @@ void tst_QFile::readAllStdin()
void tst_QFile::readLineStdin()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Currently no stdin/out supported for Windows CE or Symbian", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
@@ -654,7 +660,7 @@ void tst_QFile::readLineStdin()
void tst_QFile::readLineStdin_lineByLine()
{
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
@@ -782,7 +788,7 @@ void tst_QFile::ungetChar()
void tst_QFile::invalidFile_data()
{
QTest::addColumn<QString>("fileName");
-#ifndef Q_WS_WIN
+#if !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN)
QTest::newRow( "x11" ) << QString( "qwe//" );
#else
QTest::newRow( "colon1" ) << QString( "fail:invalid" );
@@ -852,6 +858,10 @@ void tst_QFile::permissions_data()
void tst_QFile::permissions()
{
+#if defined(Q_OS_SYMBIAN)
+ if (qstrcmp(QTest::currentDataTag(), "data0") == 0)
+ QSKIP("Symbian does not have execution permissions", SkipSingle);
+#endif
QFETCH(QString, file);
QFETCH(uint, perms);
QFETCH(bool, expected);
@@ -909,7 +919,11 @@ void tst_QFile::copyShouldntOverwrite()
QFile::remove("tst_qfile.cpy");
QFile file(SRCDIR "tst_qfile.cpp");
QVERIFY(file.copy("tst_qfile.cpy"));
+#if defined(Q_OS_SYMBIAN)
+ bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteUser);
+#else
bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteOther);
+#endif
QVERIFY(ok);
QVERIFY(!file.copy("tst_qfile.cpy"));
QFile::remove("tst_qfile.cpy");
@@ -1034,6 +1048,9 @@ void tst_QFile::link()
void tst_QFile::linkToDir()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian does not support linking to directories", SkipAll);
+#endif
QFile::remove("myLinkToDir.lnk");
QDir dir;
dir.mkdir("myDir");
@@ -1069,8 +1086,7 @@ void tst_QFile::absolutePathLinkToRelativePath()
#else
QVERIFY(QFile::link("myDir/test.txt", "myDir/myLink.lnk"));
#endif
-
- QEXPECT_FAIL("", "Symlinking using relative paths is currently different on Windows and Unix", Continue);
+ QEXPECT_FAIL("", "Symlinking using relative paths is currently different on Windows and Unix/Symbian", Continue);
QCOMPARE(QFileInfo(QFile(QFileInfo("myDir/myLink.lnk").absoluteFilePath()).symLinkTarget()).absoluteFilePath(),
QFileInfo("myDir/test.txt").absoluteFilePath());
@@ -1083,7 +1099,15 @@ void tst_QFile::readBrokenLink()
{
QFile::remove("myLink2.lnk");
QFileInfo info1("file12");
+#if defined(Q_OS_SYMBIAN)
+ // In Symbian can't link to nonexisting file directly, so create the file temporarily
+ QFile tempFile("file12");
+ tempFile.open(QIODevice::WriteOnly);
+ tempFile.link("myLink2.lnk");
+ tempFile.remove();
+#else
QVERIFY(QFile::link("file12", "myLink2.lnk"));
+#endif
QFileInfo info2("myLink2.lnk");
QVERIFY(info2.isSymLink());
#ifdef Q_OS_WIN // on windows links are alway absolute
@@ -1307,7 +1331,7 @@ void tst_QFile::bufferedRead()
void tst_QFile::isSequential()
{
-#if defined (Q_OS_WIN)
+#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QSKIP("Unix only test.", SkipAll);
#endif
@@ -1631,6 +1655,10 @@ void tst_QFile::longFileName()
QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort);
QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort);
#endif
+#elif defined(Q_OS_SYMBIAN)
+ if (qstrcmp(QTest::currentDataTag(), "244 chars") == 0 ||
+ qstrcmp(QTest::currentDataTag(), "244 chars to absolutepath") == 0 )
+ QSKIP("Symbian does not support path names exceeding 256 characters", SkipSingle);
#endif
QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
QTextStream ts(&file);
@@ -1901,8 +1929,8 @@ void tst_QFile::writeLargeDataBlock()
// Generate a 64MB array with well defined contents.
QByteArray array;
-#if defined(Q_OS_WINCE)
- int resizeSize = 1024 * 1024; // WinCE does not have much space
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ int resizeSize = 1024 * 1024; // WinCE and Symbian do not have much space
#else
int resizeSize = 64 * 1024 * 1024;
#endif
@@ -2039,7 +2067,7 @@ void tst_QFile::rename_data()
QTest::newRow("a -> .") << QString("a") << QString(".") << false;
QTest::newRow("renamefile -> renamefile") << QString("renamefile") << QString("renamefile") << false;
QTest::newRow("renamefile -> Makefile") << QString("renamefile") << QString("Makefile") << false;
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QTest::newRow("renamefile -> /etc/renamefile") << QString("renamefile") << QString("/etc/renamefile") << false;
#endif
QTest::newRow("renamefile -> renamedfile") << QString("renamefile") << QString("renamedfile") << true;
@@ -2249,7 +2277,7 @@ void tst_QFile::readEof_data()
QTest::newRow("buffered") << SRCDIR "testfile.txt" << 0;
QTest::newRow("unbuffered") << SRCDIR "testfile.txt" << int(QIODevice::Unbuffered);
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QTest::newRow("sequential,buffered") << "/dev/null" << 0;
QTest::newRow("sequential,unbuffered") << "/dev/null" << int(QIODevice::Unbuffered);
#endif
@@ -2432,9 +2460,11 @@ void tst_QFile::map()
QVERIFY(file.open(QFile::ReadWrite));
memory = file.map(offset, size);
if (error != QFile::NoError) {
+
QVERIFY(file.error() != QFile::NoError);
return;
}
+
QCOMPARE(file.error(), error);
QVERIFY(memory);
memory[0] = 'Q';
@@ -2471,6 +2501,8 @@ void tst_QFile::map()
file.close();
+ // No permissions for user makes no sense in Symbian
+#if !defined(Q_OS_SYMBIAN)
// Change permissions on a file, just to confirm it would fail
QFile::Permissions originalPermissions = file.permissions();
QVERIFY(file.setPermissions(QFile::ReadOther));
@@ -2479,7 +2511,7 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::PermissionsError);
QVERIFY(!memory);
QVERIFY(file.setPermissions(originalPermissions));
-
+#endif
QVERIFY(file.remove());
}