From c5ea7fd39a737ee16e82a6ef49a3149758b96e2b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 31 Aug 2011 13:24:37 +0200 Subject: [PATCH] Fix autotests to build on Windows. Basically breakage by being included from the OpenGL parts of included from . Change-Id: Id285fb89c64bf77e2408faac5688acd085579351 Reviewed-on: http://codereview.qt.nokia.com/3952 Reviewed-by: Friedemann Kleint --- .../concurrent/qfuture/tst_qfuture.cpp | 5 + .../tst_qtconcurrentfilter.cpp | 4 +- .../qtconcurrentmap/tst_qtconcurrentmap.cpp | 2 +- .../tst_qtconcurrentthreadengine.cpp | 12 +- .../corelib/io/qdatastream/qdatastream.pro | 2 +- .../corelib/io/qfileinfo/tst_qfileinfo.cpp | 2 +- .../io/qprocess/testSoftExit/main_win.cpp | 2 +- tests/auto/lancelot/tst_lancelot.cpp | 2 +- tests/auto/modeltest/modeltest.pro | 1 + .../tst_platformsocketengine.cpp | 2 +- tests/auto/qbytearray/tst_qbytearray.cpp | 2 + .../tst_qbytearraymatcher.cpp | 5 + tests/auto/qfreelist/qfreelist.pro | 3 +- .../tst_qgraphicsanchorlayout.cpp | 175 +++++++++--------- tests/auto/qlistview/qlistview.pro | 2 +- tests/auto/qlistview/tst_qlistview.cpp | 17 +- .../auto/qmdisubwindow/tst_qmdisubwindow.cpp | 2 +- tests/auto/qmessagebox/tst_qmessagebox.cpp | 25 +-- tests/auto/qobject/tst_qobject.cpp | 14 +- tests/auto/qregion/tst_qregion.cpp | 13 -- .../qsocketnotifier/tst_qsocketnotifier.cpp | 12 +- .../tst_qsocks5socketengine.cpp | 8 +- .../qsortfilterproxymodel.pro | 2 + .../tst_qsortfilterproxymodel.cpp | 1 + tests/auto/qsslsocket/tst_qsslsocket.cpp | 6 +- tests/auto/qstatictext/tst_qstatictext.cpp | 7 +- tests/auto/qstring/tst_qstring.cpp | 2 +- tests/auto/qtabbar/tst_qtabbar.cpp | 10 +- tests/auto/qtransform/tst_qtransform.cpp | 8 +- tests/auto/qvolatileimage/qvolatileimage.pro | 2 +- .../qwineventnotifier/qwineventnotifier.pro | 2 +- 31 files changed, 194 insertions(+), 158 deletions(-) diff --git a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp index 2178489bd9..d81df0d863 100644 --- a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp @@ -55,6 +55,11 @@ using namespace QtConcurrent; +// COM interface macro. +#if defined(Q_OS_WIN) && defined(interface) +# undef interface +#endif + //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp index 33611d7331..970784c5d3 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp +++ b/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp @@ -1499,8 +1499,10 @@ void tst_QtConcurrentFilter::noDetatch() void tst_QtConcurrentFilter::stlContainers() { -#ifdef QT_NO_STL +#if defined(QT_NO_STL) QSKIP("Qt compiled without STL support", SkipAll); +#elif defined(_MSC_VER) && _MSC_VER >= 1600 + QSKIP("Test does not compile with MSVC 2010 (see QTBUG-18996)", SkipAll); #else std::vector vector; vector.push_back(1); diff --git a/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index 74a254cbf4..8ec49accdf 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -2231,7 +2231,7 @@ void tst_QtConcurrentMap::exceptions() try { QList list = QList() << 1 << 2 << 3; QtConcurrent::map(list, throwMapper).waitForFinished(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } if (!caught) diff --git a/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp index 772c749711..f22a2ed64b 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp +++ b/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp @@ -445,7 +445,7 @@ void tst_QtConcurrentThreadEngine::exceptions() QtConcurrentExceptionThrower *e = new QtConcurrentExceptionThrower(); QFuture f = e->startAsynchronously(); f.waitForFinished(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } if (!caught) @@ -459,7 +459,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { QtConcurrentExceptionThrower e(QThread::currentThread()); e.startBlocking(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } @@ -473,7 +473,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { QtConcurrentExceptionThrower e(0); e.startBlocking(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } @@ -488,7 +488,7 @@ void tst_QtConcurrentThreadEngine::exceptions() UnrelatedExceptionThrower *e = new UnrelatedExceptionThrower(); QFuture f = e->startAsynchronously(); f.waitForFinished(); - } catch (QtConcurrent::UnhandledException &e) { + } catch (const QtConcurrent::UnhandledException &) { caught = true; } if (!caught) @@ -502,7 +502,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { UnrelatedExceptionThrower e(QThread::currentThread()); e.startBlocking(); - } catch (QtConcurrent::UnhandledException &e) { + } catch (const QtConcurrent::UnhandledException &) { caught = true; } @@ -516,7 +516,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { UnrelatedExceptionThrower e(0); e.startBlocking(); - } catch (QtConcurrent::UnhandledException &e) { + } catch (const QtConcurrent::UnhandledException &) { caught = true; } diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 5e503aea78..51c342c350 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qdatastream.cpp - +QT += gui widgets wince*: { addFiles.files = datastream.q42 addFiles.path = . diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index c3d106d2fd..9c9c9ec282 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1388,7 +1388,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() wchar_t errstr[0x100]; DWORD count = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, errstr, 0x100, 0); - QString error(QString::fromUtf16(errstr, count)); + QString error(QString::fromWCharArray(errstr, count)); qWarning() << error; //we need at least one data set for the test not to assert fail when skipping _data function QDir target("target"); diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp index 29dbc46bcf..7bdf796926 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp +++ b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp @@ -54,5 +54,5 @@ int main() PostQuitMessage(0); } - return msg.wParam; + return int(msg.wParam); } diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index cba5fab4d1..e49a1d69ed 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include "paintcommands.h" #include #include #include diff --git a/tests/auto/modeltest/modeltest.pro b/tests/auto/modeltest/modeltest.pro index f157da0cee..d4a8ba971d 100644 --- a/tests/auto/modeltest/modeltest.pro +++ b/tests/auto/modeltest/modeltest.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp HEADERS += modeltest.h dynamictreemodel.h diff --git a/tests/auto/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/platformsocketengine/tst_platformsocketengine.cpp index 257d412a5d..eaaabaedac 100644 --- a/tests/auto/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/platformsocketengine/tst_platformsocketengine.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ -#include +#include #ifdef Q_OS_WIN #include diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp index 78b655419e..5f036f37fe 100644 --- a/tests/auto/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/qbytearray/tst_qbytearray.cpp @@ -251,6 +251,8 @@ void tst_QByteArray::qUncompress() QSKIP("Corrupt data causes this tests to lock up on Solaris", SkipAll); #elif defined Q_OS_QNX QSKIP("Corrupt data causes this test to lock up on QNX", SkipAll); +#elif defined Q_OS_WIN + QSKIP("Corrupt data causes this test to lock up on Windows", SkipAll); #endif QByteArray res; diff --git a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp index ff6de8e9f4..09a3dfdf7d 100644 --- a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp +++ b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp @@ -44,6 +44,11 @@ #include +// COM interface +#if defined(Q_OS_WIN) && defined(interface) +# undef interface +#endif + class tst_QByteArrayMatcher : public QObject { Q_OBJECT diff --git a/tests/auto/qfreelist/qfreelist.pro b/tests/auto/qfreelist/qfreelist.pro index b7f2b3d38f..0afa12b8a8 100644 --- a/tests/auto/qfreelist/qfreelist.pro +++ b/tests/auto/qfreelist/qfreelist.pro @@ -2,5 +2,4 @@ load(qttest_p4) SOURCES += tst_qfreelist.cpp QT += core-private QT -= gui - -!private_tests:SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp +!contains(QT_CONFIG,private_tests): SOURCES += $$QT.core.sources/tools/qfreelist.cpp diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index f496146165..5dbe501ea8 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -47,6 +47,7 @@ #include #include + class tst_QGraphicsAnchorLayout : public QObject { Q_OBJECT @@ -209,13 +210,13 @@ void tst_QGraphicsAnchorLayout::simple() void tst_QGraphicsAnchorLayout::simple_center() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -257,14 +258,14 @@ void tst_QGraphicsAnchorLayout::simple_semifloat() // Useful for testing simplification between A_left and B_left. // Unfortunately the only way to really test that now is to manually inspect the // simplified graph. - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *A = createItem(min, pref, max, "A"); - QGraphicsWidget *B = createItem(min, pref, max, "B"); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *A = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *B = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -303,13 +304,13 @@ void tst_QGraphicsAnchorLayout::simple_semifloat() void tst_QGraphicsAnchorLayout::layoutDirection() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, QSizeF(100, 20), "c"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, QSizeF(100, 20), "c"); a->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); b->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -358,15 +359,15 @@ void tst_QGraphicsAnchorLayout::layoutDirection() void tst_QGraphicsAnchorLayout::diagonal() { - QSizeF min(10, 100); + QSizeF minSize(10, 100); QSizeF pref(70, 100); - QSizeF max(100, 100); + QSizeF maxSize(100, 100); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); - QGraphicsWidget *d = createItem(min, pref, max, "D"); - QGraphicsWidget *e = createItem(min, pref, max, "E"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "D"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "E"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -902,12 +903,12 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections() void tst_QGraphicsAnchorLayout::proportionalPreferred() { - QSizeF min(0, 100); + QSizeF minSize(0, 100); - QGraphicsWidget *a = createItem(min, QSizeF(10, 100), QSizeF(20, 100), "A"); - QGraphicsWidget *b = createItem(min, QSizeF(20, 100), QSizeF(30, 100), "B"); - QGraphicsWidget *c = createItem(min, QSizeF(14, 100), QSizeF(20, 100), "C"); - QGraphicsWidget *d = createItem(min, QSizeF(10, 100), QSizeF(20, 100), "D"); + QGraphicsWidget *a = createItem(minSize, QSizeF(10, 100), QSizeF(20, 100), "A"); + QGraphicsWidget *b = createItem(minSize, QSizeF(20, 100), QSizeF(30, 100), "B"); + QGraphicsWidget *c = createItem(minSize, QSizeF(14, 100), QSizeF(20, 100), "C"); + QGraphicsWidget *d = createItem(minSize, QSizeF(10, 100), QSizeF(20, 100), "D"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -969,17 +970,17 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred() void tst_QGraphicsAnchorLayout::example() { - QSizeF min(30, 100); + QSizeF minSize(30, 100); QSizeF pref(210, 100); - QSizeF max(300, 100); + QSizeF maxSize(300, 100); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); - QGraphicsWidget *d = createItem(min, pref, max, "D"); - QGraphicsWidget *e = createItem(min, pref, max, "E"); - QGraphicsWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), max, "F"); - QGraphicsWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), max, "G"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "D"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "E"); + QGraphicsWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F"); + QGraphicsWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -1057,13 +1058,13 @@ void tst_QGraphicsAnchorLayout::example() void tst_QGraphicsAnchorLayout::setSpacing() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 20); - QSizeF max(50, 50); + QSizeF maxSize(50, 50); - QGraphicsWidget *a = createItem(min, pref, max); - QGraphicsWidget *b = createItem(min, pref, max); - QGraphicsWidget *c = createItem(min, pref, max); + QGraphicsWidget *a = createItem(minSize, pref, maxSize); + QGraphicsWidget *b = createItem(minSize, pref, maxSize); + QGraphicsWidget *c = createItem(minSize, pref, maxSize); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->addCornerAnchors(l, Qt::TopLeftCorner, a, Qt::TopLeftCorner); @@ -1199,9 +1200,9 @@ int CustomLayoutStyle::pixelMetric(PixelMetric metric, const QStyleOption * opti void tst_QGraphicsAnchorLayout::styleDefaults() { - QSizeF min (10, 10); + QSizeF minSize (10, 10); QSizeF pref(20, 20); - QSizeF max (50, 50); + QSizeF maxSize (50, 50); /* create this layout, where a,b have controlType QSizePolicy::RadioButton @@ -1214,20 +1215,20 @@ void tst_QGraphicsAnchorLayout::styleDefaults() +-------+ */ QGraphicsScene scene; - QGraphicsWidget *a = createItem(min, pref, max); + QGraphicsWidget *a = createItem(minSize, pref, maxSize); QSizePolicy spRadioButton = a->sizePolicy(); spRadioButton.setControlType(QSizePolicy::RadioButton); a->setSizePolicy(spRadioButton); - QGraphicsWidget *b = createItem(min, pref, max); + QGraphicsWidget *b = createItem(minSize, pref, maxSize); b->setSizePolicy(spRadioButton); - QGraphicsWidget *c = createItem(min, pref, max); + QGraphicsWidget *c = createItem(minSize, pref, maxSize); QSizePolicy spPushButton = c->sizePolicy(); spPushButton.setControlType(QSizePolicy::PushButton); c->setSizePolicy(spPushButton); - QGraphicsWidget *d = createItem(min, pref, max); + QGraphicsWidget *d = createItem(minSize, pref, maxSize); d->setSizePolicy(spPushButton); QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window); @@ -1301,17 +1302,17 @@ static QGraphicsAnchorLayout *createAmbiguousS60Layout() l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - QSizeF min(0, 10); + QSizeF minSize(0, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - QGraphicsWidget *e = createItem(min, pref, max, "e"); - QGraphicsWidget *f = createItem(min, pref, max, "f"); - QGraphicsWidget *g = createItem(min, pref, max, "g"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "d"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "e"); + QGraphicsWidget *f = createItem(minSize, pref, maxSize, "f"); + QGraphicsWidget *g = createItem(minSize, pref, maxSize, "g"); // setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); @@ -1681,15 +1682,15 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(QWIDGETSIZE_MAX, 10); + QSizeF maxSize(QWIDGETSIZE_MAX, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - QGraphicsWidget *e = createItem(min, pref, max, "e"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "d"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "e"); // setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); @@ -1781,13 +1782,13 @@ void tst_QGraphicsAnchorLayout::simplifiableUnfeasible() */ void tst_QGraphicsAnchorLayout::simplificationVsOrder() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 10); - QSizeF max(50, 10); + QSizeF maxSize(50, 10); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); QGraphicsWidget frame; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame); @@ -1822,12 +1823,12 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder() void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 10); - QSizeF max(50, 10); + QSizeF maxSize(50, 10); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); QGraphicsWidget parent; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); @@ -1851,13 +1852,13 @@ void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() */ void tst_QGraphicsAnchorLayout::simplificationVsRedundance() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 10); - QSizeF max(50, 30); + QSizeF maxSize(50, 30); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); QGraphicsWidget frame; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame); @@ -1916,13 +1917,13 @@ void tst_QGraphicsAnchorLayout::spacingPersistency() */ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() { - QSizeF min(10, 20); + QSizeF minSize(10, 20); QSizeF pref(50, 20); - QSizeF max(100, 20); + QSizeF maxSize(100, 20); - QGraphicsWidget *a = createItem(max, max, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(max, max, max, "C"); + QGraphicsWidget *a = createItem(maxSize, maxSize, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(maxSize, maxSize, maxSize, "C"); QGraphicsWidget parent; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); @@ -1944,9 +1945,9 @@ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() // Note that A and C are fixed in the maximum size QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(150, 60))); - QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), max)); + QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), maxSize)); QCOMPARE(b->geometry(), QRectF(QPointF(50, 20), pref)); - QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); + QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), maxSize)); // Then, we change the "snake" to be in parallel with half of the layout delete l->anchor(c, Qt::AnchorRight, l, Qt::AnchorRight); @@ -1955,9 +1956,9 @@ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() parent.resize(l->effectiveSizeHint(Qt::PreferredSize)); QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(300, 60))); - QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), max)); + QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), maxSize)); QCOMPARE(b->geometry(), QRectF(QPointF(50, 20), pref)); - QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); + QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), maxSize)); } /* diff --git a/tests/auto/qlistview/qlistview.pro b/tests/auto/qlistview/qlistview.pro index cba2ef1170..07fabbce35 100644 --- a/tests/auto/qlistview/qlistview.pro +++ b/tests/auto/qlistview/qlistview.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT += widgets +QT += widgets gui-private SOURCES += tst_qlistview.cpp win32:!wince*: LIBS += -luser32 diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 1c35098152..8962556965 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -57,14 +57,24 @@ #include #include #if defined(Q_OS_WIN) || defined(Q_OS_WINCE) -#include -#endif +# include +# include +# include +#endif // Q_OS_WIN #include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= +#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) +static inline HWND getHWNDForWidget(const QWidget *widget) +{ + QWindow *window = widget->windowHandle(); + return static_cast (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window)); +} +#endif // Q_OS_WIN + class tst_QListView : public QObject { Q_OBJECT @@ -1467,7 +1477,8 @@ public: DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/; DWORD wParam = 0; - SendMessage(winId(), WM_GETOBJECT, wParam, lParam); + if (const HWND hwnd =getHWNDForWidget(this)) + SendMessage(hwnd, WM_GETOBJECT, wParam, lParam); #endif } diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 7296f3433b..0aa4aa192f 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -77,7 +77,7 @@ QT_END_NAMESPACE static inline bool tabAllWidgets() { -#if !defined(Q_WS_WIN) +#if !defined(Q_OS_WIN) if (qApp->style()->inherits("QMacStyle")) return qt_tab_all_widgets; #endif diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index 6b737681b1..12b6029a8f 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -525,8 +525,9 @@ void tst_QMessageBox::testSymbols() button = QMessageBox::Escape; button = QMessageBox::FlagMask; - mb1.setText("Foo"); - QCOMPARE(mb1.text(), "Foo"); + const QString text = QStringLiteral("Foo"); + mb1.setText(text); + QCOMPARE(mb1.text(), text); icon = mb1.icon(); QVERIFY(icon == QMessageBox::NoIcon); @@ -537,26 +538,28 @@ void tst_QMessageBox::testSymbols() mb1.setIconPixmap(iconPixmap); QVERIFY(mb1.icon() == QMessageBox::NoIcon); - QCOMPARE(mb1.buttonText(QMessageBox::Ok), "OK"); + QCOMPARE(mb1.buttonText(QMessageBox::Ok), QLatin1String("OK")); QCOMPARE(mb1.buttonText(QMessageBox::Cancel), QString()); QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString()); - mb2.setButtonText(QMessageBox::Cancel, "Foo"); - mb2.setButtonText(QMessageBox::Ok, "Bar"); - mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz"); + const QString button1 = QStringLiteral("Bar"); + mb2.setButtonText(QMessageBox::Cancel, QStringLiteral("Foo")); + mb2.setButtonText(QMessageBox::Ok, button1); + mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, QStringLiteral("Baz")); QCOMPARE(mb2.buttonText(QMessageBox::Cancel), QString()); - QCOMPARE(mb2.buttonText(QMessageBox::Ok), "Bar"); + QCOMPARE(mb2.buttonText(QMessageBox::Ok), button1); QVERIFY(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes")); QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); - mb3b.setButtonText(QMessageBox::Yes, "Blah"); - mb3b.setButtonText(QMessageBox::YesAll, "Zoo"); - mb3b.setButtonText(QMessageBox::Ok, "Zoo"); + const QString button2 = QStringLiteral("Blah"); + mb3b.setButtonText(QMessageBox::Yes, button2); + mb3b.setButtonText(QMessageBox::YesAll, QStringLiteral("Zoo")); + mb3b.setButtonText(QMessageBox::Ok, QStringLiteral("Zoo")); - QCOMPARE(mb3b.buttonText(QMessageBox::Yes), "Blah"); + QCOMPARE(mb3b.buttonText(QMessageBox::Yes), button2); QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 3cd4376d80..faab1f5532 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -3017,6 +3017,7 @@ signals: void work(); }; +namespace QObjectTest { // Do not clash with WinAPI 'DeleteObject' class DeleteObject : public QObject { Q_OBJECT @@ -3036,12 +3037,13 @@ public slots: signals: void relayedSignal(); }; +} // namespace QObjectTest void tst_QObject::deleteSelfInSlot() { { SenderObject sender; - DeleteObject *receiver = new DeleteObject(); + QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject(); receiver->connect(&sender, SIGNAL(signal1()), SLOT(deleteSelf()), @@ -3052,7 +3054,7 @@ void tst_QObject::deleteSelfInSlot() thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection); thread.start(); - QPointer p = receiver; + QPointer p = receiver; sender.emitSignal1(); QVERIFY(p.isNull()); @@ -3061,7 +3063,7 @@ void tst_QObject::deleteSelfInSlot() { SenderObject sender; - DeleteObject *receiver = new DeleteObject(); + QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject(); receiver->connect(&sender, SIGNAL(signal1()), SLOT(relaySignalAndProcessEvents()), @@ -3076,7 +3078,7 @@ void tst_QObject::deleteSelfInSlot() thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection); thread.start(); - QPointer p = receiver; + QPointer p = receiver; sender.emitSignal1(); QVERIFY(p.isNull()); @@ -3085,9 +3087,9 @@ void tst_QObject::deleteSelfInSlot() { EmitThread sender; - DeleteObject *receiver = new DeleteObject(); + QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject(); connect(&sender, SIGNAL(work()), receiver, SLOT(deleteSelf()), Qt::DirectConnection); - QPointer p = receiver; + QPointer p = receiver; sender.start(); QVERIFY(sender.wait(10000)); QVERIFY(p.isNull()); diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/qregion/tst_qregion.cpp index bbc09c9b57..58d2034e41 100644 --- a/tests/auto/qregion/tst_qregion.cpp +++ b/tests/auto/qregion/tst_qregion.cpp @@ -94,9 +94,6 @@ private slots: void isEmpty_data(); void isEmpty(); -#ifdef Q_OS_WIN - void handle(); -#endif #if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) void clipRectangles(); #endif @@ -865,16 +862,6 @@ void tst_QRegion::isEmpty() QVERIFY(region.rects().isEmpty()); } -#ifdef Q_OS_WIN -void tst_QRegion::handle() -{ - QRegion r; - HRGN hrgn = r.handle(); - QRegion r2(QRect(0,0,10,10)); - hrgn = r2.handle(); -} -#endif - #if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) void tst_QRegion::clipRectangles() { diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp index 77836b4671..2c3a6c52bf 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp @@ -40,9 +40,12 @@ ****************************************************************************/ -#include +#include +#include +#include #include +#include #include #include #include @@ -55,9 +58,14 @@ #endif #ifdef Q_OS_UNIX #include +#include #endif #include -#include + +#if defined (Q_CC_MSVC) && defined(max) +# undef max +# undef min +#endif // Q_CC_MSVC class tst_QSocketNotifier : public QObject { diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index ef342ab8a9..83d6871d96 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -40,9 +40,13 @@ ****************************************************************************/ -#include +#include +#include -#include +#include +#include +#include +#include #include #include diff --git a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro index 7edd4a53cc..a60fbac944 100644 --- a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro +++ b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro @@ -1,5 +1,7 @@ load(qttest_p4) +QT += gui widgets + INCLUDEPATH += $$PWD/../modeltest SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 33e8627680..093bcd2c86 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -48,6 +48,7 @@ #include #include +#include #include diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 8b3ec3d31e..7f613241a0 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -54,8 +54,10 @@ #include #include -#include "private/qhostinfo_p.h" -#include "private/qsslsocket_openssl_p.h" +#include +#ifndef QT_NO_OPENSSL +# include +#endif #include "../network-settings.h" diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 08069132de..79cbd692ea 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -55,9 +55,8 @@ class tst_QStaticText: public QObject { Q_OBJECT - -private: - bool supportsTransformations() const; +public: + tst_QStaticText() {} private slots: void initTestCase(); @@ -103,6 +102,8 @@ private slots: void textDocumentColor(); private: + bool supportsTransformations() const; + QImage const m_whiteSquare; }; diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index f7a725c164..256bbcf4fc 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -235,7 +235,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/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp index 2c5458edea..79b0bda0ed 100644 --- a/tests/auto/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/qtabbar/tst_qtabbar.cpp @@ -172,14 +172,14 @@ void tst_QTabBar::setIconSize_data() QTest::addColumn("sizeToSet"); QTest::addColumn("expectedWidth"); - int iconDefault = qApp->style()->pixelMetric(QStyle::PM_TabBarIconSize); - int small = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize); - int large = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize); + const int iconDefault = qApp->style()->pixelMetric(QStyle::PM_TabBarIconSize); + const int smallIconSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize); + const int largeIconSize = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize); QTest::newRow("default") << -1 << iconDefault; QTest::newRow("zero") << 0 << 0; QTest::newRow("same as default") << iconDefault << iconDefault; - QTest::newRow("large") << large << large; - QTest::newRow("small") << small << small; + QTest::newRow("large") << largeIconSize << largeIconSize; + QTest::newRow("small") << smallIconSize << smallIconSize; } void tst_QTabBar::setIconSize() diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index 7a0945da96..f8319c9e13 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -112,7 +112,7 @@ void tst_QTransform::cleanup() // No cleanup is required. } -#ifdef Q_OS_WIN32 +#if defined(Q_OS_WIN) && !defined(M_PI) #define M_PI 3.14159265897932384626433832795f #endif @@ -740,10 +740,10 @@ void tst_QTransform::inverted_data() QTest::newRow("big") << big; - QTransform small; - small.scale(1/s, 1/s); + QTransform smallTransform; + smallTransform.scale(1/s, 1/s); - QTest::newRow("small") << small; + QTest::newRow("small") << smallTransform; } void tst_QTransform::inverted() diff --git a/tests/auto/qvolatileimage/qvolatileimage.pro b/tests/auto/qvolatileimage/qvolatileimage.pro index 4be93896c4..45d80b85f2 100644 --- a/tests/auto/qvolatileimage/qvolatileimage.pro +++ b/tests/auto/qvolatileimage/qvolatileimage.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += gui-private widgets SOURCES += tst_qvolatileimage.cpp diff --git a/tests/auto/qwineventnotifier/qwineventnotifier.pro b/tests/auto/qwineventnotifier/qwineventnotifier.pro index 62da3a33ea..4a5ea78ed1 100644 --- a/tests/auto/qwineventnotifier/qwineventnotifier.pro +++ b/tests/auto/qwineventnotifier/qwineventnotifier.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qwineventnotifier.cpp -QT = core +QT = core core-private CONFIG += parallel_test