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 68f4c05..b51eff6 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
@@ -22,12 +28,12 @@ RESOURCES += ../qfile.qrc ../rename-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 98e1859..483e978 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=
@@ -365,7 +368,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
@@ -577,8 +583,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);
@@ -603,8 +609,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);
@@ -646,7 +652,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)
@@ -774,7 +780,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" );
@@ -844,6 +850,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);
@@ -901,7 +911,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");
@@ -998,6 +1012,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");
@@ -1033,8 +1050,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());
@@ -1047,7 +1063,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
@@ -1271,7 +1295,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
@@ -1595,6 +1619,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);
@@ -1865,8 +1893,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
@@ -2003,7 +2031,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;
@@ -2212,7 +2240,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
@@ -2395,9 +2423,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';
@@ -2434,6 +2464,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));
@@ -2442,7 +2474,7 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::PermissionsError);
QVERIFY(!memory);
QVERIFY(file.setPermissions(originalPermissions));
-
+#endif
QVERIFY(file.remove());
}