summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfile/tst_qfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qfile/tst_qfile.cpp')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp74
1 files changed, 38 insertions, 36 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 7c095f329a..8268b46538 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -122,11 +122,9 @@ private slots:
void readAll_data();
void readAll();
void readAllBuffer();
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
-#endif
void text();
void missingEndOfLine();
void readBlock();
@@ -151,18 +149,14 @@ private slots:
void readTextFile2();
void writeTextFile_data();
void writeTextFile();
-#ifndef Q_OS_SOLARIS
/* void largeFileSupport(); */
-#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void largeUncFileSupport();
#endif
void tailFile();
void flush();
void bufferedRead();
-#ifdef Q_OS_UNIX
void isSequential();
-#endif
void encodeName();
void truncate();
void seekToPos();
@@ -235,12 +229,8 @@ private:
NumberOfFileTypes
};
-#ifndef Q_WS_WINCE
void openStandardStreamsFileDescriptors();
-#endif
-#ifdef Q_OS_UNIX
void openStandardStreamsBufferedStreams();
-#endif
bool openFd(QFile &file, QIODevice::OpenMode mode, QFile::FileHandleFlags handleFlags)
{
@@ -830,10 +820,14 @@ void tst_QFile::readAllBuffer()
QFile::remove(fileName);
}
-// Currently no stdin/out supported for Windows CE.
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readAllStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Currently no stdin/out supported for Windows CE");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
QByteArray lotsOfData(1024, '@'); // 10 megs
QProcess process;
@@ -850,13 +844,18 @@ void tst_QFile::readAllStdin()
process.closeWriteChannel();
process.waitForFinished();
QCOMPARE(process.readAll().size(), lotsOfData.size() * 5);
-}
#endif
+}
-// Currently no stdin/out supported for Windows CE.
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readLineStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Currently no stdin/out supported for Windows CE");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
+
QByteArray lotsOfData(1024, '@'); // 10 megs
for (int i = 0; i < lotsOfData.size(); ++i) {
if ((i % 32) == 31)
@@ -888,13 +887,17 @@ void tst_QFile::readLineStdin()
QCOMPARE(char(array[i]), char('0' + i % 32));
}
}
-}
#endif
+}
-// Currently no stdin/out supported for Windows CE.
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readLineStdin_lineByLine()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Currently no stdin/out supported for Windows CE");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
for (int i = 0; i < 2; ++i) {
QProcess process;
process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
@@ -912,8 +915,8 @@ void tst_QFile::readLineStdin_lineByLine()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
-}
#endif
+}
void tst_QFile::text()
{
@@ -1551,14 +1554,15 @@ void tst_QFile::bufferedRead()
fclose(stdFile);
}
-#ifdef Q_OS_UNIX
void tst_QFile::isSequential()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Unix only test.");
+#endif
QFile zero("/dev/null");
QVERIFY(zero.open(QFile::ReadOnly));
QVERIFY(zero.isSequential());
}
-#endif
void tst_QFile::encodeName()
{
@@ -1760,11 +1764,11 @@ void tst_QFile::FILEReadWrite()
#include <qglobal.h>
#define BUFFSIZE 1
#define FILESIZE 0x10000000f
-
-// Solaris does not support statfs.
-#ifndef Q_OS_SOLARIS
void tst_QFile::largeFileSupport()
{
+#ifdef Q_OS_SOLARIS
+ QSKIP("Solaris does not support statfs");
+#else
qlonglong sizeNeeded = 2147483647;
sizeNeeded *= 2;
sizeNeeded += 1024;
@@ -1819,8 +1823,8 @@ void tst_QFile::largeFileSupport()
} else {
QFAIL("Could not determin disk space");
}
-}
#endif
+}
*/
void tst_QFile::i18nFileName_data()
@@ -2959,12 +2963,14 @@ void tst_QFile::openDirectory()
f1.close();
}
-// Although Windows CE (not mobile!) has functions that allow redirecting
-// the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
-// it does not have functions to simply open them like below.
-#ifndef Q_WS_WINCE
void tst_QFile::openStandardStreamsFileDescriptors()
{
+#ifdef Q_OS_WINCE
+ //allthough Windows CE (not mobile!) has functions that allow redirecting
+ //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
+ //it does not have functions to simply open them like below .
+ QSKIP("Opening standard streams on Windows CE via descriptor not implemented");
+#endif
// Using file descriptors
{
QFile in;
@@ -2990,11 +2996,12 @@ void tst_QFile::openStandardStreamsFileDescriptors()
QVERIFY( err.isSequential() );
}
}
-#endif
-#ifdef Q_OS_UNIX
void tst_QFile::openStandardStreamsBufferedStreams()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Unix only test.");
+#endif
// Using streams
{
QFile in;
@@ -3020,16 +3027,11 @@ void tst_QFile::openStandardStreamsBufferedStreams()
QVERIFY( err.isSequential() );
}
}
-#endif
void tst_QFile::openStandardStreams()
{
-#ifndef Q_WS_WINCE
openStandardStreamsFileDescriptors();
-#endif
-#ifdef Q_OS_UNIX
openStandardStreamsBufferedStreams();
-#endif
}
void tst_QFile::writeNothing()