From a8fd0c3654f8352773638633778cd8003680cbc7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 15 Nov 2011 11:36:18 +1000 Subject: 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 --- .../qtconcurrentrun/tst_qtconcurrentrun.cpp | 16 +- .../corelib/io/qdatastream/tst_qdatastream.cpp | 20 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 9 +- .../corelib/io/qdiriterator/tst_qdiriterator.cpp | 16 +- .../corelib/io/qfile/largefile/tst_largefile.cpp | 9 +- tests/auto/corelib/io/qfile/tst_qfile.cpp | 74 ++--- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 24 +- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 18 +- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 303 ++++++++++----------- .../tst_qprocessenvironment.cpp | 9 +- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 21 +- .../corelib/io/qtextstream/tst_qtextstream.cpp | 32 +-- .../corelib/kernel/qeventloop/tst_qeventloop.cpp | 17 +- .../kernel/qsocketnotifier/tst_qsocketnotifier.cpp | 8 +- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 9 +- .../corelib/tools/qbytearray/tst_qbytearray.cpp | 9 +- .../auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 8 +- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 30 +- .../tools/qsharedpointer/tst_qsharedpointer.cpp | 18 +- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 60 ++-- .../corelib/tools/qstringlist/tst_qstringlist.cpp | 9 +- .../auto/gui/kernel/qclipboard/tst_qclipboard.cpp | 13 +- .../gui/kernel/qkeysequence/tst_qkeysequence.cpp | 19 +- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 8 +- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 27 +- tests/auto/gui/painting/qprinter/tst_qprinter.cpp | 17 +- .../gui/painting/qprinterinfo/tst_qprinterinfo.cpp | 14 +- tests/auto/gui/text/qfont/tst_qfont.cpp | 25 +- .../gui/text/qfontdatabase/tst_qfontdatabase.cpp | 8 +- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 46 ++-- .../qtextscriptengine/tst_qtextscriptengine.cpp | 95 ++++--- .../collections/tst_collections.cpp | 8 +- .../qaccessibility/tst_qaccessibility.cpp | 42 ++- .../qfocusevent/tst_qfocusevent.cpp | 9 +- .../access/qnetworkreply/tst_qnetworkreply.cpp | 8 +- .../tst_platformsocketengine.cpp | 18 +- .../network/socket/qtcpsocket/tst_qtcpsocket.cpp | 38 +-- .../network/socket/qudpsocket/tst_qudpsocket.cpp | 21 +- tests/auto/other/compiler/tst_compiler.cpp | 46 ++-- tests/auto/tools/moc/tst_moc.cpp | 133 +++++---- tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 34 +-- .../dialogs/qfiledialog/tst_qfiledialog.cpp | 9 +- .../dialogs/qmessagebox/tst_qmessagebox.cpp | 8 +- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 9 +- .../tst_qgraphicsgridlayout.cpp | 16 +- .../tst_qgraphicsproxywidget.cpp | 19 +- .../qgraphicsscene/tst_qgraphicsscene.cpp | 7 +- .../qgraphicsview/tst_qgraphicsview.cpp | 35 +-- .../widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 22 +- .../widgets/itemviews/qlistview/tst_qlistview.cpp | 9 +- .../itemviews/qtableview/tst_qtableview.cpp | 8 +- .../kernel/qwidget_window/tst_qwidget_window.cpp | 9 +- tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 24 +- .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 10 +- .../auto/widgets/util/qscroller/tst_qscroller.cpp | 22 +- tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp | 8 +- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 7 +- .../widgets/qmainwindow/tst_qmainwindow.cpp | 17 +- .../widgets/qmdisubwindow/tst_qmdisubwindow.cpp | 8 +- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 16 +- .../auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 82 +++--- 61 files changed, 848 insertions(+), 845 deletions(-) (limited to 'tests/auto') 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 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 #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("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"); +#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(stateSpy.at(1).at(0)), QProcess::Running); QCOMPARE(qVariantValue(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("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("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("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("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("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,21 +2149,22 @@ 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 process->start("testSetWorkingDirectory/testSetWorkingDirectory.app"); #else process->start("testSetWorkingDirectory/testSetWorkingDirectory"); +#endif +#ifndef Q_OS_WIN + QSKIP("setWorkingDirectory will chdir before starting the process on unices"); #endif QVERIFY(process->waitForFinished()); @@ -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("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 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 days; days << Qt::Monday << Qt::Tuesday << Qt::Wednesday << Qt::Thursday << Qt::Friday; QCOMPARE(locale.weekdays(), days); + } -#endif #ifdef Q_OS_WIN #include @@ -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 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"); @@ -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 -// 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" diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 4f6c7defda..9458a97c6f 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -55,9 +55,7 @@ class tst_QClipboard : public QObject { Q_OBJECT private slots: -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC)) && !defined(QT_NO_PROCESS) void copy_exit_paste(); -#endif void capabiliyFunctions(); void modes(); void testSignals(); @@ -188,12 +186,13 @@ void tst_QClipboard::testSignals() } // Test that pasted text remains on the clipboard after a Qt application exits. -// This test does not make sense on X11 and embedded, as copied data disappears -// from the clipboard when the application exits. It's still possible to test -// copy/paste - just keep the apps running. -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC)) && !defined(QT_NO_PROCESS) void tst_QClipboard::copy_exit_paste() { +#ifndef QT_NO_PROCESS +#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) + QSKIP("This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits "); + // ### It's still possible to test copy/paste - just keep the apps running +#endif if (!nativeClipboardWorking()) QSKIP("Native clipboard not working in this setup"); const QStringList stringArgument = QStringList() << "Test string."; @@ -203,8 +202,8 @@ void tst_QClipboard::copy_exit_paste() QTest::qWait(100); #endif QCOMPARE(QProcess::execute("paster/paster", stringArgument), 0); -} #endif +} void tst_QClipboard::setMimeData() { diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 0a2a20a29b..44380d2cd1 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -121,10 +121,8 @@ private slots: void symetricConstructors(); void checkMultipleNames(); void checkMultipleCodes(); -#ifndef Q_WS_MAC void mnemonic_data(); void mnemonic(); -#endif void toString_data(); void toString(); void streamOperators_data(); @@ -135,10 +133,8 @@ private slots: void standardKeys_data(); void standardKeys(); void keyBindings(); -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) void translated_data(); void translated(); -#endif void i18nKeys_data(); void i18nKeys(); @@ -384,8 +380,6 @@ void tst_QKeySequence::keyBindings() QVERIFY(bindings == expected); } -// mnemonics are not used on Mac OS X. -#ifndef Q_WS_MAC void tst_QKeySequence::mnemonic_data() { QTest::addColumn("string"); @@ -407,6 +401,9 @@ void tst_QKeySequence::mnemonic_data() void tst_QKeySequence::mnemonic() { +#ifdef Q_WS_MAC + QSKIP("mnemonics are not used on Mac OS X"); +#endif QFETCH(QString, string); QFETCH(QString, key); QFETCH(bool, warning); @@ -423,7 +420,6 @@ void tst_QKeySequence::mnemonic() QCOMPARE(seq, res); } -#endif void tst_QKeySequence::toString_data() { @@ -531,8 +527,6 @@ void tst_QKeySequence::fromString() QCOMPARE(ks4, ks1); } -// No need to translate modifiers on Mac OS X or WinCE. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) void tst_QKeySequence::translated_data() { qApp->installTranslator(ourTranslator); @@ -564,6 +558,11 @@ void tst_QKeySequence::translated() { QFETCH(QString, transKey); QFETCH(QString, compKey); +#ifdef Q_WS_MAC + QSKIP("No need to translate modifiers on Mac OS X"); +#elif defined(Q_OS_WINCE) + QSKIP("No need to translate modifiers on WinCE"); +#endif qApp->installTranslator(ourTranslator); qApp->installTranslator(qtTranslator); @@ -574,7 +573,7 @@ void tst_QKeySequence::translated() qApp->removeTranslator(ourTranslator); qApp->removeTranslator(qtTranslator); } -#endif + void tst_QKeySequence::i18nKeys_data() { diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 7db941bb20..1090b5ddcf 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -111,7 +111,7 @@ private slots: void achromaticHslHue(); -#if defined(Q_WS_X11) && !defined(Q_OS_IRIX) +#ifdef Q_WS_X11 void setallowX11ColorNames(); #endif }; @@ -1335,10 +1335,12 @@ void tst_QColor::achromaticHslHue() QCOMPARE(hsl.hslHue(), -1); } -// This test fails on IRIX due to the gamma settings in the SGI X server. -#if defined(Q_WS_X11) && !defined(Q_OS_IRIX) +#ifdef Q_WS_X11 void tst_QColor::setallowX11ColorNames() { +#if defined(Q_OS_IRIX) + QSKIP("This fails due to the gamma settings in the SGI X server"); +#endif RGBData x11RgbTbl[] = { // a few standard X11 color names { "DodgerBlue1", qRgb(30, 144, 255) }, diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index d41e0e4650..529bb3ee20 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -94,10 +94,8 @@ public slots: void cleanup(); private slots: void getSetCheck(); -#ifndef Q_WS_MAC void drawPixmap_comp_data(); void drawPixmap_comp(); -#endif void saveAndRestore_data(); void saveAndRestore(); @@ -183,10 +181,8 @@ private slots: void fillRect_stretchToDeviceMode(); void monoImages(); -#ifndef Q_WS_QWS void linearGradientSymmetry_data(); void linearGradientSymmetry(); -#endif void gradientInterpolation(); void fpe_pixmapTransform(); @@ -219,9 +215,7 @@ private slots: void drawRect_task215378(); void drawRect_task247505(); -#if defined(Q_OS_MAC) void drawText_subPixelPositionsInRaster_qtbug5053(); -#endif void drawImage_data(); void drawImage(); @@ -416,8 +410,6 @@ static const char* const maskResult_data[] = { "...ddddddddddddd"}; -// Mac has other ideas about alpha composition -#ifndef Q_WS_MAC void tst_QPainter::drawPixmap_comp_data() { if (qApp->desktop()->depth() < 24) @@ -462,6 +454,9 @@ QRgb qt_compose_alpha(QRgb source, QRgb dest) */ void tst_QPainter::drawPixmap_comp() { +#ifdef Q_WS_MAC + QSKIP("Mac has other ideas about alpha composition"); +#endif QFETCH(uint, dest); QFETCH(uint, source); @@ -509,7 +504,6 @@ void tst_QPainter::drawPixmap_comp() QVERIFY(!different); } -#endif void tst_QPainter::saveAndRestore_data() { @@ -3522,8 +3516,6 @@ static QLinearGradient inverseGradient(QLinearGradient g) return g2; } -// QWS has limited resolution in the gradient color table -#ifndef Q_WS_QWS void tst_QPainter::linearGradientSymmetry_data() { QTest::addColumn("stops"); @@ -3555,6 +3547,9 @@ void tst_QPainter::linearGradientSymmetry_data() void tst_QPainter::linearGradientSymmetry() { +#ifdef Q_WS_QWS + QSKIP("QWS has limited resolution in the gradient color table"); +#else QFETCH(QGradientStops, stops); QImage a(64, 8, QImage::Format_ARGB32_Premultiplied); @@ -3576,8 +3571,8 @@ void tst_QPainter::linearGradientSymmetry() b = b.mirrored(true); QCOMPARE(a, b); -} #endif +} void tst_QPainter::gradientInterpolation() { @@ -4148,11 +4143,12 @@ void tst_QPainter::clipBoundingRect() } -//Only Mac/Cocoa supports sub pixel positions in raster engine currently -#ifdef Q_OS_MAC void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053() { - QFontMetricsF fm(qApp->font()); +#if !defined(Q_OS_MAC) + QSKIP("Only Mac supports sub pixel positions in raster engine currently"); +#endif + QFontMetricsF fm(qApp->font()); QImage baseLine(fm.width(QChar::fromLatin1('e')), fm.height(), QImage::Format_RGB32); baseLine.fill(Qt::white); @@ -4179,7 +4175,6 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053() QVERIFY(foundDifferentRasterization); } -#endif void tst_QPainter::drawPointScaled() { diff --git a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp index 0fac12d227..cbfa8a2d35 100644 --- a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp +++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp @@ -74,17 +74,13 @@ public slots: private slots: void getSetCheck(); // Add your testfunctions and testdata create functions here -#ifdef Q_WS_WIN void testPageSize(); -#endif void testPageRectAndPaperRect(); void testPageRectAndPaperRect_data(); void testSetOptions(); void testMargins_data(); void testMargins(); -#ifdef Q_OS_WIN void testNonExistentPrinter(); -#endif // Q_OS_WIN void testPageSetupDialog(); void testMulitpleSets_data(); void testMulitpleSets(); @@ -224,10 +220,11 @@ void tst_QPrinter::testPageSetupDialog() } } -// QPrinter::winPageSize() does not exist for non-Windows platforms. -#ifdef Q_WS_WIN void tst_QPrinter::testPageSize() { +#ifndef Q_OS_WIN + QSKIP("QPrinter::winPageSize() does not exist for non-Windows platforms"); +#else QPrinter prn; prn.setPageSize(QPrinter::Letter); @@ -245,8 +242,8 @@ void tst_QPrinter::testPageSize() prn.setWinPageSize(DMPAPER_A4); MYCOMPARE(prn.winPageSize(), DMPAPER_A4); MYCOMPARE(prn.pageSize(), QPrinter::A4); -} #endif +} void tst_QPrinter::testPageRectAndPaperRect_data() { @@ -385,9 +382,11 @@ void tst_QPrinter::testMargins() delete painter; } -#ifdef Q_OS_WIN void tst_QPrinter::testNonExistentPrinter() { +#ifndef Q_OS_WIN + QSKIP("QPrinter::testNonExistentPrinter() is not relevant for this platform"); +#else QPrinter printer; QPainter painter; @@ -415,8 +414,8 @@ void tst_QPrinter::testNonExistentPrinter() QCOMPARE(printer.printEngine()->metric(QPaintDevice::PdmPhysicalDpiY), 0); QVERIFY(!painter.begin(&printer)); +#endif } -#endif // Q_OS_WIN void tst_QPrinter::testMulitpleSets_data() { diff --git a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp index e039347801..f9734df10d 100644 --- a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp @@ -66,10 +66,8 @@ public slots: void initTestCase(); #else private slots: -#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void testForDefaultPrinter(); void testForPrinters(); -#endif void testForPaperSizes(); void testConstructors(); void testAssignment(); @@ -208,9 +206,9 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command) #endif } -#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void tst_QPrinterInfo::testForDefaultPrinter() { +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) # ifdef Q_OS_WIN32 if (QHostInfo::localHostName() == "fantomet" || QHostInfo::localHostName() == "bobo") { QWARN("Test is hardcoded to \"fantomet\" and \"bobo\" on Windows and may fail"); @@ -242,12 +240,14 @@ void tst_QPrinterInfo::testForDefaultPrinter() } if (!found && defSysPrinter != "") QFAIL("No default printer reported by Qt, although there is one"); -} +#else + QSKIP("Test doesn't work on non-Unix"); #endif +} -#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void tst_QPrinterInfo::testForPrinters() { +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) # ifdef Q_OS_WIN32 if (QHostInfo::localHostName() == "fantomet" || QHostInfo::localHostName() == "bobo") { QWARN("Test is hardcoded to \"fantomet\" and \"bobo\" on Windows and may fail"); @@ -291,8 +291,10 @@ void tst_QPrinterInfo::testForPrinters() QFAIL(qPrintable(QString("Printer '%1' reported by system, but not reported by Qt").arg(sysPrinters.at(i)))); } } -} +#else + QSKIP("Test doesn't work on non-Unix"); #endif +} void tst_QPrinterInfo::testForPaperSizes() { diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index a949c91362..0c932e38a5 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -67,23 +67,17 @@ public slots: void cleanup(); private slots: void getSetCheck(); -#ifndef Q_WS_WIN void exactMatch(); -#endif void compare(); void resolve(); void resetFont(); void isCopyOf(); -#ifdef Q_WS_X11 void setFontRaw(); -#endif void italicOblique(); void insertAndRemoveSubstitutions(); void serializeSpacing(); void lastResortFont(); -#if defined(Q_WS_MAC) void styleName(); -#endif #ifdef QT_BUILD_INTERNAL void defaultFamily_data(); void defaultFamily(); @@ -148,8 +142,6 @@ void tst_QFont::cleanup() // This will be executed immediately after each test is run. } -// Exact matching on windows misses a lot because of the sample chars. -#ifndef Q_WS_WIN void tst_QFont::exactMatch() { QFont font; @@ -158,6 +150,10 @@ void tst_QFont::exactMatch() font = QFont( "BogusFont", 33 ); QVERIFY( !font.exactMatch() ); +#ifdef Q_WS_WIN + QSKIP("Exact matching on windows misses a lot because of the sample chars"); +#endif + #ifdef Q_WS_X11 QVERIFY(QFont("sans").exactMatch()); QVERIFY(QFont("sans-serif").exactMatch()); @@ -305,7 +301,6 @@ void tst_QFont::exactMatch() } } } -#endif void tst_QFont::italicOblique() { @@ -519,9 +514,11 @@ void tst_QFont::isCopyOf() QVERIFY(!font3.isCopyOf(font)); } -#ifdef Q_WS_X11 void tst_QFont::setFontRaw() { +#ifndef Q_WS_X11 + QSKIP("Only tested on X11"); +#else QFont f; f.setRawName("-*-fixed-bold-r-normal--0-0-*-*-*-0-iso8859-1"); // qDebug("font family: %s", f.family().utf8()); @@ -538,8 +535,8 @@ void tst_QFont::setFontRaw() if (!found) QSKIP("Fixed font not available."); QCOMPARE(QFontInfo(f).family().left(5).toLower(), QString("fixed")); -} #endif +} void tst_QFont::insertAndRemoveSubstitutions() { @@ -617,15 +614,17 @@ void tst_QFont::lastResortFont() QVERIFY(!font.lastResortFont().isEmpty()); } -#if defined(Q_WS_MAC) void tst_QFont::styleName() { +#if !defined(Q_WS_MAC) + QSKIP("Only tested on Mac"); +#else QFont font("Helvetica Neue"); font.setStyleName("UltraLight"); QCOMPARE(QFontInfo(font).styleName(), QString("UltraLight")); -} #endif +} #ifdef QT_BUILD_INTERNAL Q_DECLARE_METATYPE(QFont::StyleHint) diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index c3b942f331..6886a687df 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -63,10 +63,8 @@ private slots: void styles_data(); void styles(); -#ifndef Q_WS_QWS void fixedPitch_data(); void fixedPitch(); -#endif #ifdef Q_WS_MAC void trickyFonts_data(); @@ -127,8 +125,6 @@ void tst_QFontDatabase::styles() } } -// fixedPitch not implemented for Qtopia Core. -#ifndef Q_WS_QWS void tst_QFontDatabase::fixedPitch_data() { QTest::addColumn("font"); @@ -152,6 +148,9 @@ void tst_QFontDatabase::fixedPitch_data() void tst_QFontDatabase::fixedPitch() { +#ifdef Q_WS_QWS + QSKIP("fixedPitch not implemented for Qtopia Core"); +#endif QFETCH(QString, font); QFETCH(bool, fixedPitch); @@ -165,7 +164,6 @@ void tst_QFontDatabase::fixedPitch() QFontInfo fi(qfont); QCOMPARE(fi.fixedPitch(), fixedPitch); } -#endif #ifdef Q_WS_MAC void tst_QFontDatabase::trickyFonts_data() diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 0e1b3aaa1f..f1c2f6e4de 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -74,19 +74,13 @@ public slots: void cleanup(); private slots: void getSetCheck(); -#ifdef Q_WS_X11 void lineBreaking(); -#endif void simpleBoundingRect(); -#ifndef Q_WS_MAC void threeLineBoundingRect(); -#endif void boundingRectWithLongLineAndNoWrap(); void forcedBreaks(); -#ifndef Q_WS_MAC void breakAny(); void noWrap(); -#endif void cursorToXForInlineObjects(); void cursorToXForSetColumns(); void defaultWordSeparators_data(); @@ -94,14 +88,10 @@ private slots: void cursorMovementFromInvalidPositions(); void cursorMovementInsideSpaces(); void charWordStopOnLineSeparator(); -#ifndef Q_WS_MAC void xToCursorAtEndOfLine(); -#endif void boundingRectTopLeft(); void charStopForSurrogatePairs(); -#ifndef Q_WS_MAC void tabStops(); -#endif void integerOverflow(); void testDefaultTabs(); void testTabs(); @@ -210,9 +200,9 @@ void tst_QTextLayout::cleanup() testFont = QFont(); } -#ifdef Q_WS_X11 void tst_QTextLayout::lineBreaking() { +#if defined(Q_WS_X11) struct Breaks { const char *utf8; uchar breaks[32]; @@ -289,8 +279,10 @@ void tst_QTextLayout::lineBreaking() QCOMPARE(b->breaks[i], (uchar)0xff); ++b; } -} +#else + QSKIP("This test can not be run on non-X11 platforms"); #endif +} void tst_QTextLayout::simpleBoundingRect() { @@ -309,10 +301,11 @@ void tst_QTextLayout::simpleBoundingRect() QCOMPARE(layout.boundingRect(), QRectF(0, 0, width, QFontMetrics(testFont).height())); } -// QTestFontEngine on the mac does not support logclusters at the moment. -#ifndef Q_WS_MAC void tst_QTextLayout::threeLineBoundingRect() { +#if defined(Q_WS_MAC) + QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); +#endif /* stricter check. break text into three lines */ QString firstWord("hello"); @@ -364,7 +357,6 @@ void tst_QTextLayout::threeLineBoundingRect() QCOMPARE(layout.boundingRect(), QRectF(0, 0, longestLine, y + 1)); } -#endif void tst_QTextLayout::boundingRectWithLongLineAndNoWrap() { @@ -428,10 +420,11 @@ void tst_QTextLayout::forcedBreaks() QCOMPARE(line.xToCursor(0), line.textStart()); } -// QTestFontEngine on the mac does not support logclusters at the moment. -#ifndef Q_WS_MAC void tst_QTextLayout::breakAny() { +#if defined(Q_WS_MAC) + QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); +#endif QString text = "ABCD"; QTextLayout layout(text, testFont); @@ -468,12 +461,12 @@ void tst_QTextLayout::breakAny() layout.endLayout(); } -#endif -// QTestFontEngine on the mac does not support logclusters at the moment. -#ifndef Q_WS_MAC void tst_QTextLayout::noWrap() { +#if defined(Q_WS_MAC) + QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); +#endif QString text = "AB CD"; QTextLayout layout(text, testFont); @@ -494,7 +487,6 @@ void tst_QTextLayout::noWrap() layout.endLayout(); } -#endif void tst_QTextLayout::cursorToXForInlineObjects() { @@ -614,10 +606,11 @@ void tst_QTextLayout::charWordStopOnLineSeparator() QVERIFY(attrs[1].charStop); } -// QTestFontEngine on the mac does not support logclusters at the moment. -#ifndef Q_WS_MAC void tst_QTextLayout::xToCursorAtEndOfLine() { +#if defined(Q_WS_MAC) + QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); +#endif QString text = "FirstLine SecondLine"; text.replace('\n', QChar::LineSeparator); @@ -638,7 +631,6 @@ void tst_QTextLayout::xToCursorAtEndOfLine() line = layout.lineAt(1); QCOMPARE(line.xToCursor(100000), 20); } -#endif void tst_QTextLayout::boundingRectTopLeft() { @@ -676,10 +668,11 @@ void tst_QTextLayout::charStopForSurrogatePairs() QVERIFY(attrs[3].charStop); } -// QTestFontEngine on the mac does not support logclusters at the moment. -#ifndef Q_WS_MAC void tst_QTextLayout::tabStops() { +#if defined(Q_WS_MAC) + QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); +#endif QString txt("Hello there\tworld"); QTextLayout layout(txt, testFont); layout.beginLayout(); @@ -696,7 +689,6 @@ void tst_QTextLayout::tabStops() layout.endLayout(); } -#endif void tst_QTextLayout::integerOverflow() { diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index 0149a0a0a0..55ad866874 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -90,7 +90,6 @@ public slots: void init(); void cleanup(); private slots: -#ifdef Q_WS_X11 void devanagari(); void bengali(); void gurmukhi(); @@ -106,15 +105,10 @@ private slots: void khmer(); void linearB(); void controlInSyllable_qtbug14204(); -#endif -#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) void combiningMarks_qtbug15675(); -#endif -#ifndef Q_WS_MAC void mirroredChars_data(); void mirroredChars(); -#endif private: bool haveTestFonts; @@ -204,9 +198,9 @@ static bool shaping( const QFont &f, const ShapeTable *s) } #endif -#ifdef Q_WS_X11 void tst_QTextScriptEngine::devanagari() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -312,12 +306,14 @@ void tst_QTextScriptEngine::devanagari() } else QSKIP("couldn't find mangal"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::bengali() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -561,12 +557,14 @@ void tst_QTextScriptEngine::bengali() } else QSKIP("couldn't find Likhan"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::gurmukhi() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -588,12 +586,14 @@ void tst_QTextScriptEngine::gurmukhi() } else QSKIP("couldn't find Lohit Punjabi"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::oriya() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -626,13 +626,15 @@ void tst_QTextScriptEngine::oriya() } } else QSKIP("couldn't find utkal"); - } -} + } +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::tamil() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -703,12 +705,14 @@ void tst_QTextScriptEngine::tamil() } else QSKIP("couldn't find AkrutiTml1"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::telugu() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -750,12 +754,14 @@ void tst_QTextScriptEngine::telugu() } else QSKIP("couldn't find Pothana2000"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::kannada() { +#if defined(Q_WS_X11) { if (QFontDatabase().families(QFontDatabase::Kannada).contains("Sampige")) { QFont f("Sampige"); @@ -823,12 +829,14 @@ void tst_QTextScriptEngine::kannada() } else QSKIP("couldn't find Tunga"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::malayalam() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -909,12 +917,14 @@ void tst_QTextScriptEngine::malayalam() } else QSKIP("couldn't find Rachana"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::sinhala() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -946,12 +956,14 @@ void tst_QTextScriptEngine::sinhala() } else QSKIP("couldn't find Malithi Web"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::khmer() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -989,12 +1001,14 @@ void tst_QTextScriptEngine::khmer() } else QSKIP("couldn't find Khmer OS"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#ifdef Q_WS_X11 void tst_QTextScriptEngine::linearB() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -1016,8 +1030,10 @@ void tst_QTextScriptEngine::linearB() } else QSKIP("couldn't find Penuturesu"); } -} +#else + QSKIP("X11 specific test"); #endif +} #if defined(Q_WS_X11) static bool decomposedShaping( const QFont &f, const QChar &ch) @@ -1066,9 +1082,9 @@ static bool decomposedShaping( const QFont &f, const QChar &ch) } #endif -#ifdef Q_WS_X11 void tst_QTextScriptEngine::greek() { +#if defined(Q_WS_X11) if (!haveTestFonts) QSKIP("Test fonts are not available"); @@ -1124,12 +1140,14 @@ void tst_QTextScriptEngine::greek() } else QSKIP("couldn't find SBL_grk"); } -} +#else + QSKIP("X11 specific test"); #endif +} -#if defined(Q_WS_X11) void tst_QTextScriptEngine::controlInSyllable_qtbug14204() { +#if defined(Q_WS_X11) QString s; s.append(QChar(0x0915)); s.append(QChar(0x094d)); @@ -1143,10 +1161,11 @@ void tst_QTextScriptEngine::controlInSyllable_qtbug14204() QVERIFY(e->layoutData->items[0].num_glyphs == 2); QVERIFY(e->layoutData->glyphLayout.advances_x[1] != 0); -} +#else + QSKIP("X11 specific test"); #endif +} -#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) void tst_QTextScriptEngine::combiningMarks_qtbug15675() { #if defined(Q_WS_MAC) @@ -1182,11 +1201,11 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675() QVERIFY(e->layoutData->items[0].num_glyphs == 3); QVERIFY(e->layoutData->glyphLayout.advances_x[1] == 0); +#else + QSKIP("X11/Mac specific test"); #endif } -#endif -#ifndef Q_WS_MAC void tst_QTextScriptEngine::mirroredChars_data() { QTest::addColumn("hintingPreference"); @@ -1199,6 +1218,9 @@ void tst_QTextScriptEngine::mirroredChars_data() void tst_QTextScriptEngine::mirroredChars() { +#if defined(Q_WS_MAC) + QSKIP("Not supported on Mac"); +#endif QFETCH(int, hintingPreference); QFont font; @@ -1240,7 +1262,6 @@ void tst_QTextScriptEngine::mirroredChars() QCOMPARE(glyphLayout.glyphs[1], leftParenthesis); } } -#endif QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" diff --git a/tests/auto/integrationtests/collections/tst_collections.cpp b/tests/auto/integrationtests/collections/tst_collections.cpp index a4901942bf..39017781d1 100644 --- a/tests/auto/integrationtests/collections/tst_collections.cpp +++ b/tests/auto/integrationtests/collections/tst_collections.cpp @@ -152,9 +152,7 @@ private slots: void qtimerList(); void containerTypedefs(); void forwardDeclared(); -#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN) void alignment(); -#endif void QTBUG13079_collectionInsideCollection(); void foreach_2(); @@ -3397,6 +3395,12 @@ void tst_Collections::alignment() testAssociativeContainerAlignment >(); testAssociativeContainerAlignment >(); } + +#else +void tst_Collections::alignment() +{ + QSKIP("Compiler doesn't support necessary extension keywords"); +} #endif #ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS diff --git a/tests/auto/integrationtests/qaccessibility/tst_qaccessibility.cpp b/tests/auto/integrationtests/qaccessibility/tst_qaccessibility.cpp index 6f41bc0f61..9b2d015005 100644 --- a/tests/auto/integrationtests/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/integrationtests/qaccessibility/tst_qaccessibility.cpp @@ -247,18 +247,14 @@ private slots: void abstractScrollAreaTest(); void scrollAreaTest(); - // Accessible table1 interface is no longer supported on X11, - // where it has been replaced by table2 interface. -#ifndef Q_OS_UNIX void listViewTest(); void treeWidgetTest(); void tableWidgetTest(); void tableViewTest(); -#else + void table2ListTest(); void table2TreeTest(); void table2TableTest(); -#endif void calendarWidgetTest(); void dockWidgetTest(); @@ -2469,12 +2465,11 @@ void tst_QAccessibility::scrollAreaTest() QTestAccessibility::clearEvents(); } -// Accessible table1 interface is no longer supported on X11, -// where it has been replaced by table2 interface. -#ifndef Q_OS_UNIX - void tst_QAccessibility::listViewTest() { +#if defined(Q_OS_UNIX) + QSKIP( "Accessible table1 interface is no longer supported on X11."); +#else { QListView listView; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView); @@ -2535,10 +2530,14 @@ void tst_QAccessibility::listViewTest() delete iface; } QTestAccessibility::clearEvents(); +#endif } void tst_QAccessibility::treeWidgetTest() { +#if defined(Q_OS_UNIX) + QSKIP( "Accessible table1 interface is no longer supported on X11."); +#else QWidget *w = new QWidget; QTreeWidget *tree = new QTreeWidget(w); QHBoxLayout *l = new QHBoxLayout(w); @@ -2591,10 +2590,14 @@ void tst_QAccessibility::treeWidgetTest() delete w; QTestAccessibility::clearEvents(); +#endif } void tst_QAccessibility::tableWidgetTest() { +#if defined(Q_OS_UNIX) + QSKIP( "Accessible table1 interface is no longer supported on X11."); +#else { QWidget *topLevel = new QWidget; QTableWidget *w = new QTableWidget(8,4,topLevel); @@ -2631,6 +2634,7 @@ void tst_QAccessibility::tableWidgetTest() delete topLevel; } QTestAccessibility::clearEvents(); +#endif } class QtTestTableModel: public QAbstractTableModel @@ -2713,6 +2717,9 @@ public: void tst_QAccessibility::tableViewTest() { +#if defined(Q_OS_UNIX) + QSKIP( "Accessible table1 interface is no longer supported on X11."); +#else { QtTestTableModel *model = new QtTestTableModel(3, 4); QTableView *w = new QTableView(); @@ -2789,13 +2796,14 @@ void tst_QAccessibility::tableViewTest() delete model; } QTestAccessibility::clearEvents(); +#endif } -#else -// Test accessible table2 interface on unix - void tst_QAccessibility::table2ListTest() { +#if !defined(Q_OS_UNIX) + QSKIP( "Accessible table2 interface is currently only supported on X11."); +#else QListWidget *listView = new QListWidget; listView->addItem("Oslo"); listView->addItem("Berlin"); @@ -2867,10 +2875,14 @@ void tst_QAccessibility::table2ListTest() delete iface; delete listView; QTestAccessibility::clearEvents(); +#endif } void tst_QAccessibility::table2TreeTest() { +#if !defined(Q_OS_UNIX) + QSKIP( "Accessible table2 interface is currently only supported on X11."); +#else QTreeWidget *treeView = new QTreeWidget; treeView->setColumnCount(2); QTreeWidgetItem *header = new QTreeWidgetItem; @@ -2986,10 +2998,14 @@ void tst_QAccessibility::table2TreeTest() delete iface; QTestAccessibility::clearEvents(); +#endif } void tst_QAccessibility::table2TableTest() { +#if !defined(Q_OS_UNIX) + QSKIP( "Accessible table2 interface is currently only supported on X11."); +#else QTableWidget *tableView = new QTableWidget(3, 3); tableView->setColumnCount(3); QStringList hHeader; @@ -3089,8 +3105,8 @@ void tst_QAccessibility::table2TableTest() delete tableView; QTestAccessibility::clearEvents(); -} #endif +} void tst_QAccessibility::calendarWidgetTest() { diff --git a/tests/auto/integrationtests/qfocusevent/tst_qfocusevent.cpp b/tests/auto/integrationtests/qfocusevent/tst_qfocusevent.cpp index 931059b211..cc58b6212c 100644 --- a/tests/auto/integrationtests/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/integrationtests/qfocusevent/tst_qfocusevent.cpp @@ -106,9 +106,7 @@ public slots: private slots: void checkReason_Tab(); void checkReason_ShiftTab(); -#ifndef Q_OS_WIN32 void checkReason_BackTab(); -#endif void checkReason_Popup(); void checkReason_focusWidget(); void checkReason_Shortcut(); @@ -230,10 +228,11 @@ void tst_QFocusEvent::checkReason_ShiftTab() /*! In this test we verify that the Qt::KeyBacktab key is handled in a qfocusevent */ -// Backtab is not supported on Windows. -#ifndef Q_OS_WIN32 void tst_QFocusEvent::checkReason_BackTab() { +#ifdef Q_OS_WIN32 // key is not supported on Windows + QSKIP( "Backtab is not supported on Windows"); +#else initWidget(); QVERIFY( childFocusWidgetOne->hasFocus() ); @@ -249,8 +248,8 @@ void tst_QFocusEvent::checkReason_BackTab() QVERIFY( childFocusWidgetTwo->hasFocus() ); QCOMPARE( childFocusWidgetOne->focusOutEventReason, int(Qt::BacktabFocusReason) ); QCOMPARE( childFocusWidgetTwo->focusInEventReason, int(Qt::BacktabFocusReason) ); -} #endif +} void tst_QFocusEvent::checkReason_Popup() { diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 7f00ba90ca..6d7cce505d 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -263,7 +263,7 @@ private Q_SLOTS: void ioPutToFileFromSocket(); void ioPutToFileFromLocalSocket_data(); void ioPutToFileFromLocalSocket(); -#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) +#ifndef QT_NO_PROCESS void ioPutToFileFromProcess_data(); void ioPutToFileFromProcess(); #endif @@ -3812,7 +3812,7 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket() } // Currently no stdin/out supported for Windows CE. -#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) +#ifndef QT_NO_PROCESS void tst_QNetworkReply::ioPutToFileFromProcess_data() { putToFile_data(); @@ -3820,6 +3820,9 @@ void tst_QNetworkReply::ioPutToFileFromProcess_data() void tst_QNetworkReply::ioPutToFileFromProcess() { +#if defined(Q_OS_WINCE) + QSKIP("Currently no stdin/out supported for Windows CE"); +#else #ifdef Q_OS_WIN if (qstrcmp(QTest::currentDataTag(), "small") == 0) QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, " @@ -3852,6 +3855,7 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QCOMPARE(file.size(), qint64(data.size())); QByteArray contents = file.readAll(); QCOMPARE(contents, data); +#endif } #endif diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 4638e33ee0..103ea1323e 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -85,9 +85,7 @@ private slots: void simpleConnectToIMAP(); void udpLoopbackTest(); void udpIPv6LoopbackTest(); -#ifndef Q_OS_AIX void broadcastTest(); -#endif void serverTest(); void udpLoopbackPerformance(); void tcpLoopbackPerformance(); @@ -97,9 +95,7 @@ private slots: void setSocketDescriptor(); void invalidSend(); void receiveUrgentData(); -#ifndef Q_OS_WIN void tooManySockets(); -#endif }; tst_PlatformSocketEngine::tst_PlatformSocketEngine() @@ -300,10 +296,11 @@ void tst_PlatformSocketEngine::udpIPv6LoopbackTest() } //--------------------------------------------------------------------------- - -#ifndef Q_OS_AIX void tst_PlatformSocketEngine::broadcastTest() { +#ifdef Q_OS_AIX + QSKIP("Broadcast does not work on darko"); +#endif PLATFORMSOCKETENGINE broadcastSocket; // Initialize a regular Udp socket @@ -338,8 +335,8 @@ void tst_PlatformSocketEngine::broadcastTest() QVERIFY(broadcastSocket.readDatagram(response.data(), response.size()) == response.size()); QCOMPARE(response, trollMessage); + } -#endif //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::serverTest() @@ -532,11 +529,11 @@ void tst_PlatformSocketEngine::readWriteBufferSize() } //--------------------------------------------------------------------------- - -// Certain windows machines suffocate and spend too much time in this test. -#ifndef Q_OS_WIN void tst_PlatformSocketEngine::tooManySockets() { +#if defined Q_OS_WIN + QSKIP("Certain windows machines suffocate and spend too much time in this test."); +#endif QList sockets; PLATFORMSOCKETENGINE *socketLayer = 0; for (;;) { @@ -551,7 +548,6 @@ void tst_PlatformSocketEngine::tooManySockets() qDeleteAll(sockets); } -#endif //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::bind() diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index e881d56271..3fb4333494 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -177,16 +177,12 @@ private slots: void socketsInThreads(); void waitForReadyReadInASlot(); void remoteCloseError(); -#ifndef Q_OS_VXWORKS void openMessageBoxInErrorSlot(); -#endif #ifndef Q_OS_WIN void connectToLocalHostNoService(); #endif void waitForConnectedInHostLookupSlot(); -#if !defined(Q_OS_WIN) && !defined(Q_OS_VXWORKS) void waitForConnectedInHostLookupSlot2(); -#endif void readyReadSignalsAfterWaitForReadyRead(); #ifdef Q_OS_LINUX void linuxKernelBugLocalSocket(); @@ -197,9 +193,7 @@ private slots: void connectionRefused(); void suddenRemoteDisconnect_data(); void suddenRemoteDisconnect(); -#ifndef Q_OS_VXWORKS void connectToMultiIP(); -#endif void moveToThread0(); void increaseReadBufferSize(); void taskQtBug5799ConnectionErrorWaitForConnected(); @@ -225,9 +219,7 @@ protected slots: void downloadBigFileSlot(); void recursiveReadyReadSlot(); void waitForReadyReadInASlotSlot(); -#ifndef Q_OS_VXWORKS void messageBoxSlot(); -#endif void hostLookupSlot(); void abortiveClose_abortSlot(); void remoteCloseErrorSlot(); @@ -1826,10 +1818,9 @@ void tst_QTcpSocket::remoteCloseErrorSlot() static_cast(sender())->close(); } -// VxWorks has no default gui -#ifndef Q_OS_VXWORKS void tst_QTcpSocket::messageBoxSlot() { +#if !defined(Q_OS_VXWORKS) // no gui QTcpSocket *socket = qobject_cast(sender()); socket->deleteLater(); QMessageBox box; @@ -1840,15 +1831,14 @@ void tst_QTcpSocket::messageBoxSlot() // Fire a non-0 singleshot to leave time for the delete QTimer::singleShot(250, this, SLOT(exitLoopSlot())); -} #endif - +} //---------------------------------------------------------------------------------- - -// VxWorks has no default gui -#ifndef Q_OS_VXWORKS void tst_QTcpSocket::openMessageBoxInErrorSlot() { +#if defined(Q_OS_VXWORKS) // no gui + QSKIP("no default gui available on VxWorks"); +#else QTcpSocket *socket = newSocket(); QPointer p(socket); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(messageBoxSlot())); @@ -1856,8 +1846,8 @@ void tst_QTcpSocket::openMessageBoxInErrorSlot() socket->connectToHost("hostnotfoundhostnotfound.troll.no", 9999); // Host not found, fyi enterLoop(30); QVERIFY(!p); -} #endif +} //---------------------------------------------------------------------------------- #ifndef Q_OS_WIN @@ -1978,10 +1968,12 @@ public slots: }; //---------------------------------------------------------------------------------- - -#if !defined(Q_OS_WIN) && !defined(Q_OS_VXWORKS) void tst_QTcpSocket::waitForConnectedInHostLookupSlot2() { +#if defined(Q_OS_WIN) || defined(Q_OS_VXWORKS) + QSKIP("waitForConnectedInHostLookupSlot2 is not run on Windows and VxWorks"); +#else + Foo foo; QPushButton top("Go", 0); top.show(); @@ -1996,8 +1988,8 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot2() QVERIFY(foo.attemptedToConnect); QCOMPARE(foo.count, 1); -} #endif +} //---------------------------------------------------------------------------------- void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() @@ -2280,12 +2272,12 @@ void tst_QTcpSocket::suddenRemoteDisconnect() //---------------------------------------------------------------------------------- -// VxSim in standard config doesn't even run a DNS resolver. -#ifndef Q_OS_VXWORKS void tst_QTcpSocket::connectToMultiIP() { QSKIP("TODO: setup DNS in the new network"); - +#if defined(Q_OS_VXWORKS) + QSKIP("VxSim in standard config doesn't even run a DNS resolver"); +#else QFETCH_GLOBAL(bool, ssl); if (ssl) return; @@ -2313,8 +2305,8 @@ void tst_QTcpSocket::connectToMultiIP() QCOMPARE(socket->error(), QAbstractSocket::SocketTimeoutError); delete socket; -} #endif +} //---------------------------------------------------------------------------------- void tst_QTcpSocket::moveToThread0() diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index a44d724d63..f737b94e5e 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -85,9 +85,7 @@ public slots: private slots: void constructing(); void unconnectedServerAndClientTest(); -#ifndef Q_OS_AIX void broadcasting(); -#endif void loop_data(); void loop(); void ipv6Loop_data(); @@ -102,7 +100,7 @@ private slots: void writeDatagramToNonExistingPeer(); void writeToNonExistingPeer_data(); void writeToNonExistingPeer(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#ifndef QT_NO_PROCESS void outOfProcessConnectedClientServerTest(); void outOfProcessUnconnectedClientServerTest(); #endif @@ -240,7 +238,6 @@ void tst_QUdpSocket::unconnectedServerAndClientTest() //---------------------------------------------------------------------------------- -#ifndef Q_OS_AIX void tst_QUdpSocket::broadcasting() { QFETCH_GLOBAL(bool, setProxy); @@ -249,6 +246,9 @@ void tst_QUdpSocket::broadcasting() if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 Broadcast is not supported."); } +#ifdef Q_OS_AIX + QSKIP("Broadcast does not work on darko"); +#endif const char *message[] = {"Yo mista", "", "Yo", "Wassap"}; QList broadcastAddresses; @@ -309,7 +309,6 @@ void tst_QUdpSocket::broadcasting() } } } -#endif //---------------------------------------------------------------------------------- @@ -787,10 +786,12 @@ void tst_QUdpSocket::writeToNonExistingPeer() QCOMPARE(int(sConnected.state()), int(QUdpSocket::ConnectedState)); } -// This test depends on reading data from QProcess (not supported on Qt/WinCE). -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#ifndef QT_NO_PROCESS void tst_QUdpSocket::outOfProcessConnectedClientServerTest() { +#if defined(Q_OS_WINCE) + QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); +#endif QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); @@ -847,10 +848,12 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() } #endif -// This test depends on reading data from QProcess (not supported on Qt/WinCE). -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#ifndef QT_NO_PROCESS void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() { +#if defined(Q_OS_WINCE) + QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); +#endif QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp index 71c133a44e..b6fb391fb1 100644 --- a/tests/auto/other/compiler/tst_compiler.cpp +++ b/tests/auto/other/compiler/tst_compiler.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ - #include #include @@ -49,43 +48,24 @@ #include "baseclass.h" #include "derivedclass.h" -#if defined(Q_CC_HPACC) -# define DONT_TEST_TEMPLATE_CONSTRUCTORS -# define DONT_TEST_CONSTRUCTOR_SPECIALIZATION -# define DONT_TEST_DATASTREAM_DETECTION -#endif - -#if defined(Q_CC_SUN) -# define DONT_TEST_STL_SORTING -#endif - QT_USE_NAMESPACE class tst_Compiler : public QObject { Q_OBJECT - private slots: void template_methods(); -#ifndef DONT_TEST_TEMPLATE_CONSTRUCTORS void template_constructors(); -#endif void template_subclasses(); void methodSpecialization(); -#ifndef DONT_TEST_CONSTRUCTOR_SPECIALIZATION void constructorSpecialization(); -#endif void staticTemplateMethods(); void staticTemplateMethodSpecialization(); -#ifndef DONT_TEST_DATASTREAM_DETECTION void detectDataStream(); -#endif void detectEnums(); void overrideCFunction(); -#ifndef DONT_TEST_STL_SORTING void stdSortQList(); void stdSortQVector(); -#endif void templateCallOrder(); void virtualFunctionNoLongerPureVirtual(); void charSignedness() const; @@ -93,6 +73,16 @@ private slots: void staticConstUnionWithInitializerList() const; }; +#if defined(Q_CC_HPACC) +# define DONT_TEST_TEMPLATE_CONSTRUCTORS +# define DONT_TEST_CONSTRUCTOR_SPECIALIZATION +# define DONT_TEST_DATASTREAM_DETECTION +#endif + +#if defined(Q_CC_SUN) +# define DONT_TEST_STL_SORTING +#endif + class TemplateMethodClass { public: @@ -129,6 +119,9 @@ void tst_Compiler::template_constructors() QCOMPARE(t2.i, 42); QCOMPARE(t3.i, 42); } +#else +void tst_Compiler::template_constructors() +{ QSKIP("Compiler doesn't do template constructors"); } #endif template @@ -193,6 +186,9 @@ void tst_Compiler::constructorSpecialization() QCOMPARE(t2.i, 42); QCOMPARE(t3.i, 42); } +#else +void tst_Compiler::constructorSpecialization() +{ QSKIP("Compiler doesn't do constructor specialization"); } #endif class StaticTemplateClass @@ -313,6 +309,9 @@ void tst_Compiler::detectDataStream() QVERIFY(QtTestInternal::getSaveOperator() != 0); QVERIFY(QtTestInternal::getSaveOperator() == 0); } +#else +void tst_Compiler::detectDataStream() +{ QSKIP("Compiler doesn't evaluate templates correctly"); } #endif enum Enum1 { Foo = 0, Bar = 1 }; @@ -346,10 +345,8 @@ void tst_Compiler::detectEnums() QVERIFY(QTestTypeInfo::IsEnum); QVERIFY(!QTestTypeInfo::IsEnum); } - static int indicator = 0; - // this is a silly C function extern "C" { void someCFunc(void *) { indicator = 42; } @@ -395,6 +392,11 @@ void tst_Compiler::stdSortQVector() QCOMPARE(strvec.value(0), QString("a")); QCOMPARE(strvec.value(1), QString("b")); } +#else +void tst_Compiler::stdSortQList() +{ QSKIP("Compiler's STL broken"); } +void tst_Compiler::stdSortQVector() +{ QSKIP("Compiler's STL broken"); } #endif // the C func will set it to 1, the template to 2 diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index f3abe9b5ff..cfe516d999 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -467,14 +467,10 @@ private slots: void slotWithException() throw(MyStruct); void dontStripNamespaces(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void oldStyleCasts(); void warnOnExtraSignalSlotQualifiaction(); -#endif void uLongLong(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void inputFileNameWithDotsButNoExtension(); -#endif void userProperties(); void supportConstSignals(); void task87883(); @@ -491,47 +487,31 @@ private slots: void slotsWithVoidTemplate(); void structQObject(); void namespacedFlags(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void warnOnMultipleInheritance(); void forgottenQInterface(); -#endif void os9Newline(); void winNewline(); void escapesInStringLiterals(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) void frameworkSearchPath(); -#endif void cstyleEnums(); -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void defineMacroViaCmdline(); -#endif void invokable(); void singleFunctionKeywordSignalAndSlot(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void templateGtGt(); -#endif void qprivateslots(); void qprivateproperties(); void inlineSlotsWithThrowDeclaration(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void warnOnPropertyWithoutREAD(); -#endif void constructors(); void typenameWithUnsigned(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void warnOnVirtualSignal(); -#endif void QTBUG5590_dummyProperty(); void QTBUG12260_defaultTemplate(); -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void notifyError(); -#endif void QTBUG17635_invokableAndProperty(); void revisions(); -#ifndef MOC_CROSS_COMPILED void warnings_data(); void warnings(); -#endif void privateClass(); void cxx11Enums_data(); void cxx11Enums(); @@ -599,10 +579,12 @@ void tst_Moc::dontStripNamespaces() QCOMPARE(receiver.intCallCount, 1); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::oldStyleCasts() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.start("moc", QStringList(srcify("/oldstyle-casts.h"))); QVERIFY(proc.waitForFinished()); @@ -622,13 +604,17 @@ void tst_Moc::oldStyleCasts() QVERIFY(proc.waitForFinished()); QCOMPARE(proc.exitCode(), 0); QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString()); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::warnOnExtraSignalSlotQualifiaction() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.start("moc", QStringList(srcify("extraqualification.h"))); QVERIFY(proc.waitForFinished()); @@ -639,8 +625,10 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction() QCOMPARE(mocWarning, QString(SRCDIR) + QString("/extraqualification.h:53: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") + QString(SRCDIR) + QString("/extraqualification.h:56: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n")); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} void tst_Moc::uLongLong() { @@ -659,10 +647,12 @@ void tst_Moc::uLongLong() QVERIFY(idx != -1); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::inputFileNameWithDotsButNoExtension() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.setWorkingDirectory(QString(SRCDIR) + "/task71021"); proc.start("moc", QStringList("../Header")); @@ -683,8 +673,10 @@ void tst_Moc::inputFileNameWithDotsButNoExtension() QVERIFY(proc.waitForFinished()); QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString()); QCOMPARE(proc.exitCode(), 0); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} void tst_Moc::userProperties() { @@ -875,10 +867,12 @@ void tst_Moc::namespacedFlags() QCOMPARE(l, qvariant_cast >(baz.property("flagsList"))); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::warnOnMultipleInheritance() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; QStringList args; args << "-I" << qtIncludePath + "/QtGui" @@ -891,13 +885,17 @@ void tst_Moc::warnOnMultipleInheritance() QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, QString(SRCDIR) + QString("/warn-on-multiple-qobject-subclasses.h:53: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n")); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::forgottenQInterface() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; QStringList args; args << "-I" << qtIncludePath + "/QtCore" @@ -910,8 +908,10 @@ void tst_Moc::forgottenQInterface() QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, QString(SRCDIR) + QString("/forgotten-qinterface.h:55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n")); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} void tst_Moc::os9Newline() { @@ -972,10 +972,12 @@ void tst_Moc::escapesInStringLiterals() QByteArray("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb")); } -// Only tested on unix. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) void tst_Moc::frameworkSearchPath() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) QStringList args; args << "-F" << srcify(".") << srcify("interface-from-framework.h") @@ -992,8 +994,10 @@ void tst_Moc::frameworkSearchPath() } QCOMPARE(proc.exitCode(), 0); QCOMPARE(proc.readAllStandardError(), QByteArray()); -} +#else + QSKIP("Only tested/relevant on unixy platforms"); #endif +} void tst_Moc::cstyleEnums() { @@ -1006,10 +1010,12 @@ void tst_Moc::cstyleEnums() QCOMPARE(metaEnum.key(1), "Bar"); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::templateGtGt() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.start("moc", QStringList(srcify("template-gtgt.h"))); QVERIFY(proc.waitForFinished()); @@ -1018,13 +1024,14 @@ void tst_Moc::templateGtGt() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QVERIFY(mocWarning.isEmpty()); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} -// Only tested on linux/gcc. -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::defineMacroViaCmdline() { +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; QStringList args; @@ -1037,8 +1044,10 @@ void tst_Moc::defineMacroViaCmdline() QCOMPARE(proc.readAllStandardError(), QByteArray()); QByteArray mocOut = proc.readAllStandardOutput(); QVERIFY(!mocOut.isEmpty()); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} void tst_Moc::invokable() { @@ -1155,10 +1164,12 @@ void tst_Moc::inlineSlotsWithThrowDeclaration() QVERIFY(mobj->indexOfSlot("e()") != -1); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::warnOnPropertyWithoutREAD() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.start("moc", QStringList(srcify("warn-on-property-without-read.h"))); QVERIFY(proc.waitForFinished()); @@ -1168,8 +1179,10 @@ void tst_Moc::warnOnPropertyWithoutREAD() QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, QString(SRCDIR) + QString("/warn-on-property-without-read.h:46: Warning: Property declaration foo has no READ accessor function. The property will be invalid.\n")); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} void tst_Moc::constructors() { @@ -1261,10 +1274,12 @@ void tst_Moc::typenameWithUnsigned() QVERIFY(mobj->indexOfSlot("l(unsignedQImage)") != -1); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::warnOnVirtualSignal() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.start("moc", QStringList(srcify("pure-virtual-signals.h"))); QVERIFY(proc.waitForFinished()); @@ -1274,8 +1289,10 @@ void tst_Moc::warnOnVirtualSignal() QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, QString(SRCDIR) + QString("/pure-virtual-signals.h:48: Warning: Signals cannot be declared virtual\n") + QString(SRCDIR) + QString("/pure-virtual-signals.h:50: Warning: Signals cannot be declared virtual\n")); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} class QTBUG5590_DummyObject: public QObject { @@ -1369,10 +1386,12 @@ void tst_Moc::QTBUG12260_defaultTemplate() QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1); } -// Only tested on linux/gcc. Not tested when cross-compiled. -#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) void tst_Moc::notifyError() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) QProcess proc; proc.start("moc", QStringList(srcify("error-on-wrong-notify.h"))); QVERIFY(proc.waitForFinished()); @@ -1383,8 +1402,10 @@ void tst_Moc::notifyError() QString mocError = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocError, QString(SRCDIR) + QString("/error-on-wrong-notify.h:52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n")); -} +#else + QSKIP("Only tested on linux/gcc"); #endif +} class QTBUG_17635_InvokableAndProperty : public QObject { @@ -1523,8 +1544,6 @@ void tst_Moc::revisions() revisions_T(); } -// Not tested when cross-compiled. -#ifndef MOC_CROSS_COMPILED void tst_Moc::warnings_data() { QTest::addColumn("input"); @@ -1608,6 +1627,9 @@ void tst_Moc::warnings_data() void tst_Moc::warnings() { +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif QFETCH(QByteArray, input); QFETCH(QStringList, args); QFETCH(int, exitCode); @@ -1639,7 +1661,6 @@ void tst_Moc::warnings() QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardOutput()).trimmed(), expectedStdOut); QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed(), expectedStdErr); } -#endif class tst_Moc::PrivateClass : public QObject { Q_PROPERTY(int someProperty READ someSlot WRITE someSlot2) diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 80eb717790..4ac9a6bf5a 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -75,17 +75,11 @@ private slots: void showMaximized(); void showMinimized(); void showFullScreen(); -#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) void showAsTool(); -#endif -#ifndef Q_OS_WINCE void toolDialogPosition(); -#endif void deleteMainDefault(); void deleteInExec(); -#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_MAC) && !(defined(Q_OS_WINCE) && defined(_ARM_)) void throwInExec(); -#endif void showSizeGrip(); void setVisible(); void reject(); @@ -372,11 +366,13 @@ void tst_QDialog::showFullScreen() QVERIFY(!dialog.isVisible()); } -// Qt/X11: Skipped since activeWindow() is not respected by all window managers. -// Qt/WinCE: No real support for Qt::Tool on WinCE. -#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) void tst_QDialog::showAsTool() { +#if defined(Q_OS_UNIX) + QSKIP("Qt/X11: Skipped since activeWindow() is not respected by all window managers"); +#elif defined(Q_OS_WINCE) + QSKIP("No real support for Qt::Tool on WinCE"); +#endif ToolDialog dialog(testWidget); testWidget->activateWindow(); dialog.exec(); @@ -387,14 +383,14 @@ void tst_QDialog::showAsTool() QCOMPARE(dialog.wasActive(), false); } } -#endif // Verify that pos() returns the same before and after show() // for a dialog with the Tool window type. -// No real support for Qt::Tool on WinCE, so skip this test. -#ifndef Q_OS_WINCE void tst_QDialog::toolDialogPosition() { +#if defined(Q_OS_WINCE) + QSKIP("No real support for Qt::Tool on WinCE"); +#endif QDialog dialog(0, Qt::Tool); dialog.move(QPoint(100,100)); const QPoint beforeShowPosition = dialog.pos(); @@ -402,7 +398,6 @@ void tst_QDialog::toolDialogPosition() const QPoint afterShowPosition = dialog.pos(); QCOMPARE(afterShowPosition, beforeShowPosition); } -#endif class Dialog : public QDialog { @@ -430,8 +425,7 @@ void tst_QDialog::deleteInExec() QCOMPARE(dialog->exec(), int(QDialog::Rejected)); } -// Throwing exceptions in exec() is not supported on Mac or on WinCE/ARM. -#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_MAC) && !(defined(Q_OS_WINCE) && defined(_ARM_)) +#ifndef QT_NO_EXCEPTIONS class QDialogTestException : public std::exception { }; class ExceptionDialog : public QDialog @@ -449,6 +443,9 @@ public slots: void tst_QDialog::throwInExec() { +#if defined(Q_WS_MAC) || (defined(Q_WS_WINCE) && defined(_ARM_)) + QSKIP("Throwing exceptions in exec() is not supported on this platform."); +#endif #if defined(Q_OS_LINUX) // C++ exceptions can't be passed through glib callbacks. Skip the test if // we're using the glib event loop. @@ -474,7 +471,12 @@ void tst_QDialog::throwInExec() } QCOMPARE(caughtExceptions, 1); } -#endif +#else +void tst_QDialog::throwInExec() +{ + QSKIP("Exceptions are disabled"); +} +#endif //QT_NO_EXCEPTIONS // From Task 124269 void tst_QDialog::showSizeGrip() diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index c23992c62d..483841e8f5 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -145,7 +145,7 @@ private slots: void clearLineEdit(); void enableChooseButton(); void hooks(); -#if defined(Q_OS_UNIX) && defined(QT_BUILD_INTERNAL) +#ifdef Q_OS_UNIX void tildeExpansion_data(); void tildeExpansion(); #endif @@ -1318,8 +1318,7 @@ void tst_QFiledialog::hooks() QCOMPARE(QFileDialog::getSaveFileName(), QString("saveName")); } -// Test case relies on developer build (AUTOTEST_EXPORT). -#if defined(Q_OS_UNIX) && defined(QT_BUILD_INTERNAL) +#ifdef Q_OS_UNIX void tst_QFiledialog::tildeExpansion_data() { QTest::addColumn("tildePath"); @@ -1338,10 +1337,14 @@ void tst_QFiledialog::tildeExpansion_data() void tst_QFiledialog::tildeExpansion() { +#ifndef QT_BUILD_INTERNAL + QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)"); +#else QFETCH(QString, tildePath); QFETCH(QString, expandedPath); QCOMPARE(qt_tildeExpansion(tildePath), expandedPath); +#endif } #endif diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 25ffdf63c6..3bf618b679 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -122,9 +122,7 @@ private slots: void detailsText(); void detailsButtonText(); -#ifndef Q_WS_MAC void shortcut(); -#endif void staticSourceCompat(); void instanceSourceCompat(); @@ -366,17 +364,17 @@ void tst_QMessageBox::statics() } } -// Shortcuts are not used on Mac OS X. -#ifndef Q_WS_MAC void tst_QMessageBox::shortcut() { +#ifdef Q_WS_MAC + QSKIP("shortcuts are not used on MAC OS X"); +#endif QMessageBox msgBox; msgBox.addButton("O&k", QMessageBox::YesRole); msgBox.addButton("&No", QMessageBox::YesRole); msgBox.addButton("&Maybe", QMessageBox::YesRole); QCOMPARE(exec(&msgBox, Qt::Key_M), 2); } -#endif void tst_QMessageBox::about() { diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 2a31e8ebf4..d865461e49 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -97,10 +97,8 @@ private slots: void setOption_HaveHelpButton(); void setOption_HelpButtonOnRight(); void setOption_HaveCustomButtonX(); -#ifndef Q_OS_WINCE void combinations_data(); void combinations(); -#endif void showCurrentPageOnly(); void setButtonText(); void setCommitPage(); @@ -2020,8 +2018,6 @@ public: } }; -// Too much memory usage for testing on CE emulator. -#ifndef Q_OS_WINCE void tst_QWizard::combinations_data() { CombinationsTestData combTestData; @@ -2033,6 +2029,10 @@ void tst_QWizard::combinations_data() void tst_QWizard::combinations() { +#ifdef Q_OS_WINCE + QSKIP("Too much memory usage for testing on CE emulator"); +#endif + QFETCH(bool, ref); QFETCH(bool, testEquality); QFETCH(QList, operations); @@ -2083,7 +2083,6 @@ void tst_QWizard::combinations() QVERIFY(false); } } -#endif class WizardPage : public QWizardPage { diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 26b8616231..2247173c7f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -61,16 +61,12 @@ private slots: void qgraphicsgridlayout(); void addItem_data(); void addItem(); -#ifndef Q_WS_MAC void alignment_data(); void alignment(); -#endif void alignment2(); void alignment2_data(); -#ifndef Q_WS_MAC void columnAlignment_data(); void columnAlignment(); -#endif void columnCount_data(); void columnCount(); void columnMaximumWidth_data(); @@ -494,8 +490,6 @@ void tst_QGraphicsGridLayout::addItem() delete layout; } -// Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac. -#ifndef Q_WS_MAC void tst_QGraphicsGridLayout::alignment_data() { QTest::addColumn("hasHeightForWidth"); @@ -507,6 +501,9 @@ void tst_QGraphicsGridLayout::alignment_data() // public Qt::Alignment alignment(QGraphicsLayoutItem* item) const void tst_QGraphicsGridLayout::alignment() { +#ifdef Q_WS_MAC + QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac"); +#endif QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); @@ -565,10 +562,7 @@ void tst_QGraphicsGridLayout::alignment() delete widget; } -#endif -// Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac. -#ifndef Q_WS_MAC void tst_QGraphicsGridLayout::columnAlignment_data() { QTest::addColumn("hasHeightForWidth"); @@ -581,6 +575,9 @@ void tst_QGraphicsGridLayout::columnAlignment_data() // public Qt::Alignment columnAlignment(int column) const void tst_QGraphicsGridLayout::columnAlignment() { +#ifdef Q_WS_MAC + QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac"); +#endif QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); @@ -633,7 +630,6 @@ void tst_QGraphicsGridLayout::columnAlignment() delete widget; } -#endif void tst_QGraphicsGridLayout::columnCount_data() { diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 0e86c0ab48..f943daf411 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -118,10 +118,8 @@ private slots: void focusNextPrevChild(); void focusOutEvent_data(); void focusOutEvent(); -#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) void hoverEnterLeaveEvent_data(); void hoverEnterLeaveEvent(); -#endif void hoverMoveEvent_data(); void hoverMoveEvent(); void keyPressEvent_data(); @@ -159,9 +157,7 @@ private slots: void setFocus_complexTwoWidgets(); void popup_basic(); void popup_subwidget(); -#if !defined(QT_NO_CURSOR) && (!defined(Q_OS_WINCE) || defined(GWES_ICONCURS)) void changingCursor_basic(); -#endif void tooltip_basic(); void childPos_data(); void childPos(); @@ -944,8 +940,6 @@ protected: } }; -// protected void hoverEnterEvent(QGraphicsSceneHoverEvent* event) -#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data() { QTest::addColumn("hasWidget"); @@ -956,11 +950,16 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data() QTest::newRow("no widget, hover") << false << true; } +// protected void hoverEnterEvent(QGraphicsSceneHoverEvent* event) void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent() { QFETCH(bool, hasWidget); QFETCH(bool, hoverEnabled); +#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR)) + QSKIP("hover events not supported on this platform"); +#endif + // proxy should translate this into events that the widget would expect QGraphicsScene scene; @@ -1007,7 +1006,6 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent() if (!hasWidget) delete widget; } -#endif void tst_QGraphicsProxyWidget::hoverMoveEvent_data() { @@ -2548,9 +2546,12 @@ void tst_QGraphicsProxyWidget::popup_subwidget() QCOMPARE(popup->size(), child->size().toSize()); } -#if !defined(QT_NO_CURSOR) && (!defined(Q_OS_WINCE) || defined(GWES_ICONCURS)) void tst_QGraphicsProxyWidget::changingCursor_basic() { +#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR)) + QSKIP("hover events not supported on this platform"); +#endif +#ifndef QT_NO_CURSOR // Confirm that mouse events are working properly by checking that // when moving the mouse over a line edit it will change the cursor into the I QGraphicsScene scene; @@ -2576,8 +2577,8 @@ void tst_QGraphicsProxyWidget::changingCursor_basic() QTest::mouseMove(view.viewport(), QPoint(1, 1)); sendMouseMove(view.viewport(), QPoint(1, 1)); QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); -} #endif +} void tst_QGraphicsProxyWidget::tooltip_basic() { diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index d69927b12c..496628597d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -216,9 +216,7 @@ private slots: void addPixmap(); void addRect(); void addText(); -#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS) void removeItem(); -#endif void clear(); void focusItem(); void focusItemLostFocus(); @@ -1245,9 +1243,11 @@ void tst_QGraphicsScene::addText() QCOMPARE(text->font(), QFont()); } -#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS) void tst_QGraphicsScene::removeItem() { +#if defined(Q_OS_WINCE) && !defined(GWES_ICONCURS) + QSKIP("No mouse cursor support"); +#endif QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); QCOMPARE(scene.itemAt(0, 0), item); // forces indexing @@ -1309,7 +1309,6 @@ void tst_QGraphicsScene::removeItem() qApp->processEvents(); // <- pending update is sent to view QVERIFY(!hoverItem->isHovered); } -#endif void tst_QGraphicsScene::focusItem() { diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index ded0cc7965..ad204f231d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -187,10 +187,8 @@ private slots: void mapFromScenePath(); void sendEvent(); void wheelEvent(); -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE) void cursor(); void cursor2(); -#endif void transformationAnchor(); void resizeAnchor(); void viewportUpdateMode(); @@ -244,16 +242,12 @@ private slots: void task239047_fitInViewSmallViewport(); void task245469_itemsAtPointWithClip(); void task253415_reconnectUpdateSceneOnSceneChanged(); -#ifndef Q_OS_WINCE void task255529_transformationAnchorMouseAndViewportMargins(); -#endif void task259503_scrollingArtifacts(); void QTBUG_4151_clipAndIgnore_data(); void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE) void QTBUG_7438_cursor(); -#endif void hoverLeave(); void QTBUG_16063_microFocusRect(); @@ -2057,10 +2051,12 @@ void tst_QGraphicsView::wheelEvent() QVERIFY(widget->hasFocus()); } -// Qt/CE does not have regular cursor support. -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE) void tst_QGraphicsView::cursor() { +#ifndef QT_NO_CURSOR +#if defined(Q_OS_WINCE) + QSKIP("Qt/CE does not have regular cursor support"); +#endif if (PlatformQuirks::haveMouseCursor()) QSKIP("The Platform does not have regular cursor support"); @@ -2082,13 +2078,17 @@ void tst_QGraphicsView::cursor() sendMouseMove(view.viewport(), QPoint(5, 5)); QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); -} #endif +} // Qt/CE does not have regular cursor support. #if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE) void tst_QGraphicsView::cursor2() { +#ifndef QT_NO_CURSOR +#if defined(Q_OS_WINCE) + QSKIP("Qt/CE does not have regular cursor support"); +#endif if (PlatformQuirks::haveMouseCursor()) QSKIP("The Platform does not have regular cursor support"); @@ -2154,8 +2154,8 @@ void tst_QGraphicsView::cursor2() QCOMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); sendMouseMove(view.viewport(), view.mapFromScene(-15, -15)); QCOMPARE(view.viewport()->cursor().shape(), Qt::SizeAllCursor); -} #endif +} void tst_QGraphicsView::transformationAnchor() { @@ -4252,10 +4252,11 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() QVERIFY(wasConnected2); } -// Qt/CE does not implement mouse tracking at this point. -#ifndef Q_OS_WINCE void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() { +#if defined(Q_OS_WINCE) + QSKIP("Qt/CE does not implement mouse tracking at this point"); +#endif QGraphicsScene scene(-100, -100, 200, 200); scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue)); @@ -4289,8 +4290,8 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() QEXPECT_FAIL("", "QTBUG-22455", Abort); QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack); QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack); -} #endif +} void tst_QGraphicsView::task259503_scrollingArtifacts() { @@ -4439,10 +4440,12 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect); } -// Qt/CE does not have regular cursor support. -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE) void tst_QGraphicsView::QTBUG_7438_cursor() { +#ifndef QT_NO_CURSOR +#if defined(Q_OS_WINCE) + QSKIP("Qt/CE does not have regular cursor support"); +#endif QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); item->setFlag(QGraphicsItem::ItemIsMovable); @@ -4461,8 +4464,8 @@ void tst_QGraphicsView::QTBUG_7438_cursor() QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); sendMouseRelease(view.viewport(), view.mapFromScene(0, 0)); QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); -} #endif +} class GraphicsItemWithHover : public QGraphicsRectItem { diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 00fc1bd1df..65900a4bed 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -54,14 +54,10 @@ class tst_QDirModel : public QObject Q_OBJECT public slots: void cleanupTestCase(); -#ifdef Q_OS_UNIX void init(); -#endif private slots: void getSetCheck(); -#ifdef Q_OS_UNIX void unreadable(); -#endif /* void construct(); void rowCount(); @@ -87,9 +83,7 @@ private slots: void filePath(); -#ifdef Q_OS_UNIX void hidden(); -#endif void fileName(); void fileName_data(); @@ -140,9 +134,9 @@ void tst_QDirModel::cleanupTestCase() current.rmdir(".qtest_hidden"); } -#ifdef Q_OS_UNIX void tst_QDirModel::init() { +#ifdef Q_OS_UNIX if (QTest::currentTestFunction() == QLatin1String( "unreadable" )) { // Make sure that the unreadable file created by the unreadable() // test function doesn't already exist. @@ -152,8 +146,8 @@ void tst_QDirModel::init() QVERIFY(!unreadableFile.exists()); } } -} #endif +} /* tests @@ -502,9 +496,11 @@ void tst_QDirModel::rowsAboutToBeRemoved() QVERIFY(rowsAboutToBeRemoved_cleanup(test_path)); } -#ifdef Q_OS_UNIX void tst_QDirModel::hidden() { +#ifndef Q_OS_UNIX + QSKIP("Test not implemented on non-Unixes"); +#else QDir current; current.mkdir(".qtest_hidden"); @@ -520,8 +516,8 @@ void tst_QDirModel::hidden() model2.setFilter(model2.filter() | QDir::Hidden); index = model2.index(QDir::currentPath() + "/.qtest_hidden"); QVERIFY(index.isValid()); -} #endif +} void tst_QDirModel::fileName_data() { @@ -543,9 +539,11 @@ void tst_QDirModel::fileName() QCOMPARE(model.fileName(model.index(path)), result); } -#ifdef Q_OS_UNIX void tst_QDirModel::unreadable() { +#ifndef Q_OS_UNIX + QSKIP("Test not implemented on non-Unixes"); +#else // Create an empty file which has no read permissions (file will be removed by cleanup()). QFile unreadableFile(QDir::currentPath() + "qtest_unreadable"); QVERIFY2(unreadableFile.open(QIODevice::WriteOnly | QIODevice::Text), qPrintable(unreadableFile.errorString())); @@ -563,8 +561,8 @@ void tst_QDirModel::unreadable() model2.setFilter(model2.filter() | QDir::Hidden); index = model2.index(QDir::currentPath() + "/qtest_unreadable"); QVERIFY(!index.isValid()); -} #endif +} void tst_QDirModel::filePath() { diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index b58a306f94..cb582be3c2 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -112,9 +112,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 void setCurrentIndexAfterAppendRowCrash(); -#endif void emptyItemSize(); void task203585_selectAll(); void task228566_infiniteRelayout(); @@ -1496,14 +1494,15 @@ private: }; #endif -// This test only makes sense on Windows 2000 and higher. -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 void tst_QListView::setCurrentIndexAfterAppendRowCrash() { +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 SetCurrentIndexAfterAppendRowCrashDialog w; w.exec(); -} +#else + QSKIP("This test only makes sense on windows 2000 and higher."); #endif +} void tst_QListView::emptyItemSize() { diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index de76768d24..47e6d861b7 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -204,10 +204,8 @@ private slots: void taskQTBUG_8777_scrollToSpans(); void taskQTBUG_10169_sizeHintForRow(); -#ifndef Q_OS_WINCE void mouseWheel_data(); void mouseWheel(); -#endif void addColumnWhileEditing(); void task234926_setHeaderSorting(); @@ -3638,8 +3636,6 @@ void tst_QTableView::task248688_autoScrollNavigation() } -// Since different Windows CE versions sport different taskbars, we skip this test. -#ifndef Q_OS_WINCE void tst_QTableView::mouseWheel_data() { QTest::addColumn("scrollMode"); @@ -3660,6 +3656,9 @@ void tst_QTableView::mouseWheel_data() void tst_QTableView::mouseWheel() { +#ifdef Q_OS_WINCE + QSKIP("Since different Windows CE versions sport different taskbars, we skip this test"); +#endif QFETCH(int, scrollMode); QFETCH(int, delta); @@ -3693,7 +3692,6 @@ void tst_QTableView::mouseWheel() QApplication::sendEvent(view.viewport(), &verticalEvent); QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10); } -#endif void tst_QTableView::addColumnWhileEditing() { diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index eb8b555bd6..f25a383177 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -77,9 +77,7 @@ private slots: void tst_windowFilePath_data(); void tst_windowFilePath(); -#ifdef Q_WS_X11 void tst_showWithoutActivating(); -#endif void tst_paintEventOnSecondShow(); }; @@ -284,9 +282,11 @@ void tst_QWidget_window::tst_windowFilePath() } } -#ifdef Q_WS_X11 void tst_QWidget_window::tst_showWithoutActivating() { +#ifndef Q_WS_X11 + QSKIP("This test is X11-only."); +#else QWidget w; w.show(); QTest::qWaitForWindowShown(&w); @@ -306,8 +306,9 @@ void tst_QWidget_window::tst_showWithoutActivating() (XGetInputFocus(QX11Info::display(), &window, &revertto), window) ); // Note the use of the , before window because we want the XGetInputFocus to be re-executed // in each iteration of the inside loop of the QTRY_COMPARE macro + +#endif // Q_WS_X11 } -#endif void tst_QWidget_window::tst_paintEventOnSecondShow() { diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index e0a9570ee2..77c1d71129 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -133,7 +133,7 @@ private slots: #ifndef QT_NO_STYLE_CDE void testCDEStyle(); #endif -#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP) +#ifndef QT_NO_STYLE_WINDOWSXP void testWindowsXPStyle(); #endif void testWindowsVistaStyle(); @@ -141,12 +141,8 @@ private slots: void testCleanlooksStyle(); #endif void testMacStyle(); -#ifdef Q_OS_WINCE void testWindowsCEStyle(); -#endif -#ifdef Q_OS_WINCE_WM void testWindowsMobileStyle(); -#endif void testStyleFactory(); void testProxyStyle(); void pixelMetric(); @@ -420,12 +416,16 @@ void tst_QStyle::testWindowsStyle() wstyle.drawControl(QStyle::CE_ProgressBar, &pb, &painter, 0); } -#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP) +#ifndef QT_NO_STYLE_WINDOWSXP void tst_QStyle::testWindowsXPStyle() { +#ifdef Q_WS_WIN QWindowsXPStyle xpstyle; QVERIFY(testAllFunctions(&xpstyle)); lineUpLayoutTest(&xpstyle); +#else + QSKIP("No WindowsXP style"); +#endif } #endif @@ -586,21 +586,25 @@ void tst_QStyle::testCDEStyle() } #endif -#ifdef Q_OS_WINCE void tst_QStyle::testWindowsCEStyle() { +#if defined(Q_OS_WINCE) QWindowsCEStyle cstyle; QVERIFY(testAllFunctions(&cstyle)); -} +#else + QSKIP("No WindowsCEStyle style"); #endif +} -#ifdef Q_OS_WINCE_WM void tst_QStyle::testWindowsMobileStyle() { +#if defined(Q_OS_WINCE_WM) QWindowsMobileStyle cstyle; QVERIFY(testAllFunctions(&cstyle)); -} +#else + QSKIP("No WindowsMobileStyle style"); #endif +} // Helper class... diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 2e5ddb4695..9ecf4d8676 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -79,9 +79,7 @@ private slots: void fontPropagation(); void onWidgetDestroyed(); void fontPrecedence(); -#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL)) void focusColors(); -#endif void hoverColors(); void background(); void tabAlignement(); @@ -726,9 +724,6 @@ static bool testForColors(const QImage& image, const QColor& color, bool ensureP return false; } -// This is a fragile test which fails on many esoteric platforms -// because of focus problems. Test only on Windows, Mac, and Linux/gcc. -#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL)) void tst_QStyleSheetStyle::focusColors() { // Tests if colors can be changed by altering the focus of the widget. @@ -736,6 +731,10 @@ void tst_QStyleSheetStyle::focusColors() // is reached if at least ten pixels of the right color can be found in // the image. // For this reason, we use unusual and extremely ugly colors! :-) +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL)) + QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems. " + "That doesn't mean that the feature doesn't work in practice."); +#endif QList widgets; widgets << new QPushButton("TESTING"); widgets << new QLineEdit("TESTING"); @@ -792,7 +791,6 @@ void tst_QStyleSheetStyle::focusColors() .toLocal8Bit().constData()); } } -#endif void tst_QStyleSheetStyle::hoverColors() { diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp index 9ed4965d45..c8c8136f44 100644 --- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp +++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp @@ -134,10 +134,8 @@ private slots: void staticScrollers(); void scrollerProperties(); void scrollTo(); -#if !defined(QT_NO_GESTURES) && !(defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)) void scroll(); void overshoot(); -#endif }; /*! \internal @@ -383,10 +381,14 @@ void tst_QScroller::scrollTo() } } -// Mac OS X < 10.6 does not support QTouchEvents. -#if !defined(QT_NO_GESTURES) && !(defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)) void tst_QScroller::scroll() { +#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6) + QSKIP("Mac OS X < 10.6 does not support QTouchEvents"); + return; +#endif + +#ifndef QT_NO_GESTURES // -- good case. normal scroll tst_QScrollerWidget *sw = new tst_QScrollerWidget(); sw->scrollArea = QRectF(0, 0, 1000, 1000); @@ -423,13 +425,17 @@ void tst_QScroller::scroll() QCOMPARE(sw->currentPos.y(), 500.0); delete sw; -} #endif +} -// Mac OS X < 10.6 does not support QTouchEvents. -#if !defined(QT_NO_GESTURES) && !(defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)) void tst_QScroller::overshoot() { +#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6) + QSKIP("Mac OS X < 10.6 does not support QTouchEvents"); + return; +#endif + +#ifndef QT_NO_GESTURES tst_QScrollerWidget *sw = new tst_QScrollerWidget(); sw->scrollArea = QRectF(0, 0, 1000, 1000); QScroller::grabGesture(sw, QScroller::TouchGesture); @@ -522,8 +528,8 @@ void tst_QScroller::overshoot() QCOMPARE( sw->receivedOvershoot, false ); delete sw; -} #endif +} QTEST_MAIN(tst_QScroller) diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index 9cab8b328d..1512385033 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -90,9 +90,7 @@ private slots: void setText_data(); void setText(); void setTextFormat(); -#ifndef Q_WS_MAC void setBuddy(); -#endif void setNum(); void clear(); void wordWrap(); @@ -198,10 +196,11 @@ void tst_QLabel::cleanup() } } -// Set buddy doesn't make much sense on Mac OS X. -#ifndef Q_WS_MAC void tst_QLabel::setBuddy() { +#ifdef Q_OS_MAC + QSKIP("Set buddy doesn't make much sense on Mac OS X"); +#endif testWidget->hide(); test_box = new Widget; @@ -222,7 +221,6 @@ void tst_QLabel::setBuddy() QVERIFY( test_edit->hasFocus() ); delete test_box; } -#endif void tst_QLabel::setText_data() { diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 41d692dfc3..0a74274772 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -266,9 +266,7 @@ private slots: void taskQTBUG_7902_contextMenuCrash(); #endif void taskQTBUG_7395_readOnlyShortcut(); -#ifdef Q_WS_X11 void QTBUG697_paletteCurrentColorGroup(); -#endif void QTBUG13520_textNotVisible(); void bidiVisualMovement_data(); @@ -3627,9 +3625,11 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() QCOMPARE(spy.count(), 1); } -#ifdef Q_WS_X11 void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() { +#ifndef Q_WS_X11 + QSKIP("Only tested on X11"); +#endif QLineEdit le; le.setText(" "); QPalette p = le.palette(); @@ -3651,7 +3651,6 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() le.render(&img); QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb()); } -#endif void tst_QLineEdit::QTBUG13520_textNotVisible() { diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 85bb481449..952078c0ff 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -75,9 +75,7 @@ private slots: void constructor(); void iconSize(); void toolButtonStyle(); -#ifndef Q_WS_WINCE_WM void menuBar(); -#endif void statusBar(); void centralWidget(); void corner(); @@ -105,9 +103,7 @@ private slots: void centralWidgetSize(); void dockWidgetSize(); void QTBUG2774_stylechange(); -#ifdef Q_OS_MAC void toggleUnifiedTitleAndToolBarOnMac(); -#endif }; // Testing get/set functions @@ -530,8 +526,6 @@ void tst_QMainWindow::toolButtonStyle() } } -// With native menubar integration on Windows Mobile the menubar is not a child -#ifndef Q_WS_WINCE_WM void tst_QMainWindow::menuBar() { { @@ -547,6 +541,9 @@ void tst_QMainWindow::menuBar() mw.setMenuBar(mb1); QVERIFY(mw.menuBar() != 0); QCOMPARE(mw.menuBar(), (QMenuBar *)mb1); +#ifdef Q_WS_WINCE_WM + QSKIP("With native menubar integration the menubar is not a child"); +#endif QCOMPARE(mb1->parentWidget(), (QWidget *)&mw); mw.setMenuBar(0); @@ -615,7 +612,6 @@ void tst_QMainWindow::menuBar() QVERIFY(!topRightCornerWidget); } } -#endif void tst_QMainWindow::statusBar() { @@ -1712,9 +1708,9 @@ void tst_QMainWindow::QTBUG2774_stylechange() } } -#ifdef Q_OS_MAC void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac() { +#ifdef Q_OS_MAC QMainWindow mw; QToolBar *tb = new QToolBar; tb->addAction("Test"); @@ -1726,8 +1722,11 @@ void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac() QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft()); mw.setUnifiedTitleAndToolBarOnMac(true); QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft()); -} +#else + QSKIP("Mac specific test"); #endif +} + QTEST_MAIN(tst_QMainWindow) #include "tst_qmainwindow.moc" diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index db51eb8df6..a9311911e6 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -180,10 +180,8 @@ private slots: void showShaded(); void showNormal_data(); void showNormal(); -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE_WM) void setOpaqueResizeAndMove_data(); void setOpaqueResizeAndMove(); -#endif void setWindowFlags_data(); void setWindowFlags(); void mouseDoubleClick(); @@ -693,8 +691,6 @@ private: int _count; }; -// This test requires cursor support, which is absent on WinCE -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE_WM) void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() { QTest::addColumn("opaqueMode"); @@ -709,6 +705,9 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() void tst_QMdiSubWindow::setOpaqueResizeAndMove() { +#if defined (QT_NO_CURSOR) || defined (Q_OS_WINCE_WM) //For Windows CE we will set QT_NO_CURSOR if there is no cursor support + QSKIP("No cursor available"); +#endif QFETCH(bool, opaqueMode); QFETCH(int, geometryCount); QFETCH(int, expectedGeometryCount); @@ -814,7 +813,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove() QCOMPARE(window->size(), windowSize + QSize(geometryCount, geometryCount)); } } -#endif void tst_QMdiSubWindow::setWindowFlags_data() { diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index e4f12c9f65..9b4f055684 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -83,9 +83,7 @@ private slots: void overrideMenuAction(); void statusTip(); void widgetActionFocus(); -#ifndef Q_OS_WINCE_WM void mouseActivation(); -#endif void tearOff(); void layoutDirection(); @@ -96,9 +94,7 @@ private slots: void task250673_activeMultiColumnSubMenuPosition(); void task256918_setFont(); void menuSizeHint(); -#ifndef Q_OS_WINCE_WM void task258920_mouseBorder(); -#endif void setFixedWidth(); void deleteActionInTriggered(); void pushButtonPopulateOnAboutToShow(); @@ -271,10 +267,11 @@ void tst_QMenu::addActionsAndClear() QCOMPARE(menus[0]->actions().count(), 0); } -// We have a separate mouseActivation test for Windows mobile. -#ifndef Q_OS_WINCE_WM void tst_QMenu::mouseActivation() { +#ifdef Q_OS_WINCE_WM + QSKIP("We have a separate mouseActivation test for Windows mobile."); +#endif QWidget topLevel; QMenu menu(&topLevel); topLevel.show(); @@ -307,7 +304,6 @@ void tst_QMenu::mouseActivation() QVERIFY(submenu.isVisible()); #endif } -#endif void tst_QMenu::keyboardNavigation_data() { @@ -778,10 +774,11 @@ public: bool painted; }; -// Mouse move related signals for Windows Mobile unavailable. -#ifndef Q_OS_WINCE_WM void tst_QMenu::task258920_mouseBorder() { +#ifdef Q_OS_WINCE_WM + QSKIP("Mouse move related signals for Windows Mobile unavailable"); +#endif // ### fixme: Check platforms QSKIP("QTBUG-20753 QCursor::setPos() / QTest::mouseMove() doesn't work on qpa"); @@ -805,7 +802,6 @@ void tst_QMenu::task258920_mouseBorder() QCOMPARE(static_cast(0), menu.activeAction()); QVERIFY(menu.painted); } -#endif void tst_QMenu::setFixedWidth() { diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f620b9b9be..17da9c746f 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -117,24 +117,18 @@ private slots: void removeItem(); void count(); void insertItem_QString_QObject(); -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void accel(); void activatedCount(); -#endif void allowActiveAndDisabled(); -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void check_accelKeys(); void check_cursorKeys1(); void check_cursorKeys2(); void check_cursorKeys3(); -#endif void check_homeKey(); void check_endKey(); -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void check_escKey(); -#endif // void check_mouse1_data(); // void check_mouse1(); @@ -142,16 +136,12 @@ private slots: // void check_mouse2(); void check_altPress(); -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void check_shortcutPress(); void check_menuPosition(); -#endif void task223138_triggered(); void task256322_highlight(); void menubarSizeHint(); -#ifndef Q_WS_MAC void taskQTBUG4965_escapeEaten(); -#endif void taskQTBUG11823_crashwithInvisibleActions(); protected slots: @@ -341,10 +331,12 @@ void tst_QMenuBar::onActivated( QAction* action ) // printf( QString("acceleratorId: %1, count: %1\n").arg( i ).arg(activated_count) ); } -// On Mac/WinCE, native key events are needed to test menu action activation. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::accel() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("On Mac/WinCE, native key events are needed to test menu action activation"); +#endif + // create a popup menu with menu items set the accelerators later... initSimpleMenubar(); @@ -356,12 +348,12 @@ void tst_QMenuBar::accel() QCOMPARE( last_accel_id, action ); } -#endif -// On Mac/WinCE, native key events are needed to test menu action activation. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::activatedCount() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("On Mac/WinCE, native key events are needed to test menu action activation"); +#endif // create a popup menu with menu items set the accelerators later... initSimpleMenubar(); @@ -369,7 +361,6 @@ void tst_QMenuBar::activatedCount() //wait(5000); QCOMPARE( activated_count, 2 ); //1 from the popupmenu and 1 from the menubar } -#endif void tst_QMenuBar::clear() { @@ -572,10 +563,11 @@ void tst_QMenuBar::insertItem_QString_QObject() QVERIFY(actions.size() < 4); // there is no menu 4! } -// On Mac/WinCE, native key events are needed to test menu action activation. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_accelKeys() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("On Mac/WinCE, native key events are needed to test menu action activation"); +#endif initComplexMenubar(); // start with a bogus key that shouldn't trigger anything @@ -639,12 +631,13 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(item2_C->selCount(), 1u); QCOMPARE(item2_D->selCount(), 1u); } -#endif -// Qt/Mac,WinCE does not use the native popups/menubar. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_cursorKeys1() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar"); +#endif + initComplexMenubar(); // start with a ALT + 1 that activates the first popupmenu @@ -669,12 +662,13 @@ void tst_QMenuBar::check_cursorKeys1() QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_D->selCount(), 0u); } -#endif -// Qt/Mac,WinCE does not use the native popups/menubar. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_cursorKeys2() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar"); +#endif + initComplexMenubar(); // select popupmenu2 @@ -695,15 +689,16 @@ void tst_QMenuBar::check_cursorKeys2() QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_D->selCount(), 1u); } -#endif /*! If a popupmenu is active you can use Left to move to the menu to the left of it. - Qt/Mac,WinCE does not use the native popups/menubar. */ -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_cursorKeys3() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar"); +#endif + initComplexMenubar(); // select Popupmenu 2 @@ -722,7 +717,6 @@ void tst_QMenuBar::check_cursorKeys3() QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_D->selCount(), 0u); } -#endif /*! If a popupmenu is active you can use home to go quickly to the first item in the menu. @@ -803,10 +797,12 @@ void tst_QMenuBar::check_endKey() If Down is pressed next the popup is activated again. */ -// Qt/Mac,WinCE does not use the native popups/menubar. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_escKey() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar"); +#endif + initComplexMenubar(); QVERIFY( !pm1->isActiveWindow() ); @@ -835,7 +831,7 @@ void tst_QMenuBar::check_escKey() // Let's see if the correct slot is called... QVERIFY2( item2_C->selCount() == 1, "Expected item 2C to be selected" ); } -#endif + // void tst_QMenuBar::check_mouse1_data() // { @@ -1004,10 +1000,12 @@ void tst_QMenuBar::check_altPress() QVERIFY( ::qobject_cast(qApp->focusWidget()) ); } -// Qt/Mac,WinCE does not use the native popups/menubar. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_shortcutPress() { +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar"); +#endif + initComplexMenubar(); qApp->setActiveWindow(mw); @@ -1022,13 +1020,15 @@ void tst_QMenuBar::check_shortcutPress() QTest::keyClick(mb, Qt::Key_2); QVERIFY(pm1->isActiveWindow()); } -#endif -// Qt/Mac does not use the native popups/menubar. -// Qt/CE uses native menubar. -#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) void tst_QMenuBar::check_menuPosition() { +#ifdef Q_WS_MAC + QSKIP("Qt/Mac does not use the native popups/menubar"); +#endif +#ifdef Q_OS_WINCE_WM + QSKIP("Qt/CE uses native menubar"); +#endif Menu menu; initComplexMenubar(); menu.setTitle("&menu"); @@ -1093,8 +1093,8 @@ void tst_QMenuBar::check_menuPosition() menu.close(); qApp->setLayoutDirection(dir); } + } -#endif void tst_QMenuBar::task223138_triggered() { @@ -1235,10 +1235,11 @@ void tst_QMenuBar::menubarSizeHint() QCOMPARE(resSize, mb.sizeHint()); } -// On Mac, do not test the menubar with escape key. -#ifndef Q_WS_MAC void tst_QMenuBar::taskQTBUG4965_escapeEaten() { +#ifdef Q_WS_MAC + QSKIP("On Mac, do not test the menubar with escape key"); +#endif QMenuBar menubar; QMenu menu("menu1"); QAction *first = menubar.addMenu(&menu); @@ -1260,7 +1261,6 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() QTest::keyClick(static_cast(0), Qt::Key_Escape); //now the action should be triggered QTRY_VERIFY(!menubar.isVisible()); } -#endif void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() { -- cgit v1.2.3