From f18b690cca2de6c75e70a2fd5871edf9fa993a5e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 29 Sep 2011 09:39:33 +0200 Subject: [PATCH] Tests: Fix compilation on Windows. Replace Q_WS_... by Q_OS_... in corelib tests. Change-Id: I14c41dca1ec490b3c49ba2c24e60def14c6de9da Reviewed-on: http://codereview.qt-project.org/5778 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- .../tst_qparallelanimationgroup.cpp | 2 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 14 +++++++------- tests/auto/corelib/io/qfile/tst_qfile.cpp | 14 +++++++------- .../tst_qprocessenvironment.cpp | 4 ++-- .../kernel/qsocketnotifier/qsocketnotifier.pro | 2 +- .../auto/corelib/kernel/qvariant/tst_qvariant.cpp | 2 +- .../auto/corelib/plugin/qlibrary/tst_qlibrary.cpp | 4 ++-- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 6 +++--- .../corelib/tools/qstringref/tst_qstringref.cpp | 2 +- tests/auto/gui/text/qtextblock/tst_qtextblock.cpp | 15 ++++----------- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 2 +- tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 2 +- tests/auto/qaccessibility/tst_qaccessibility.cpp | 10 +++++----- 13 files changed, 36 insertions(+), 43 deletions(-) diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index fed9b5c51c..432da51ab3 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -90,7 +90,7 @@ tst_QParallelAnimationGroup::~tst_QParallelAnimationGroup() void tst_QParallelAnimationGroup::initTestCase() { qRegisterMetaType("QAbstractAnimation::State"); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) +#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) // give the mac/wince app start event queue time to clear QTest::qWait(1000); #endif diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 7696c8b114..d61e4316c5 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -232,7 +232,7 @@ void tst_QDir::setPath_data() QTest::addColumn("dir2"); QTest::newRow("data0") << QString(".") << QString(".."); -#if (defined(Q_WS_WIN) && !defined(Q_OS_WINCE)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) QTest::newRow("data1") << QString("c:/") << QDir::currentPath(); #endif } @@ -387,7 +387,7 @@ void tst_QDir::isRelativePath_data() QTest::addColumn("relative"); QTest::newRow("data0") << "../somedir" << true; -#if (defined(Q_WS_WIN) && !defined(Q_OS_WINCE)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) QTest::newRow("data1") << "C:/sOmedir" << false; #endif QTest::newRow("data2") << "somedir" << true; @@ -615,7 +615,7 @@ void tst_QDir::entryList() #endif #endif //Q_NO_SYMLINKS -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (qstrcmp(QTest::currentDataTag(), "unprintablenames") == 0) QSKIP("p4 doesn't sync the files with the unprintable names properly on Mac",SkipSingle); #endif @@ -750,7 +750,7 @@ void tst_QDir::canonicalPath_data() else appPath.chop(1); // remove the ending slash -#if defined Q_WS_WIN +#if defined Q_OS_WIN if (appPath.endsWith("release", Qt::CaseInsensitive) || appPath.endsWith("debug", Qt::CaseInsensitive)) { QDir appDir(appPath); QVERIFY(appDir.cdUp()); @@ -761,7 +761,7 @@ void tst_QDir::canonicalPath_data() QTest::newRow("relative") << "." << appPath; QTest::newRow("relativeSubDir") << "./testData/../testData" << appPath + "/testData"; -#ifndef Q_WS_WIN +#ifndef Q_OS_WIN QTest::newRow("absPath") << appPath + "/testData/../testData" << appPath + "/testData"; #else QTest::newRow("absPath") << appPath + "\\testData\\..\\testData" << appPath + "/testData"; @@ -824,7 +824,7 @@ void tst_QDir::current_data() appPath = QCoreApplication::instance()->applicationDirPath(); else appPath.chop(1); // remove the ending slash -#if defined Q_WS_WIN +#if defined Q_OS_WIN if (appPath.endsWith("release", Qt::CaseInsensitive)) appPath = appPath.left(appPath.length()-8); else if (appPath.endsWith("debug", Qt::CaseInsensitive)) @@ -833,7 +833,7 @@ void tst_QDir::current_data() QTest::newRow("startup") << QString() << appPath; QTest::newRow("relPath") << "testData" << appPath + "/testData"; -#ifndef Q_WS_WIN +#ifndef Q_OS_WIN QTest::newRow("absPath") << appPath + "/testData" << appPath + "/testData"; #else QTest::newRow("absPath") << appPath + "\\testData" << appPath + "/testData"; diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index c245661b14..9f8a8f7c6a 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -576,7 +576,7 @@ void tst_QFile::size() QFETCH( QString, filename ); QFETCH( qint64, size ); -#ifdef Q_WS_WINCE +#ifdef Q_OS_WINCE filename = QFileInfo(filename).absoluteFilePath(); #endif @@ -600,7 +600,7 @@ void tst_QFile::size() } { -#ifdef Q_WS_WINCE +#ifdef Q_OS_WINCE QSKIP("Currently low level file I/O not well supported on Windows CE", SkipSingle); #endif QFile f; @@ -1042,7 +1042,7 @@ void tst_QFile::ungetChar() void tst_QFile::invalidFile_data() { QTest::addColumn("fileName"); -#if !defined(Q_WS_WIN) +#if !defined(Q_OS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else QTest::newRow( "colon1" ) << QString( "fail:invalid" ); @@ -1225,7 +1225,7 @@ void tst_QFile::copyFallback() QVERIFY(QFile::exists("file-copy-destination.txt")); QVERIFY(!file.isOpen()); -#ifdef Q_WS_WINCE +#ifdef Q_OS_WINCE // Need to reset permissions on Windows to be able to delete QVERIFY(QFile::setPermissions("file-copy-destination.txt", QFile::WriteOther)); @@ -1801,7 +1801,7 @@ void tst_QFile::largeFileSupport() sizeNeeded *= 2; sizeNeeded += 1024; qlonglong freespace = qlonglong(0); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN _ULARGE_INTEGER free; if (::GetDiskFreeSpaceEx((wchar_t*)QDir::currentPath().utf16(), &free, 0, 0)) freespace = free.QuadPart; @@ -2793,7 +2793,7 @@ void tst_QFile::map() QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; -#ifdef Q_WS_WINCE +#ifdef Q_OS_WINCE fileName = QFileInfo(fileName).absoluteFilePath(); #endif @@ -2994,7 +2994,7 @@ void tst_QFile::openDirectory() void tst_QFile::openStandardStreamsFileDescriptors() { -#ifdef Q_WS_WINCE +#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 . diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index d88ffdedb7..1c6bf6f19c 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -251,7 +251,7 @@ void tst_QProcessEnvironment::systemEnvironment() QVERIFY(nonexistant.isNull()); -#ifdef Q_WS_WINCE +#ifdef Q_OS_WINCE // Windows CE has no environment QVERIFY(path.isEmpty()); QVERIFY(!system.contains("PATH")); @@ -278,7 +278,7 @@ void tst_QProcessEnvironment::systemEnvironment() void tst_QProcessEnvironment::putenv() { -#ifdef Q_WS_WINCE +#ifdef Q_OS_WINCE QSKIP("Windows CE has no environment", SkipAll); #else static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE"; diff --git a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro index c1b316ef50..309950067d 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro @@ -4,6 +4,6 @@ QT = core-private network-private requires(contains(QT_CONFIG,private_tests)) -include(../platformsocketengine/platformsocketengine.pri) +include(../../../network/socket/platformsocketengine/platformsocketengine.pri) CONFIG += insignificant_test # QTBUG-21204 diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 25a32cc734..b1236d2ed6 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -1193,7 +1193,7 @@ void tst_QVariant::toString_data() QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56" ); QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 1, 1 ), QTime( 12, 34, 56 ) ) ) << QString( "2002-01-01T12:34:56" ); QTest::newRow( "qkeysequence" ) << qVariantFromValue( QKeySequence( Qt::CTRL + Qt::Key_A ) ) -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC << QString( "Ctrl+A" ); #else << QString(QChar(0x2318)) + "A"; diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index 0311cce4f8..4ab7b892c8 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -257,7 +257,7 @@ void tst_QLibrary::unload_data() QString currDir = QDir::currentPath(); QTest::newRow( "mylib" ) << currDir + "/mylib" << true; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_3) QEXPECT_FAIL("mylib", "dlcompat cannot unload libraries", Continue); #endif @@ -502,7 +502,7 @@ void tst_QLibrary::fileName_data() QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib")) << sys_qualifiedLibraryName(QLatin1String("mylib")); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #ifndef Q_OS_WINCE QTest::newRow( "ok03" ) << "user32" << "USER32.dll"; diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 1721f80a8f..dc912f786e 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -2127,7 +2127,7 @@ void tst_QString::remove_regexp() void tst_QString::toNum() { -#if defined (Q_WS_WIN) && defined (Q_CC_MSVC) +#if defined (Q_OS_WIN) && defined (Q_CC_MSVC) #define TEST_TO_INT(num, func) \ a = #num; \ QVERIFY2(a.func(&ok) == num ## i64 && ok, "Failed: num=" #num ", func=" #func); @@ -2165,7 +2165,7 @@ void tst_QString::toNum() #undef TEST_TO_INT -#if defined (Q_WS_WIN) && defined (Q_CC_MSVC) +#if defined (Q_OS_WIN) && defined (Q_CC_MSVC) #define TEST_TO_UINT(num, func) \ a = #num; \ QVERIFY2(a.func(&ok) == num ## i64 && ok, "Failed: num=" #num ", func=" #func); @@ -4352,7 +4352,7 @@ void tst_QString::localeAwareCompare() QCOMPARE(locale, GetThreadLocale()); # endif -#elif defined (Q_WS_MAC) +#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)", SkipAll); #elif defined(QT_USE_ICU) QLocale::setDefault(QLocale(locale)); diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index dbf8ee73fc..2697058f2a 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp @@ -102,7 +102,7 @@ Q_DECLARE_METATYPE(IntList) #include #include #include -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # include // mingw defines NAN and INFINITY to 0/0 and x/0 # if defined(Q_CC_GNU) diff --git a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp index b04a6f5559..efa5368205 100644 --- a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp @@ -39,24 +39,17 @@ ** ****************************************************************************/ +#include -#include - - -#define protected public #include -#undef protected #include -#ifndef Q_WS_WIN -#include +#ifndef Q_OS_WIN +# include #endif - - #include #include - //TESTED_FILES= QT_FORWARD_DECLARE_CLASS(QTextDocument) @@ -118,7 +111,7 @@ void tst_QTextBlock::fragmentOverBlockBoundaries() QVERIFY(doc); // Block separators are always a fragment of their self. Thus: // |Hello|\b|World|\b| -#if !defined(Q_WS_WIN) && !defined(Q_WS_S60) +#if !defined(Q_OS_WIN) QVERIFY(doc->docHandle()->fragmentMap().numNodes() == 4); #endif QCOMPARE(cursor.block().text(), QString("Hello")); diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 8b6b51b2da..e8889f55c6 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1115,7 +1115,7 @@ void tst_QTextLayout::tabsForRtl() } QT_BEGIN_NAMESPACE -extern int qt_defaultDpiY(); +Q_GUI_EXPORT int qt_defaultDpiY(); QT_END_NAMESPACE void tst_QTextLayout::testTabDPIScale() diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index 69bd66ffbf..fe79c39363 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -99,7 +99,7 @@ private slots: tst_QSslKey::tst_QSslKey() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC // applicationDirPath() points to a path inside the app bundle on Mac. QDir dir(qApp->applicationDirPath() + QLatin1String("/../../../keys")); #else diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index b5b9ec78ae..c019f571a2 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -172,7 +172,7 @@ static int verifyHierarchy(QAccessibleInterface *iface) int errorAt = 0; int entry = 0; static int treelevel = 0; // for error diagnostics - QAccessibleInterface *middleChild, *if2, *if3; + QAccessibleInterface *middleChild, *if2; middleChild = 0; ++treelevel; int middle = iface->childCount()/2 + 1; @@ -3302,14 +3302,14 @@ void tst_QAccessibility::comboBoxTest() QCOMPARE(iface->childCount(), 1); #ifdef Q_OS_UNIX - QCOMPARE(iface->text(QAccessible::Name), QStringLiteral("one")); + QCOMPARE(iface->text(QAccessible::Name), QLatin1String("one")); #endif - QCOMPARE(iface->text(QAccessible::Value), QStringLiteral("one")); + QCOMPARE(iface->text(QAccessible::Value), QLatin1String("one")); combo.setCurrentIndex(2); #ifdef Q_OS_UNIX - QCOMPARE(iface->text(QAccessible::Name), QStringLiteral("three")); + QCOMPARE(iface->text(QAccessible::Name), QLatin1String("three")); #endif - QCOMPARE(iface->text(QAccessible::Value), QStringLiteral("three")); + QCOMPARE(iface->text(QAccessible::Value), QLatin1String("three")); QAccessibleInterface *listIface = iface->child(0); QCOMPARE(listIface->role(), QAccessible::List);