summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/corelib
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp16
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp20
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp9
-rw-r--r--tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp16
-rw-r--r--tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp9
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp74
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp24
-rw-r--r--tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp18
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp303
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp9
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp21
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp32
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp17
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp8
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp9
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp9
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp8
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp30
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp18
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp60
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp9
21 files changed, 342 insertions, 377 deletions
diff --git a/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
index 7b1a0ca056..23f099bffa 100644
--- a/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -60,12 +60,8 @@ private slots:
#ifndef QT_NO_EXCEPTIONS
void exceptions();
#endif
-#ifdef Q_COMPILER_DECLTYPE
void functor();
-#endif
-#ifdef Q_COMPILER_LAMBDA
void lambda();
-#endif
};
void light()
@@ -414,9 +410,11 @@ struct Functor {
};
// This tests functor without result_type; decltype need to be supported by the compiler.
-#ifdef Q_COMPILER_DECLTYPE
void tst_QtConcurrentRun::functor()
{
+#ifndef Q_COMPILER_DECLTYPE
+ QSKIP("Compiler does not support decltype");
+#else
Functor f;
{
QFuture<int> fut = QtConcurrent::run(f);
@@ -437,12 +435,14 @@ void tst_QtConcurrentRun::functor()
QtConcurrent::run(f, 1,2,3,4).waitForFinished();
QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
}
-}
#endif
+}
-#ifdef Q_COMPILER_LAMBDA
void tst_QtConcurrentRun::lambda()
{
+#ifndef Q_COMPILER_LAMBDA
+ QSKIP("Compiler does not support lambda");
+#else
QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
@@ -456,8 +456,8 @@ void tst_QtConcurrentRun::lambda()
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
}
#endif
-}
#endif
+}
QTEST_MAIN(tst_QtConcurrentRun)
#include "tst_qtconcurrentrun.moc"
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index 35f27fe40e..aa63db4852 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -101,10 +101,8 @@ private slots:
void stream_QPen_data();
void stream_QPen();
-#ifndef Q_OS_WINCE
void stream_QPixmap_data();
void stream_QPixmap();
-#endif
void stream_QPoint_data();
void stream_QPoint();
@@ -136,10 +134,8 @@ private slots:
void stream_qint64_data();
void stream_qint64();
-#ifndef Q_OS_WINCE
void stream_QIcon_data();
void stream_QIcon();
-#endif
void stream_QEasingCurve_data();
void stream_QEasingCurve();
@@ -1578,31 +1574,35 @@ void tst_QDataStream::readQPen(QDataStream *s)
// pixmap testing is currently limited to one pixmap only.
//
-// Test depends on more memory than available on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QDataStream::stream_QPixmap_data()
{
+#ifndef Q_OS_WINCE
stream_data(1);
+#endif
}
void tst_QDataStream::stream_QPixmap()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Test depends on more memory than available on Qt/CE");
+#endif
STREAM_IMPL(QPixmap);
}
-#endif
-// Test depends on more memory than available on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QDataStream::stream_QIcon_data()
{
+#ifndef Q_OS_WINCE
stream_data(1);
+#endif
}
void tst_QDataStream::stream_QIcon()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Test depends on more memory than available on Qt/CE");
+#endif
STREAM_IMPL(QIcon);
}
-#endif
void tst_QDataStream::writeQPixmap(QDataStream *s)
{
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index b66a7dac6a..28ccad3b56 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -141,9 +141,7 @@ private slots:
void operator_eq();
-#ifndef Q_OS_WINCE
void dotAndDotDot();
-#endif
void homePath();
void tempPath();
void rootPath();
@@ -1217,17 +1215,18 @@ void tst_QDir::operator_eq()
dir1.setPath("..");
}
-// WinCE does not have . nor ..
-#ifndef Q_OS_WINCE
void tst_QDir::dotAndDotDot()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("WinCE does not have . nor ..");
+#else
QDir dir(QString(SRCDIR "testdir/"));
QStringList entryList = dir.entryList(QDir::Dirs);
QCOMPARE(entryList, QStringList() << QString(".") << QString("..") << QString("dir") << QString("spaces"));
entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces"));
-}
#endif
+}
void tst_QDir::homePath()
{
diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
index 47e432d432..771e79e79e 100644
--- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
@@ -121,9 +121,7 @@ private slots:
void uncPaths_data();
void uncPaths();
#endif
-#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void qtbug15421_hiddenDirs_hiddenFiles();
-#endif
};
tst_QDirIterator::tst_QDirIterator()
@@ -592,13 +590,15 @@ void tst_QDirIterator::uncPaths()
}
#endif
-// In Unix it is easy to create hidden files, but in Windows it requires
-// a special call since hidden files need to be "marked" while in Unix
-// anything starting by a '.' is a hidden file.
-// For that reason this test is not run in Windows.
-#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles()
{
+ // In Unix it is easy to create hidden files, but in Windows it requires
+ // a special call since hidden files need to be "marked" while in Unix
+ // anything starting by a '.' is a hidden file.
+ // For that reason this test is not run in Windows.
+#if defined Q_OS_WIN || Q_OS_WINCE
+ QSKIP("To create hidden files a special call is required in Windows.");
+#else
// Only files
{
int matches = 0;
@@ -627,8 +627,8 @@ void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles()
QCOMPARE(matches, 6);
QCOMPARE(failures, 0);
}
+#endif // Q_OS_WIN || Q_OS_WINCE
}
-#endif
QTEST_MAIN(tst_QDirIterator)
diff --git a/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp
index 8f3b33dcf0..ce7b829738 100644
--- a/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp
@@ -121,9 +121,7 @@ private slots:
// Map/unmap large file
void mapFile();
-#ifndef Q_OS_MAC
void mapOffsetOverflow();
-#endif
void closeFile() { largeFile.close(); }
@@ -512,10 +510,12 @@ void tst_LargeFile::mapFile()
QVERIFY( largeFile.unmap( baseAddress ) );
}
-// mmap'ping beyond EOF may succeed; generate bus error on access.
-#ifndef Q_OS_MAC
void tst_LargeFile::mapOffsetOverflow()
{
+#if defined(Q_OS_MAC)
+ QSKIP("mmap'ping beyond EOF may succeed; generate bus error on access");
+#endif
+
// Out-of-range mappings should fail, and not silently clip the offset
for (int i = 50; i < 63; ++i) {
uchar *address = 0;
@@ -530,7 +530,6 @@ void tst_LargeFile::mapOffsetOverflow()
QVERIFY( !address );
}
}
-#endif
QTEST_APPLESS_MAIN(tst_LargeFile)
#include "tst_largefile.moc"
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()
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 8650bc4d1e..4319d8b7f1 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -133,9 +133,7 @@ private slots:
void size_data();
void size();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void systemFiles();
-#endif
void compare_data();
void compare();
@@ -174,10 +172,8 @@ private slots:
void isWritable();
void isExecutable();
-#ifdef Q_OS_MAC
void testDecomposedUnicodeNames_data();
void testDecomposedUnicodeNames();
-#endif
void equalOperator() const;
void equalOperatorWithDifferentSlashes() const;
@@ -873,16 +869,16 @@ void tst_QFileInfo::size()
QTEST(int(fi.size()), "size");
}
-// This is a Windows only test.
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void tst_QFileInfo::systemFiles()
{
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+ QSKIP("This is a Windows only test");
+#endif
QFileInfo fi("c:\\pagefile.sys");
QVERIFY(fi.exists()); // task 167099
QVERIFY(fi.size() > 0); // task 189202
QVERIFY(fi.lastModified().isValid());
}
-#endif
void tst_QFileInfo::compare_data()
{
@@ -1487,8 +1483,6 @@ void tst_QFileInfo::isExecutable()
}
-// This is a OS X only test (unless you know more about filesystems, then maybe you should try it ;)
-#ifdef Q_OS_MAC
void tst_QFileInfo::testDecomposedUnicodeNames_data()
{
QTest::addColumn<QString>("filePath");
@@ -1503,21 +1497,32 @@ void tst_QFileInfo::testDecomposedUnicodeNames_data()
static void createFileNative(const QString &filePath)
{
+#ifdef Q_OS_UNIX
int fd = open(filePath.normalized(QString::NormalizationForm_D).toUtf8().constData(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
if (fd < 0) {
QFAIL("couldn't create file");
} else {
close(fd);
}
+#else
+ Q_UNUSED(filePath);
+#endif
}
static void removeFileNative(const QString &filePath)
{
+#ifdef Q_OS_UNIX
unlink(filePath.normalized(QString::NormalizationForm_D).toUtf8().constData());
+#else
+ Q_UNUSED(filePath);
+#endif
}
void tst_QFileInfo::testDecomposedUnicodeNames()
{
+#ifndef Q_OS_MAC
+ QSKIP("This is a OS X only test (unless you know more about filesystems, then maybe you should try it ;)");
+#endif
QFETCH(QString, filePath);
createFileNative(filePath);
@@ -1526,7 +1531,6 @@ void tst_QFileInfo::testDecomposedUnicodeNames()
QTEST(file.exists(), "exists");
removeFileNative(filePath);
}
-#endif
void tst_QFileInfo::equalOperator() const
{
diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
index d3a8e0fd60..a30a2d0c14 100644
--- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
@@ -54,14 +54,10 @@ class tst_QIODevice : public QObject
private slots:
void getSetCheck();
-#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
void constructing_QTcpSocket();
-#endif
void constructing_QFile();
void read_QByteArray();
-#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
void unget();
-#endif
void peek();
void peekAndRead();
@@ -92,11 +88,11 @@ void tst_QIODevice::getSetCheck()
}
//----------------------------------------------------------------------------------
-
-// Networking tests in a WinCE emulator are unstable.
-#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
void tst_QIODevice::constructing_QTcpSocket()
{
+#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
+ QSKIP("Networking tests in a WinCE emulator are unstable");
+#endif
QTcpSocket socket;
QIODevice *device = &socket;
@@ -136,7 +132,6 @@ void tst_QIODevice::constructing_QTcpSocket()
}
QCOMPARE(*c1, *c2);
}
-#endif
//----------------------------------------------------------------------------------
void tst_QIODevice::constructing_QFile()
@@ -189,11 +184,11 @@ void tst_QIODevice::read_QByteArray()
}
//--------------------------------------------------------------------
-
-// Networking tests in a WinCE emulator are unstable.
-#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
void tst_QIODevice::unget()
{
+#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
+ QSKIP("Networking tests in a WinCE emulator are unstable");
+#endif
QBuffer buffer;
buffer.open(QBuffer::ReadWrite);
buffer.write("ZXCV");
@@ -290,7 +285,6 @@ void tst_QIODevice::unget()
socket.close();
}
}
-#endif
//--------------------------------------------------------------------
void tst_QIODevice::peek()
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 0662f890e1..bd27da994a 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -84,72 +84,55 @@ private slots:
void simpleStart();
void execute();
void startDetached();
-#ifndef Q_OS_WIN
void crashTest();
void crashTest2();
-#endif
-#ifndef Q_OS_WINCE
void echoTest_data();
void echoTest();
void echoTest2();
void echoTest_performance();
-#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined Q_OS_WIN
void echoTestGui();
void batFiles_data();
void batFiles();
#endif
void exitStatus_data();
void exitStatus();
-#ifndef Q_OS_WINCE
void loopBackTest();
void readTimeoutAndThenCrash();
-#endif
void waitForFinished();
-#ifndef Q_OS_WINCE
void deadWhileReading();
void restartProcessDeadlock();
void closeWriteChannel();
void closeReadChannel();
void openModes();
void emitReadyReadOnlyWhenNewDataArrives();
-#endif
void hardExit();
void softExit();
-#ifndef Q_OS_WINCE
void softExitInSlots_data();
void softExitInSlots();
void mergedChannels();
void forwardedChannels();
void atEnd();
void atEnd2();
-#endif
void processInAThread();
void processesInMultipleThreads();
-#ifndef Q_OS_WINCE
void waitForFinishedWithTimeout();
void waitForReadyReadInAReadyReadSlot();
void waitForBytesWrittenInABytesWrittenSlot();
-#endif
void spaceArgsTest_data();
void spaceArgsTest();
#if defined(Q_OS_WIN)
void nativeArguments();
#endif
void exitCodeTest();
-#ifndef Q_OS_WINCE
void setEnvironment_data();
void setEnvironment();
void setProcessEnvironment_data();
void setProcessEnvironment();
-#endif
void systemEnvironment();
-#ifndef Q_OS_WINCE
void spaceInName();
-#endif
void lockupsInStartDetached();
void waitForReadyReadForNonexistantProcess();
-#ifndef Q_OS_WINCE
void setStandardInputFile();
void setStandardOutputFile_data();
void setStandardOutputFile();
@@ -157,14 +140,9 @@ private slots:
void setStandardOutputProcess();
void removeFileWhileProcessIsRunning();
void fileWriterProcess();
-#endif
void detachedWorkingDirectoryAndPid();
-#ifndef Q_OS_WINCE
void switchReadChannels();
-#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void setWorkingDirectory();
-#endif
void startFinishStartFinish();
void invalidProgramString_data();
void invalidProgramString();
@@ -180,10 +158,8 @@ protected slots:
void readFromProcess();
void exitLoopSlot();
void restartProcess();
-#ifndef Q_OS_WINCE
void waitForReadyReadInAReadyReadSlotSlot();
void waitForBytesWrittenInABytesWrittenSlotSlot();
-#endif
private:
QProcess *process;
@@ -316,12 +292,12 @@ void tst_QProcess::readFromProcess()
}
//-----------------------------------------------------------------------------
-
-// This test opens a crash dialog on Windows.
-#ifndef Q_OS_WIN
void tst_QProcess::crashTest()
{
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
+#ifdef Q_OS_WIN
+ QSKIP("This test opens a crash dialog on Windows");
+#endif
process = new QProcess;
QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
process->start("testProcessCrash/testProcessCrash");
@@ -351,14 +327,13 @@ void tst_QProcess::crashTest()
QCOMPARE(qVariantValue<QProcess::ProcessState>(stateSpy.at(1).at(0)), QProcess::Running);
QCOMPARE(qVariantValue<QProcess::ProcessState>(stateSpy.at(2).at(0)), QProcess::NotRunning);
}
-#endif
//-----------------------------------------------------------------------------
-
-// This test opens a crash dialog on Windows.
-#ifndef Q_OS_WIN
void tst_QProcess::crashTest2()
{
+#ifdef Q_OS_WIN
+ QSKIP("This test opens a crash dialog on Windows");
+#endif
process = new QProcess;
process->start("testProcessCrash/testProcessCrash");
QVERIFY(process->waitForStarted(5000));
@@ -386,12 +361,8 @@ void tst_QProcess::crashTest2()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::echoTest_data()
{
QTest::addColumn<QByteArray>("input");
@@ -407,9 +378,12 @@ void tst_QProcess::echoTest_data()
}
//-----------------------------------------------------------------------------
-
void tst_QProcess::echoTest()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QFETCH(QByteArray, input);
process = new QProcess;
@@ -454,7 +428,6 @@ void tst_QProcess::echoTest()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::exitLoopSlot()
@@ -463,11 +436,12 @@ void tst_QProcess::exitLoopSlot()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::echoTest2()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process = new QProcess;
connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
@@ -511,14 +485,14 @@ void tst_QProcess::echoTest2()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::echoTest_performance()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
#ifdef Q_OS_MAC
process.start("testProcessLoopback/testProcessLoopback.app");
@@ -564,14 +538,15 @@ void tst_QProcess::echoTest_performance()
process.closeWriteChannel();
QVERIFY(process.waitForFinished());
}
-#endif
+#if defined Q_OS_WIN
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE, and neither are batch files.
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void tst_QProcess::echoTestGui()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
process.start("testProcessEchoGui/testProcessEchoGui");
@@ -598,6 +573,9 @@ void tst_QProcess::batFiles_data()
void tst_QProcess::batFiles()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Batch files are not supported on Windows CE");
+#endif
QFETCH(QString, batFile);
QFETCH(QByteArray, output);
@@ -611,6 +589,7 @@ void tst_QProcess::batFiles()
QVERIFY(proc.readAll().startsWith(output));
}
+
#endif
//-----------------------------------------------------------------------------
@@ -662,11 +641,12 @@ void tst_QProcess::exitStatus()
process = 0;
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::loopBackTest()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process = new QProcess;
#ifdef Q_OS_MAC
process->start("testProcessEcho/testProcessEcho.app");
@@ -689,14 +669,14 @@ void tst_QProcess::loopBackTest()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::readTimeoutAndThenCrash()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process = new QProcess;
#ifdef Q_OS_MAC
process->start("testProcessEcho/testProcessEcho.app");
@@ -726,7 +706,6 @@ void tst_QProcess::readTimeoutAndThenCrash()
delete process;
process = 0;
}
-#endif
void tst_QProcess::waitForFinished()
{
@@ -756,10 +735,12 @@ void tst_QProcess::waitForFinished()
QCOMPARE(process.error(), QProcess::FailedToStart);
}
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::deadWhileReading()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
#ifdef Q_OS_MAC
@@ -777,14 +758,14 @@ void tst_QProcess::deadWhileReading()
QCOMPARE(output.count("\n"), 10*1024);
process.waitForFinished();
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::restartProcessDeadlock()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
// The purpose of this test is to detect whether restarting a
// process in the finished() connected slot causes a deadlock
// because of the way QProcessManager uses its locks.
@@ -806,7 +787,6 @@ void tst_QProcess::restartProcessDeadlock()
QCOMPARE(process->write("", 1), qlonglong(1));
QVERIFY(process->waitForFinished(5000));
}
-#endif
void tst_QProcess::restartProcess()
{
@@ -818,11 +798,12 @@ void tst_QProcess::restartProcess()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::closeWriteChannel()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess more;
more.start("testProcessEOF/testProcessEOF");
@@ -844,14 +825,14 @@ void tst_QProcess::closeWriteChannel()
more.write("q");
QVERIFY(more.waitForFinished(5000));
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::closeReadChannel()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
for (int i = 0; i < 10; ++i) {
QProcess::ProcessChannel channel1 = QProcess::StandardOutput;
QProcess::ProcessChannel channel2 = QProcess::StandardError;
@@ -881,14 +862,14 @@ void tst_QProcess::closeReadChannel()
QVERIFY(proc.waitForFinished(5000));
}
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::openModes()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess proc;
QVERIFY(!proc.isOpen());
QVERIFY(proc.openMode() == QProcess::NotOpen);
@@ -931,14 +912,14 @@ void tst_QProcess::openModes()
QVERIFY(!proc.isWritable());
QCOMPARE(proc.state(), QProcess::NotRunning);
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess proc;
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
QSignalSpy spy(&proc, SIGNAL(readyRead()));
@@ -970,7 +951,6 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
proc.write("", 1);
QVERIFY(proc.waitForFinished(5000));
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::hardExit()
@@ -1017,8 +997,6 @@ void tst_QProcess::softExit()
QCOMPARE(int(proc.error()), int(QProcess::UnknownError));
}
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
class SoftExitProcess : public QProcess
{
Q_OBJECT
@@ -1085,7 +1063,6 @@ private:
};
//-----------------------------------------------------------------------------
-
void tst_QProcess::softExitInSlots_data()
{
QTest::addColumn<QString>("appName");
@@ -1103,9 +1080,12 @@ void tst_QProcess::softExitInSlots_data()
}
//-----------------------------------------------------------------------------
-
void tst_QProcess::softExitInSlots()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QFETCH(QString, appName);
for (int i = 0; i < 5; ++i) {
@@ -1117,14 +1097,14 @@ void tst_QProcess::softExitInSlots()
QVERIFY(proc.waitedForFinished);
}
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::mergedChannels()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
process.setReadChannelMode(QProcess::MergedChannels);
QCOMPARE(process.readChannelMode(), QProcess::MergedChannels);
@@ -1147,14 +1127,14 @@ void tst_QProcess::mergedChannels()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::forwardedChannels()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
process.setReadChannelMode(QProcess::ForwardedChannels);
QCOMPARE(process.readChannelMode(), QProcess::ForwardedChannels);
@@ -1173,14 +1153,15 @@ void tst_QProcess::forwardedChannels()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
-#endif
-//-----------------------------------------------------------------------------
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
+//-----------------------------------------------------------------------------
void tst_QProcess::atEnd()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
#ifdef Q_OS_MAC
@@ -1202,7 +1183,6 @@ void tst_QProcess::atEnd()
process.write("", 1);
QVERIFY(process.waitForFinished(5000));
}
-#endif
class TestThread : public QThread
{
@@ -1279,11 +1259,12 @@ void tst_QProcess::processesInMultipleThreads()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::waitForFinishedWithTimeout()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process = new QProcess(this);
#ifdef Q_OS_MAC
@@ -1302,14 +1283,14 @@ void tst_QProcess::waitForFinishedWithTimeout()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process = new QProcess(this);
connect(process, SIGNAL(readyRead()), this, SLOT(waitForReadyReadInAReadyReadSlotSlot()));
connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
@@ -1335,27 +1316,27 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
bytesAvailable = process->bytesAvailable();
process->write("bar", 4);
QVERIFY(process->waitForReadyRead(5000));
QTestEventLoop::instance().exitLoop();
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process = new QProcess(this);
connect(process, SIGNAL(bytesWritten(qint64)), this, SLOT(waitForBytesWrittenInABytesWrittenSlotSlot()));
bytesAvailable = 0;
@@ -1380,19 +1361,18 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
process->write("b");
QVERIFY(process->waitForBytesWritten(5000));
QTestEventLoop::instance().exitLoop();
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::spaceArgsTest_data()
@@ -1673,11 +1653,12 @@ void tst_QProcess::failToStartWithEventLoop()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::removeFileWhileProcessIsRunning()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QFile file("removeFile.txt");
QVERIFY(file.open(QFile::WriteOnly));
@@ -1695,12 +1676,8 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
process.write("", 1);
QVERIFY(process.waitForFinished(5000));
}
-#endif
//-----------------------------------------------------------------------------
-
-// WinCE doesn't support environment variables.
-#ifndef Q_OS_WINCE
void tst_QProcess::setEnvironment_data()
{
QTest::addColumn<QString>("name");
@@ -1720,6 +1697,10 @@ void tst_QProcess::setEnvironment_data()
void tst_QProcess::setEnvironment()
{
+#if defined (Q_OS_WINCE)
+ QSKIP("OS doesn't support environment variables");
+#endif
+
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
QVERIFY(!qgetenv("PATH").isEmpty());
@@ -1775,12 +1756,8 @@ void tst_QProcess::setEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
}
-#endif
//-----------------------------------------------------------------------------
-
-// WinCE doesn't support environment variables.
-#ifndef Q_OS_WINCE
void tst_QProcess::setProcessEnvironment_data()
{
setEnvironment_data();
@@ -1788,6 +1765,10 @@ void tst_QProcess::setProcessEnvironment_data()
void tst_QProcess::setProcessEnvironment()
{
+#if defined (Q_OS_WINCE)
+ QSKIP("OS doesn't support environment variables");
+#endif
+
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
QVERIFY(!qgetenv("PATH").isEmpty());
@@ -1818,8 +1799,6 @@ void tst_QProcess::setProcessEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
}
-#endif
-
//-----------------------------------------------------------------------------
void tst_QProcess::systemEnvironment()
{
@@ -1837,18 +1816,17 @@ void tst_QProcess::systemEnvironment()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::spaceInName()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
QProcess process;
process.start("test Space In Name/testSpaceInName", QStringList());
QVERIFY(process.waitForStarted());
process.write("", 1);
QVERIFY(process.waitForFinished());
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::lockupsInStartDetached()
@@ -1864,11 +1842,12 @@ void tst_QProcess::lockupsInStartDetached()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::atEnd2()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess process;
#ifdef Q_OS_MAC
@@ -1885,7 +1864,6 @@ void tst_QProcess::atEnd2()
}
QCOMPARE(lines.size(), 7);
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::waitForReadyReadForNonexistantProcess()
@@ -1909,11 +1887,12 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::setStandardInputFile()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
static const char data[] = "A bunch\1of\2data\3\4\5\6\7...";
QProcess process;
QFile file("data");
@@ -1934,12 +1913,8 @@ void tst_QProcess::setStandardInputFile()
QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0
QVERIFY(all == data);
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::setStandardOutputFile_data()
{
QTest::addColumn<int>("channelToTest");
@@ -1970,6 +1945,10 @@ void tst_QProcess::setStandardOutputFile_data()
void tst_QProcess::setStandardOutputFile()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
static const char data[] = "Original data. ";
static const char testdata[] = "Test data.";
@@ -2020,11 +1999,8 @@ void tst_QProcess::setStandardOutputFile()
QCOMPARE(all.size(), expectedsize);
}
-#endif
//-----------------------------------------------------------------------------
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::setStandardOutputProcess_data()
{
QTest::addColumn<bool>("merged");
@@ -2034,6 +2010,10 @@ void tst_QProcess::setStandardOutputProcess_data()
void tst_QProcess::setStandardOutputProcess()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QProcess source;
QProcess sink;
@@ -2061,14 +2041,14 @@ void tst_QProcess::setStandardOutputProcess()
else
QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd"));
}
-#endif
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::fileWriterProcess()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
+
QString stdinStr;
for (int i = 0; i < 5000; ++i)
stdinStr += QString::fromLatin1("%1 -- testing testing 1 2 3\n").arg(i);
@@ -2090,7 +2070,6 @@ void tst_QProcess::fileWriterProcess()
QCOMPARE(QFile("fileWriterProcess.txt").size(), qint64(stdinStr.size()));
} while (stopWatch.elapsed() < 3000);
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::detachedWorkingDirectoryAndPid()
@@ -2137,11 +2116,11 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
}
//-----------------------------------------------------------------------------
-
-// Reading and writing to a process is not supported on Qt/CE.
-#ifndef Q_OS_WINCE
void tst_QProcess::switchReadChannels()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Reading and writing to a process is not supported on Qt/CE");
+#endif
const char data[] = "ABCD";
QProcess process;
@@ -2170,15 +2149,13 @@ void tst_QProcess::switchReadChannels()
process.setReadChannel(QProcess::StandardOutput);
QCOMPARE(process.read(1), QByteArray("D"));
}
-#endif
//-----------------------------------------------------------------------------
-
-// Windows CE does not support working directory logic, and
-// setWorkingDirectory will chdir before starting the process on unices.
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void tst_QProcess::setWorkingDirectory()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Windows CE does not support working directory logic");
+#endif
process = new QProcess;
process->setWorkingDirectory("test");
#ifdef Q_OS_MAC
@@ -2186,6 +2163,9 @@ void tst_QProcess::setWorkingDirectory()
#else
process->start("testSetWorkingDirectory/testSetWorkingDirectory");
#endif
+#ifndef Q_OS_WIN
+ QSKIP("setWorkingDirectory will chdir before starting the process on unices");
+#endif
QVERIFY(process->waitForFinished());
QByteArray workingDir = process->readAllStandardOutput();
@@ -2194,7 +2174,6 @@ void tst_QProcess::setWorkingDirectory()
delete process;
process = 0;
}
-#endif
//-----------------------------------------------------------------------------
void tst_QProcess::startFinishStartFinish()
diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
index e959a27c18..addce54136 100644
--- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -57,9 +57,7 @@ private slots:
void caseSensitivity();
void systemEnvironment();
-#ifndef Q_OS_WINCE
void putenv();
-#endif
};
void tst_QProcessEnvironment::operator_eq()
@@ -278,10 +276,11 @@ void tst_QProcessEnvironment::systemEnvironment()
#endif
}
-// Windows CE has no environment.
-#ifndef Q_OS_WINCE
void tst_QProcessEnvironment::putenv()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Windows CE has no environment");
+#else
static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE";
static bool testRan = false;
@@ -312,8 +311,8 @@ void tst_QProcessEnvironment::putenv()
QVERIFY(eAfter.contains(lower));
QCOMPARE(eAfter.value(lower), QString("Hello, World"));
# endif
-}
#endif
+}
QTEST_MAIN(tst_QProcessEnvironment)
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index ab6733889a..293d30d487 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -100,10 +100,8 @@ private slots:
void testEscapes();
void testCaseSensitivity_data();
void testCaseSensitivity();
-#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN)
void testErrorHandling_data();
void testErrorHandling();
-#endif
void testIniParsing_data();
void testIniParsing();
void testChildKeysAndGroups_data();
@@ -127,7 +125,7 @@ private slots:
void setPath();
void setDefaultFormat();
void dontCreateNeedlessPaths();
-#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
+#if !defined(Q_OS_WIN)
void dontReorderIniKeysNeedlessly();
#endif
#if defined(Q_OS_WIN)
@@ -650,8 +648,6 @@ void tst_QSettings::testByteArray()
}
}
-// Windows doesn't support most file modes, including read-only directories, so this test is moot.
-#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN)
void tst_QSettings::testErrorHandling_data()
{
QTest::addColumn<int>("filePerms"); // -1 means file should not exist
@@ -682,7 +678,10 @@ void tst_QSettings::testErrorHandling_data()
void tst_QSettings::testErrorHandling()
{
-#if defined(Q_OS_UNIX)
+#ifdef QT_BUILD_INTERNAL
+#ifdef Q_OS_WIN
+ QSKIP("Windows doesn't support most file modes, including read-only directories, so this test is moot.");
+#elif defined(Q_OS_UNIX)
if (::getuid() == 0)
QSKIP("Running this test as root doesn't work, since file perms do not bother him");
#else
@@ -744,9 +743,9 @@ void tst_QSettings::testErrorHandling()
QCOMPARE(settings.value("alpha/beta/geometry").toInt(), 100);
QCOMPARE((int)settings.status(), statusAfterSetAndSync);
}
+#endif // !Q_OS_WIN
#endif
}
-#endif
Q_DECLARE_METATYPE(QVariant)
Q_DECLARE_METATYPE(QSettings::Status)
@@ -2998,11 +2997,13 @@ void tst_QSettings::dontCreateNeedlessPaths()
QVERIFY(!fileInfo.dir().exists());
}
-// if QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER is defined,
-// the Qt build does not preserve ordering, as a code size optimization.
-#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
+#if !defined(Q_OS_WIN)
void tst_QSettings::dontReorderIniKeysNeedlessly()
{
+#ifdef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
+ QSKIP("This Qt build does not preserve ordering, as a code size optimization.");
+#endif
+
/*
This is a very strong test. It asserts that modifying
resourcefile2.ini will lead to the exact contents of
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 4a814799da..a2e8006951 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -188,20 +188,16 @@ private slots:
void octTest();
void zeroTermination();
void ws_manipulator();
-#ifndef Q_OS_WINCE
void stillOpenWhenAtEnd();
-#endif
void readNewlines_data();
void readNewlines();
void seek();
void pos();
void pos2();
void pos3LargeFile();
-#ifndef Q_OS_WINCE
void readStdin();
void readAllFromStdin();
void readLineFromStdin();
-#endif
void read();
void qbool();
void forcePoint();
@@ -1085,9 +1081,6 @@ void tst_QTextStream::ws_manipulator()
}
// ------------------------------------------------------------------------------
-
-// Qt/CE: Cannot test network on emulator.
-#ifndef Q_OS_WINCE
void tst_QTextStream::stillOpenWhenAtEnd()
{
int argc = 0;
@@ -1101,6 +1094,9 @@ void tst_QTextStream::stillOpenWhenAtEnd()
while (!stream.readLine().isNull()) {}
QVERIFY(file.isOpen());
+#ifdef Q_OS_WINCE
+ QSKIP("Qt/CE: Cannot test network on emulator");
+#endif
QTcpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), 143);
QVERIFY(socket.waitForReadyRead(5000));
@@ -1109,7 +1105,6 @@ void tst_QTextStream::stillOpenWhenAtEnd()
while (!stream2.readLine().isNull()) {}
QVERIFY(socket.isOpen());
}
-#endif
// ------------------------------------------------------------------------------
void tst_QTextStream::readNewlines_data()
@@ -1380,11 +1375,11 @@ void tst_QTextStream::pos3LargeFile()
}
// ------------------------------------------------------------------------------
-
-// Qt/CE has no stdin/out support for processes.
-#ifndef Q_OS_WINCE
void tst_QTextStream::readStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE has no stdin/out support for processes");
+#endif
QProcess stdinProcess;
stdinProcess.start("stdinProcess/stdinProcess");
stdinProcess.setReadChannel(QProcess::StandardError);
@@ -1404,14 +1399,13 @@ void tst_QTextStream::readStdin()
QCOMPARE(b, 2);
QCOMPARE(c, 3);
}
-#endif
// ------------------------------------------------------------------------------
-
-// Qt/CE has no stdin/out support for processes.
-#ifndef Q_OS_WINCE
void tst_QTextStream::readAllFromStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE has no stdin/out support for processes");
+#endif
QProcess stdinProcess;
stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
stdinProcess.setReadChannel(QProcess::StandardError);
@@ -1426,14 +1420,13 @@ void tst_QTextStream::readAllFromStdin()
QChar quoteChar('"');
QCOMPARE(stream.readAll(), QString::fromLatin1("%1hello world%2 \n").arg(quoteChar).arg(quoteChar));
}
-#endif
// ------------------------------------------------------------------------------
-
-// Qt/CE has no stdin/out support for processes.
-#ifndef Q_OS_WINCE
void tst_QTextStream::readLineFromStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE has no stdin/out support for processes");
+#endif
QProcess stdinProcess;
stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
stdinProcess.setReadChannel(QProcess::StandardError);
@@ -1450,7 +1443,6 @@ void tst_QTextStream::readLineFromStdin()
QVERIFY(stdinProcess.waitForFinished(5000));
}
-#endif
// ------------------------------------------------------------------------------
void tst_QTextStream::read()
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index 9f9e1a01ca..f53803ef0f 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -185,9 +185,7 @@ private slots:
// This test *must* run first. See the definition for why.
void processEvents();
void exec();
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
void throwInExec();
-#endif
void reexec();
void execAfterExit();
void wakeUp();
@@ -318,14 +316,16 @@ void tst_QEventLoop::exec()
}
}
-// This test needs exceptions to be enabled.
-// Windows Mobile cannot handle cross library exceptions
-// qobject.cpp will try to rethrow the exception after handling
-// which causes gwes.exe to crash
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
void tst_QEventLoop::throwInExec()
{
-#if defined(Q_OS_LINUX)
+#if defined(QT_NO_EXCEPTIONS) || defined(NO_EVENTLOOP_EXCEPTIONS)
+ QSKIP("Exceptions are disabled");
+#elif defined(Q_OS_WINCE_WM)
+ // Windows Mobile cannot handle cross library exceptions
+ // qobject.cpp will try to rethrow the exception after handling
+ // which causes gwes.exe to crash
+ QSKIP("This platform doesn't support propagating exceptions through the event loop");
+#elif defined(Q_OS_LINUX)
// C++ exceptions can't be passed through glib callbacks. Skip the test if
// we're using the glib event loop.
QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className();
@@ -361,7 +361,6 @@ void tst_QEventLoop::throwInExec()
QCOMPARE(caughtExceptions, 2);
}
}
-#endif
void tst_QEventLoop::reexec()
{
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
index 643524ed61..a1c943e877 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -67,9 +67,7 @@ class tst_QSocketNotifier : public QObject
private slots:
void unexpectedDisconnection();
void mixingWithTimers();
-#ifdef Q_OS_UNIX
void posixSockets();
-#endif
};
class UnexpectedDisconnectTester : public QObject
@@ -246,9 +244,11 @@ void tst_QSocketNotifier::mixingWithTimers()
QCOMPARE(helper.socketActivated, true);
}
-#ifdef Q_OS_UNIX
void tst_QSocketNotifier::posixSockets()
{
+#ifndef Q_OS_UNIX
+ QSKIP("test only for posix");
+#else
QTcpServer server;
QVERIFY(server.listen(QHostAddress::LocalHost, 0));
@@ -295,8 +295,8 @@ void tst_QSocketNotifier::posixSockets()
QCOMPARE(passive->readAll(), QByteArray("goodbye",8));
}
qt_safe_close(posixSocket);
-}
#endif
+}
QTEST_MAIN(tst_QSocketNotifier)
#include <tst_qsocketnotifier.moc>
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 302fb0296f..540f4b3d1e 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -109,9 +109,7 @@ private slots:
void customEventDispatcher();
-#ifndef Q_OS_WINCE
void stressTest();
-#endif
};
enum { one_minute = 60 * 1000, five_minutes = 5 * one_minute };
@@ -952,11 +950,11 @@ void tst_QThread::adoptMultipleThreadsOverlap()
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(recorder.activationCount.load(), numThreads);
}
-
-// Disconnects on WinCE, so skip this test.
-#ifndef Q_OS_WINCE
void tst_QThread::stressTest()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Disconnects on WinCE, skipping...");
+#endif
QTime t;
t.start();
while (t.elapsed() < one_minute) {
@@ -965,7 +963,6 @@ void tst_QThread::stressTest()
t.wait(one_minute);
}
}
-#endif
class Syncronizer : public QObject
{ Q_OBJECT
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 1899704355..667d7f88d6 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -134,9 +134,7 @@ private slots:
void reserve();
-#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
void literals();
-#endif
};
tst_QByteArray::tst_QByteArray()
@@ -1509,10 +1507,9 @@ void tst_QByteArray::reserve()
nil2.reserve(0);
}
-// Only tested on c++0x compliant compiler or gcc.
-#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
void tst_QByteArray::literals()
{
+#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
QByteArray str(QByteArrayLiteral("abcd"));
QVERIFY(str.length() == 4);
@@ -1529,8 +1526,10 @@ void tst_QByteArray::literals()
QVERIFY(str2.constData() == s);
QVERIFY(str2.data() != s);
-}
+#else
+ QSKIP("Only tested on c++0x compliant compiler or gcc");
#endif
+}
const char globalChar = '1';
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index f0671b5af4..90a8927631 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -121,9 +121,7 @@ private slots:
void dateTimeFromStringFormat_data();
void dateTimeFromStringFormat();
-#ifdef Q_OS_WIN
void fromString_LOCALE_ILDATE();
-#endif
void fromString();
@@ -1571,17 +1569,19 @@ void tst_QDateTime::fromString()
QLocale::setDefault(def);
}
-#ifdef Q_OS_WIN
void tst_QDateTime::fromString_LOCALE_ILDATE()
{
+#ifdef Q_OS_WIN
QString date1 = QLatin1String("Sun 1. Dec 13:02:00 1974");
QString date2 = QLatin1String("Sun Dec 1 13:02:00 1974");
QDateTime ref(QDate(1974, 12, 1), QTime(13, 2));
QCOMPARE(ref, QDateTime::fromString(date2, Qt::TextDate));
QCOMPARE(ref, QDateTime::fromString(date1, Qt::TextDate));
-}
+#else
+ QSKIP("Windows only");
#endif
+}
void tst_QDateTime::utcOffset()
{
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index dfcce2683e..b65cd44308 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -83,17 +83,11 @@ public:
tst_QLocale();
private slots:
-#ifdef Q_OS_WIN
void windowsDefaultLocale();
-#endif
-#ifdef Q_OS_MAC
void macDefaultLocale();
-#endif
void ctor();
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void emptyCtor();
-#endif
void unixLocaleName();
void double_conversion_data();
void double_conversion();
@@ -360,10 +354,14 @@ void tst_QLocale::ctor()
#undef TEST_CTOR
}
-// Uses unsupported Windows CE QProcess functionality (std streams, env).
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QLocale::emptyCtor()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Uses unsupported Windows CE QProcess functionality (std streams, env)");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
#define TEST_CTOR(req_lc, exp_str) \
{ \
/* Test constructor without arguments. Needs separate process */ \
@@ -434,8 +432,8 @@ void tst_QLocale::emptyCtor()
TEST_CTOR("123456", defaultLoc);
#undef TEST_CTOR
-}
#endif
+}
void tst_QLocale::unixLocaleName()
{
@@ -1069,9 +1067,12 @@ void tst_QLocale::toDateTime()
QCOMPARE(l.toDateTime(string, QLocale::LongFormat), result);
}
-#ifdef Q_OS_MAC
void tst_QLocale::macDefaultLocale()
{
+#ifndef Q_OS_MAC
+ QSKIP("This is a Mac OS X-only test");
+#endif
+
QLocale locale = QLocale::system();
if (locale.name() != QLatin1String("en_US"))
QSKIP("This test only tests for en_US");
@@ -1147,8 +1148,8 @@ void tst_QLocale::macDefaultLocale()
QList<Qt::DayOfWeek> days;
days << Qt::Monday << Qt::Tuesday << Qt::Wednesday << Qt::Thursday << Qt::Friday;
QCOMPARE(locale.weekdays(), days);
+
}
-#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -1203,11 +1204,14 @@ public:
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
};
+
#endif
-#ifdef Q_OS_WIN
void tst_QLocale::windowsDefaultLocale()
{
+#ifndef Q_OS_WIN
+ QSKIP("This is a Windows test");
+#else
RestoreLocaleHelper systemLocale;
// set weird system defaults and make sure we're using them
setWinLocaleInfo(LOCALE_SDECIMAL, QLatin1String("@"));
@@ -1242,8 +1246,8 @@ void tst_QLocale::windowsDefaultLocale()
QCOMPARE(locale.toString(QDateTime(QDate(1974, 12, 1), QTime(1,2,3)), QLocale::LongFormat),
QString("1@12@1974 1^2^3"));
QCOMPARE(locale.toString(QTime(1,2,3), QLocale::LongFormat), QString("1^2^3"));
-}
#endif
+}
void tst_QLocale::numberOptions()
{
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 7328858858..94f6fc1c12 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -68,9 +68,7 @@ private slots:
void basics();
void operators();
void swap();
-#ifndef Q_CC_SUN
void forwardDeclaration1();
-#endif
void forwardDeclaration2();
void memoryManagement();
void downCast();
@@ -100,10 +98,8 @@ private slots:
void map();
void hash();
void validConstructs();
-#ifndef QTEST_CROSS_COMPILED
void invalidConstructs_data();
void invalidConstructs();
-#endif
public slots:
void cleanup() { check(); }
@@ -344,10 +340,11 @@ ForwardDeclared *forwardPointer();
void externalForwardDeclaration();
extern int forwardDeclaredDestructorRunCount;
-// This type of forward declaration is not valid with SunCC.
-#ifndef Q_CC_SUN
void tst_QSharedPointer::forwardDeclaration1()
{
+#if defined(Q_CC_SUN) || defined(Q_CC_WINSCW) || defined(Q_CC_RVCT)
+ QSKIP("This type of forward declaration is not valid with this compiler");
+#else
externalForwardDeclaration();
struct Wrapper { QSharedPointer<ForwardDeclared> pointer; };
@@ -359,8 +356,8 @@ void tst_QSharedPointer::forwardDeclaration1()
QVERIFY(!w.pointer.isNull());
}
QCOMPARE(forwardDeclaredDestructorRunCount, 1);
-}
#endif
+}
#include "forwarddeclared.h"
@@ -1639,9 +1636,6 @@ void tst_QSharedPointer::validConstructs()
typedef bool (QTest::QExternalTest:: * TestFunction)(const QByteArray &body);
Q_DECLARE_METATYPE(TestFunction)
-
-// This test does not work on cross compiled systems.
-#ifndef QTEST_CROSS_COMPILED
void tst_QSharedPointer::invalidConstructs_data()
{
QTest::addColumn<TestFunction>("testFunction");
@@ -1786,6 +1780,9 @@ void tst_QSharedPointer::invalidConstructs()
#ifdef Q_CC_MINGW
QSKIP("The maintainer of QSharedPointer: 'We don't know what the problem is so skip the tests.'");
#endif
+#ifdef QTEST_CROSS_COMPILED
+ QSKIP("This test does not work on cross compiled systems");
+#endif
QTest::QExternalTest test;
test.setQtModules(QTest::QExternalTest::QtCore);
@@ -1840,7 +1837,6 @@ void tst_QSharedPointer::invalidConstructs()
QFAIL("Fail");
}
}
-#endif
namespace QTBUG11730 {
struct IB
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index a51667e459..5d29b9c67e 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -69,10 +69,8 @@ public:
public slots:
void cleanup();
private slots:
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void fromStdString();
void toStdString();
-#endif
void check_QTextIOStream();
void check_QTextStream();
void check_QDataStream();
@@ -153,9 +151,7 @@ private slots:
void constructor();
void constructorQByteArray_data();
void constructorQByteArray();
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void STL();
-#endif
void isEmpty();
void isNull();
void acc_01();
@@ -196,10 +192,8 @@ private slots:
void integer_conversion();
void tortureSprintfDouble();
void toNum();
-#if !defined(Q_OS_MAC) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
void localeAwareCompare_data();
void localeAwareCompare();
-#endif
void split_data();
void split();
void split_regexp();
@@ -223,12 +217,8 @@ private slots:
void QTBUG10404_compareRef();
void QTBUG9281_arg_locale();
-#ifdef QT_USE_ICU
void toUpperLower_icu();
-#endif
-#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
void literals();
-#endif
void reserve();
void toHtmlEscaped_data();
@@ -818,10 +808,12 @@ void tst_QString::constructorQByteArray()
QCOMPARE( strBA, expected );
}
-// This test crashes on HP-UX with aCC.
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void tst_QString::STL()
{
+#ifdef Q_CC_HPACC
+ QSKIP("This test crashes on HP-UX with aCC");
+#endif
+#ifndef QT_NO_STL
#ifndef QT_NO_CAST_TO_ASCII
QString qt( "QString" );
@@ -868,8 +860,10 @@ void tst_QString::STL()
QCOMPARE(s, QString::fromLatin1("hello"));
QCOMPARE(stlStr, s.toStdWString());
#endif
-}
+#else
+ QSKIP( "Not tested without STL support");
#endif
+}
void tst_QString::truncate()
{
@@ -3082,10 +3076,12 @@ void tst_QString::setRawData()
QVERIFY(cstr.data_ptr() != csd);
}
-// This test crashes on HP-UX with aCC.
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void tst_QString::fromStdString()
{
+#ifdef Q_CC_HPACC
+ QSKIP("This test crashes on HP-UX with aCC");
+#endif
+#if !defined(QT_NO_STL)
std::string stroustrup = "foo";
QString eng = QString::fromStdString( stroustrup );
QCOMPARE( eng, QString("foo") );
@@ -3093,13 +3089,15 @@ void tst_QString::fromStdString()
std::string stdnull( cnull, sizeof(cnull)-1 );
QString qtnull = QString::fromStdString( stdnull );
QCOMPARE( qtnull.size(), int(stdnull.size()) );
-}
#endif
+}
-// This test crashes on HP-UX with aCC.
-#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
void tst_QString::toStdString()
{
+#ifdef Q_CC_HPACC
+ QSKIP("This test crashes on HP-UX with aCC");
+#endif
+#if !defined(QT_NO_STL)
QString nord = "foo";
std::string stroustrup1 = nord.toStdString();
QVERIFY( qstrcmp(stroustrup1.c_str(), "foo") == 0 );
@@ -3113,8 +3111,8 @@ void tst_QString::toStdString()
QString qtnull( qcnull, sizeof(qcnull)/sizeof(QChar) );
std::string stdnull = qtnull.toStdString();
QCOMPARE( int(stdnull.size()), qtnull.size() );
-}
#endif
+}
void tst_QString::utf8()
{
@@ -4163,10 +4161,6 @@ void tst_QString::tortureSprintfDouble()
#include <locale.h>
-// Setting the locale is not supported on OS X (you can set the C locale,
-// but that won't affect CFStringCompare which is used to compare strings).
-// On Windows other than Win CE, we cannot set the system or user locale.
-#if !defined(Q_OS_MAC) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
void tst_QString::localeAwareCompare_data()
{
#ifdef Q_OS_WIN
@@ -4264,6 +4258,9 @@ void tst_QString::localeAwareCompare_data()
void tst_QString::localeAwareCompare()
{
#ifdef Q_OS_WIN
+# ifndef Q_OS_WINCE
+ QSKIP("On others than Win CE, we cannot set the system or user locale.");
+# endif
QFETCH(ulong, locale);
#else
QFETCH(QString, locale);
@@ -4288,6 +4285,8 @@ void tst_QString::localeAwareCompare()
QCOMPARE(locale, GetThreadLocale());
# endif
+#elif defined (Q_OS_MAC)
+ QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)");
#elif defined(QT_USE_ICU)
QLocale::setDefault(QLocale(locale));
#else
@@ -4362,7 +4361,6 @@ void tst_QString::localeAwareCompare()
setlocale(LC_ALL, "");
#endif
}
-#endif
void tst_QString::split_data()
{
@@ -5007,9 +5005,12 @@ void tst_QString::QTBUG9281_arg_locale()
QLocale::setDefault(QLocale::C);
}
-#ifdef QT_USE_ICU
void tst_QString::toUpperLower_icu()
{
+#ifndef QT_USE_ICU
+ QSKIP("Qt was built without ICU support");
+#endif
+
QString s = QString::fromLatin1("i");
QCOMPARE(s.toUpper(), QString::fromLatin1("I"));
@@ -5042,12 +5043,10 @@ void tst_QString::toUpperLower_icu()
// the cleanup function will restore the default locale
}
-#endif
-// Only tested on c++0x compliant compiler or gcc.
-#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
void tst_QString::literals()
{
+#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
QString str(QStringLiteral("abcd"));
QVERIFY(str.length() == 4);
@@ -5064,8 +5063,11 @@ void tst_QString::literals()
QVERIFY(str2.constData() == s);
QVERIFY(str2.data() != s);
-}
+
+#else
+ QSKIP("Only tested on c++0x compliant compiler or gcc");
#endif
+}
void tst_QString::reserve()
{
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index 08485e87e0..e8a6335cee 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -66,9 +66,7 @@ private slots:
void join_data() const;
void joinEmptiness() const;
-#ifdef Q_COMPILER_INITIALIZER_LISTS
void initializeList() const;
-#endif
};
extern const char email[];
@@ -296,15 +294,16 @@ void tst_QStringList::joinEmptiness() const
QVERIFY(string.isNull());
}
-// this test require C++0x support
-#ifdef Q_COMPILER_INITIALIZER_LISTS
void tst_QStringList::initializeList() const
{
+#ifdef Q_COMPILER_INITIALIZER_LISTS
QStringList v1{QLatin1String("hello"),"world",QString::fromLatin1("plop")};
QCOMPARE(v1, (QStringList() << "hello" << "world" << "plop"));
QCOMPARE(v1, (QStringList{"hello","world","plop"}));
-}
+#else
+ QSKIP("Require C++0x support, pass the right flag to the compiler");
#endif
+}
QTEST_APPLESS_MAIN(tst_QStringList)
#include "tst_qstringlist.moc"