Fix autotests to build on Windows.

Basically breakage by <windows.h> being included from the OpenGL
parts of <QtGui/QtGui> included from <QtTest/QtTest>.

Change-Id: Id285fb89c64bf77e2408faac5688acd085579351
Reviewed-on: http://codereview.qt.nokia.com/3952
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Friedemann Kleint 2011-08-31 13:24:37 +02:00
parent 94355ca15a
commit c5ea7fd39a
31 changed files with 194 additions and 158 deletions

View File

@ -55,6 +55,11 @@
using namespace QtConcurrent; using namespace QtConcurrent;
// COM interface macro.
#if defined(Q_OS_WIN) && defined(interface)
# undef interface
#endif
//TESTED_CLASS= //TESTED_CLASS=
//TESTED_FILES= //TESTED_FILES=

View File

@ -1499,8 +1499,10 @@ void tst_QtConcurrentFilter::noDetatch()
void tst_QtConcurrentFilter::stlContainers() void tst_QtConcurrentFilter::stlContainers()
{ {
#ifdef QT_NO_STL #if defined(QT_NO_STL)
QSKIP("Qt compiled without STL support", SkipAll); 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 #else
std::vector<int> vector; std::vector<int> vector;
vector.push_back(1); vector.push_back(1);

View File

@ -2231,7 +2231,7 @@ void tst_QtConcurrentMap::exceptions()
try { try {
QList<int> list = QList<int>() << 1 << 2 << 3; QList<int> list = QList<int>() << 1 << 2 << 3;
QtConcurrent::map(list, throwMapper).waitForFinished(); QtConcurrent::map(list, throwMapper).waitForFinished();
} catch (Exception &e) { } catch (const Exception &) {
caught = true; caught = true;
} }
if (!caught) if (!caught)

View File

@ -445,7 +445,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
QtConcurrentExceptionThrower *e = new QtConcurrentExceptionThrower(); QtConcurrentExceptionThrower *e = new QtConcurrentExceptionThrower();
QFuture<void> f = e->startAsynchronously(); QFuture<void> f = e->startAsynchronously();
f.waitForFinished(); f.waitForFinished();
} catch (Exception &e) { } catch (const Exception &) {
caught = true; caught = true;
} }
if (!caught) if (!caught)
@ -459,7 +459,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
try { try {
QtConcurrentExceptionThrower e(QThread::currentThread()); QtConcurrentExceptionThrower e(QThread::currentThread());
e.startBlocking(); e.startBlocking();
} catch (Exception &e) { } catch (const Exception &) {
caught = true; caught = true;
} }
@ -473,7 +473,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
try { try {
QtConcurrentExceptionThrower e(0); QtConcurrentExceptionThrower e(0);
e.startBlocking(); e.startBlocking();
} catch (Exception &e) { } catch (const Exception &) {
caught = true; caught = true;
} }
@ -488,7 +488,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
UnrelatedExceptionThrower *e = new UnrelatedExceptionThrower(); UnrelatedExceptionThrower *e = new UnrelatedExceptionThrower();
QFuture<void> f = e->startAsynchronously(); QFuture<void> f = e->startAsynchronously();
f.waitForFinished(); f.waitForFinished();
} catch (QtConcurrent::UnhandledException &e) { } catch (const QtConcurrent::UnhandledException &) {
caught = true; caught = true;
} }
if (!caught) if (!caught)
@ -502,7 +502,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
try { try {
UnrelatedExceptionThrower e(QThread::currentThread()); UnrelatedExceptionThrower e(QThread::currentThread());
e.startBlocking(); e.startBlocking();
} catch (QtConcurrent::UnhandledException &e) { } catch (const QtConcurrent::UnhandledException &) {
caught = true; caught = true;
} }
@ -516,7 +516,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
try { try {
UnrelatedExceptionThrower e(0); UnrelatedExceptionThrower e(0);
e.startBlocking(); e.startBlocking();
} catch (QtConcurrent::UnhandledException &e) { } catch (const QtConcurrent::UnhandledException &) {
caught = true; caught = true;
} }

View File

@ -1,6 +1,6 @@
load(qttest_p4) load(qttest_p4)
SOURCES += tst_qdatastream.cpp SOURCES += tst_qdatastream.cpp
QT += gui widgets
wince*: { wince*: {
addFiles.files = datastream.q42 addFiles.files = datastream.q42
addFiles.path = . addFiles.path = .

View File

@ -1388,7 +1388,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
wchar_t errstr[0x100]; wchar_t errstr[0x100];
DWORD count = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, DWORD count = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM,
0, err, 0, errstr, 0x100, 0); 0, err, 0, errstr, 0x100, 0);
QString error(QString::fromUtf16(errstr, count)); QString error(QString::fromWCharArray(errstr, count));
qWarning() << error; qWarning() << error;
//we need at least one data set for the test not to assert fail when skipping _data function //we need at least one data set for the test not to assert fail when skipping _data function
QDir target("target"); QDir target("target");

View File

@ -54,5 +54,5 @@ int main()
PostQuitMessage(0); PostQuitMessage(0);
} }
return msg.wParam; return int(msg.wParam);
} }

View File

@ -40,7 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <paintcommands.h> #include "paintcommands.h"
#include <QPainter> #include <QPainter>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <baselineprotocol.h> #include <baselineprotocol.h>

View File

@ -1,4 +1,5 @@
load(qttest_p4) load(qttest_p4)
QT += widgets
SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp
HEADERS += modeltest.h dynamictreemodel.h HEADERS += modeltest.h dynamictreemodel.h

View File

@ -40,7 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include <QtTest/QtTest> #include <QtTest/QTest>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <winsock2.h> #include <winsock2.h>

View File

@ -251,6 +251,8 @@ void tst_QByteArray::qUncompress()
QSKIP("Corrupt data causes this tests to lock up on Solaris", SkipAll); QSKIP("Corrupt data causes this tests to lock up on Solaris", SkipAll);
#elif defined Q_OS_QNX #elif defined Q_OS_QNX
QSKIP("Corrupt data causes this test to lock up on QNX", SkipAll); 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 #endif
QByteArray res; QByteArray res;

View File

@ -44,6 +44,11 @@
#include <qbytearraymatcher.h> #include <qbytearraymatcher.h>
// COM interface
#if defined(Q_OS_WIN) && defined(interface)
# undef interface
#endif
class tst_QByteArrayMatcher : public QObject class tst_QByteArrayMatcher : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -2,5 +2,4 @@ load(qttest_p4)
SOURCES += tst_qfreelist.cpp SOURCES += tst_qfreelist.cpp
QT += core-private QT += core-private
QT -= gui QT -= gui
!contains(QT_CONFIG,private_tests): SOURCES += $$QT.core.sources/tools/qfreelist.cpp
!private_tests:SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp

View File

@ -47,6 +47,7 @@
#include <QtWidgets/qgraphicsview.h> #include <QtWidgets/qgraphicsview.h>
#include <QtWidgets/qwindowsstyle.h> #include <QtWidgets/qwindowsstyle.h>
class tst_QGraphicsAnchorLayout : public QObject { class tst_QGraphicsAnchorLayout : public QObject {
Q_OBJECT Q_OBJECT
@ -209,13 +210,13 @@ void tst_QGraphicsAnchorLayout::simple()
void tst_QGraphicsAnchorLayout::simple_center() void tst_QGraphicsAnchorLayout::simple_center()
{ {
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(50, 10); QSizeF pref(50, 10);
QSizeF max(100, 10); QSizeF maxSize(100, 10);
QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a");
QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b");
QGraphicsWidget *c = createItem(min, pref, max, "c"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setContentsMargins(0, 0, 0, 0); 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. // Useful for testing simplification between A_left and B_left.
// Unfortunately the only way to really test that now is to manually inspect the // Unfortunately the only way to really test that now is to manually inspect the
// simplified graph. // simplified graph.
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(50, 10); QSizeF pref(50, 10);
QSizeF max(100, 10); QSizeF maxSize(100, 10);
QGraphicsWidget *A = createItem(min, pref, max, "A"); QGraphicsWidget *A = createItem(minSize, pref, maxSize, "A");
QGraphicsWidget *B = createItem(min, pref, max, "B"); QGraphicsWidget *B = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a");
QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
@ -303,13 +304,13 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
void tst_QGraphicsAnchorLayout::layoutDirection() void tst_QGraphicsAnchorLayout::layoutDirection()
{ {
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(50, 10); QSizeF pref(50, 10);
QSizeF max(100, 10); QSizeF maxSize(100, 10);
QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a");
QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b");
QGraphicsWidget *c = createItem(min, pref, QSizeF(100, 20), "c"); QGraphicsWidget *c = createItem(minSize, pref, QSizeF(100, 20), "c");
a->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); a->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
b->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); b->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
@ -358,15 +359,15 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
void tst_QGraphicsAnchorLayout::diagonal() void tst_QGraphicsAnchorLayout::diagonal()
{ {
QSizeF min(10, 100); QSizeF minSize(10, 100);
QSizeF pref(70, 100); QSizeF pref(70, 100);
QSizeF max(100, 100); QSizeF maxSize(100, 100);
QGraphicsWidget *a = createItem(min, pref, max, "A"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A");
QGraphicsWidget *b = createItem(min, pref, max, "B"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget *c = createItem(min, pref, max, "C"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C");
QGraphicsWidget *d = createItem(min, pref, max, "D"); QGraphicsWidget *d = createItem(minSize, pref, maxSize, "D");
QGraphicsWidget *e = createItem(min, pref, max, "E"); QGraphicsWidget *e = createItem(minSize, pref, maxSize, "E");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
@ -902,12 +903,12 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
void tst_QGraphicsAnchorLayout::proportionalPreferred() void tst_QGraphicsAnchorLayout::proportionalPreferred()
{ {
QSizeF min(0, 100); QSizeF minSize(0, 100);
QGraphicsWidget *a = createItem(min, QSizeF(10, 100), QSizeF(20, 100), "A"); QGraphicsWidget *a = createItem(minSize, QSizeF(10, 100), QSizeF(20, 100), "A");
QGraphicsWidget *b = createItem(min, QSizeF(20, 100), QSizeF(30, 100), "B"); QGraphicsWidget *b = createItem(minSize, QSizeF(20, 100), QSizeF(30, 100), "B");
QGraphicsWidget *c = createItem(min, QSizeF(14, 100), QSizeF(20, 100), "C"); QGraphicsWidget *c = createItem(minSize, QSizeF(14, 100), QSizeF(20, 100), "C");
QGraphicsWidget *d = createItem(min, QSizeF(10, 100), QSizeF(20, 100), "D"); QGraphicsWidget *d = createItem(minSize, QSizeF(10, 100), QSizeF(20, 100), "D");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
@ -969,17 +970,17 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred()
void tst_QGraphicsAnchorLayout::example() void tst_QGraphicsAnchorLayout::example()
{ {
QSizeF min(30, 100); QSizeF minSize(30, 100);
QSizeF pref(210, 100); QSizeF pref(210, 100);
QSizeF max(300, 100); QSizeF maxSize(300, 100);
QGraphicsWidget *a = createItem(min, pref, max, "A"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A");
QGraphicsWidget *b = createItem(min, pref, max, "B"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget *c = createItem(min, pref, max, "C"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C");
QGraphicsWidget *d = createItem(min, pref, max, "D"); QGraphicsWidget *d = createItem(minSize, pref, maxSize, "D");
QGraphicsWidget *e = createItem(min, pref, max, "E"); QGraphicsWidget *e = createItem(minSize, pref, maxSize, "E");
QGraphicsWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), max, "F"); QGraphicsWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F");
QGraphicsWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), max, "G"); QGraphicsWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
@ -1057,13 +1058,13 @@ void tst_QGraphicsAnchorLayout::example()
void tst_QGraphicsAnchorLayout::setSpacing() void tst_QGraphicsAnchorLayout::setSpacing()
{ {
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(20, 20); QSizeF pref(20, 20);
QSizeF max(50, 50); QSizeF maxSize(50, 50);
QGraphicsWidget *a = createItem(min, pref, max); QGraphicsWidget *a = createItem(minSize, pref, maxSize);
QGraphicsWidget *b = createItem(min, pref, max); QGraphicsWidget *b = createItem(minSize, pref, maxSize);
QGraphicsWidget *c = createItem(min, pref, max); QGraphicsWidget *c = createItem(minSize, pref, maxSize);
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->addCornerAnchors(l, Qt::TopLeftCorner, a, Qt::TopLeftCorner); l->addCornerAnchors(l, Qt::TopLeftCorner, a, Qt::TopLeftCorner);
@ -1199,9 +1200,9 @@ int CustomLayoutStyle::pixelMetric(PixelMetric metric, const QStyleOption * opti
void tst_QGraphicsAnchorLayout::styleDefaults() void tst_QGraphicsAnchorLayout::styleDefaults()
{ {
QSizeF min (10, 10); QSizeF minSize (10, 10);
QSizeF pref(20, 20); QSizeF pref(20, 20);
QSizeF max (50, 50); QSizeF maxSize (50, 50);
/* /*
create this layout, where a,b have controlType QSizePolicy::RadioButton create this layout, where a,b have controlType QSizePolicy::RadioButton
@ -1214,20 +1215,20 @@ void tst_QGraphicsAnchorLayout::styleDefaults()
+-------+ +-------+
*/ */
QGraphicsScene scene; QGraphicsScene scene;
QGraphicsWidget *a = createItem(min, pref, max); QGraphicsWidget *a = createItem(minSize, pref, maxSize);
QSizePolicy spRadioButton = a->sizePolicy(); QSizePolicy spRadioButton = a->sizePolicy();
spRadioButton.setControlType(QSizePolicy::RadioButton); spRadioButton.setControlType(QSizePolicy::RadioButton);
a->setSizePolicy(spRadioButton); a->setSizePolicy(spRadioButton);
QGraphicsWidget *b = createItem(min, pref, max); QGraphicsWidget *b = createItem(minSize, pref, maxSize);
b->setSizePolicy(spRadioButton); b->setSizePolicy(spRadioButton);
QGraphicsWidget *c = createItem(min, pref, max); QGraphicsWidget *c = createItem(minSize, pref, maxSize);
QSizePolicy spPushButton = c->sizePolicy(); QSizePolicy spPushButton = c->sizePolicy();
spPushButton.setControlType(QSizePolicy::PushButton); spPushButton.setControlType(QSizePolicy::PushButton);
c->setSizePolicy(spPushButton); c->setSizePolicy(spPushButton);
QGraphicsWidget *d = createItem(min, pref, max); QGraphicsWidget *d = createItem(minSize, pref, maxSize);
d->setSizePolicy(spPushButton); d->setSizePolicy(spPushButton);
QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window); QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window);
@ -1301,17 +1302,17 @@ static QGraphicsAnchorLayout *createAmbiguousS60Layout()
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0); l->setSpacing(0);
QSizeF min(0, 10); QSizeF minSize(0, 10);
QSizeF pref(50, 10); QSizeF pref(50, 10);
QSizeF max(100, 10); QSizeF maxSize(100, 10);
QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a");
QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b");
QGraphicsWidget *c = createItem(min, pref, max, "c"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c");
QGraphicsWidget *d = createItem(min, pref, max, "d"); QGraphicsWidget *d = createItem(minSize, pref, maxSize, "d");
QGraphicsWidget *e = createItem(min, pref, max, "e"); QGraphicsWidget *e = createItem(minSize, pref, maxSize, "e");
QGraphicsWidget *f = createItem(min, pref, max, "f"); QGraphicsWidget *f = createItem(minSize, pref, maxSize, "f");
QGraphicsWidget *g = createItem(min, pref, max, "g"); QGraphicsWidget *g = createItem(minSize, pref, maxSize, "g");
//<!-- Trunk --> //<!-- Trunk -->
setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10);
@ -1681,15 +1682,15 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes()
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0); l->setSpacing(0);
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(50, 10); QSizeF pref(50, 10);
QSizeF max(QWIDGETSIZE_MAX, 10); QSizeF maxSize(QWIDGETSIZE_MAX, 10);
QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a");
QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b");
QGraphicsWidget *c = createItem(min, pref, max, "c"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c");
QGraphicsWidget *d = createItem(min, pref, max, "d"); QGraphicsWidget *d = createItem(minSize, pref, maxSize, "d");
QGraphicsWidget *e = createItem(min, pref, max, "e"); QGraphicsWidget *e = createItem(minSize, pref, maxSize, "e");
//<!-- Trunk --> //<!-- Trunk -->
setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
@ -1781,13 +1782,13 @@ void tst_QGraphicsAnchorLayout::simplifiableUnfeasible()
*/ */
void tst_QGraphicsAnchorLayout::simplificationVsOrder() void tst_QGraphicsAnchorLayout::simplificationVsOrder()
{ {
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(20, 10); QSizeF pref(20, 10);
QSizeF max(50, 10); QSizeF maxSize(50, 10);
QGraphicsWidget *a = createItem(min, pref, max, "A"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A");
QGraphicsWidget *b = createItem(min, pref, max, "B"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget *c = createItem(min, pref, max, "C"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C");
QGraphicsWidget frame; QGraphicsWidget frame;
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame);
@ -1822,12 +1823,12 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder()
void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter()
{ {
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(20, 10); QSizeF pref(20, 10);
QSizeF max(50, 10); QSizeF maxSize(50, 10);
QGraphicsWidget *a = createItem(min, pref, max, "A"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A");
QGraphicsWidget *b = createItem(min, pref, max, "B"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget parent; QGraphicsWidget parent;
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent);
@ -1851,13 +1852,13 @@ void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter()
*/ */
void tst_QGraphicsAnchorLayout::simplificationVsRedundance() void tst_QGraphicsAnchorLayout::simplificationVsRedundance()
{ {
QSizeF min(10, 10); QSizeF minSize(10, 10);
QSizeF pref(20, 10); QSizeF pref(20, 10);
QSizeF max(50, 30); QSizeF maxSize(50, 30);
QGraphicsWidget *a = createItem(min, pref, max, "A"); QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A");
QGraphicsWidget *b = createItem(min, pref, max, "B"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget *c = createItem(min, pref, max, "C"); QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C");
QGraphicsWidget frame; QGraphicsWidget frame;
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame);
@ -1916,13 +1917,13 @@ void tst_QGraphicsAnchorLayout::spacingPersistency()
*/ */
void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() void tst_QGraphicsAnchorLayout::snakeParallelWithLayout()
{ {
QSizeF min(10, 20); QSizeF minSize(10, 20);
QSizeF pref(50, 20); QSizeF pref(50, 20);
QSizeF max(100, 20); QSizeF maxSize(100, 20);
QGraphicsWidget *a = createItem(max, max, max, "A"); QGraphicsWidget *a = createItem(maxSize, maxSize, maxSize, "A");
QGraphicsWidget *b = createItem(min, pref, max, "B"); QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B");
QGraphicsWidget *c = createItem(max, max, max, "C"); QGraphicsWidget *c = createItem(maxSize, maxSize, maxSize, "C");
QGraphicsWidget parent; QGraphicsWidget parent;
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&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 // Note that A and C are fixed in the maximum size
QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(150, 60))); 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(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 // Then, we change the "snake" to be in parallel with half of the layout
delete l->anchor(c, Qt::AnchorRight, l, Qt::AnchorRight); delete l->anchor(c, Qt::AnchorRight, l, Qt::AnchorRight);
@ -1955,9 +1956,9 @@ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout()
parent.resize(l->effectiveSizeHint(Qt::PreferredSize)); parent.resize(l->effectiveSizeHint(Qt::PreferredSize));
QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(300, 60))); 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(b->geometry(), QRectF(QPointF(50, 20), pref));
QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), maxSize));
} }
/* /*

View File

@ -1,5 +1,5 @@
load(qttest_p4) load(qttest_p4)
QT += widgets QT += widgets gui-private
SOURCES += tst_qlistview.cpp SOURCES += tst_qlistview.cpp
win32:!wince*: LIBS += -luser32 win32:!wince*: LIBS += -luser32

View File

@ -57,14 +57,24 @@
#include <QtWidgets/QDialog> #include <QtWidgets/QDialog>
#include <QtWidgets/QStyledItemDelegate> #include <QtWidgets/QStyledItemDelegate>
#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) #if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
#include <windows.h> # include <windows.h>
#endif # include <QtGui/QGuiApplication>
# include <QtGui/QPlatformNativeInterface>
#endif // Q_OS_WIN
#include "../../shared/util.h" #include "../../shared/util.h"
//TESTED_CLASS= //TESTED_CLASS=
//TESTED_FILES= //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<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
}
#endif // Q_OS_WIN
class tst_QListView : public QObject class tst_QListView : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -1467,7 +1477,8 @@ public:
DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/; DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/;
DWORD wParam = 0; DWORD wParam = 0;
SendMessage(winId(), WM_GETOBJECT, wParam, lParam); if (const HWND hwnd =getHWNDForWidget(this))
SendMessage(hwnd, WM_GETOBJECT, wParam, lParam);
#endif #endif
} }

View File

@ -77,7 +77,7 @@ QT_END_NAMESPACE
static inline bool tabAllWidgets() static inline bool tabAllWidgets()
{ {
#if !defined(Q_WS_WIN) #if !defined(Q_OS_WIN)
if (qApp->style()->inherits("QMacStyle")) if (qApp->style()->inherits("QMacStyle"))
return qt_tab_all_widgets; return qt_tab_all_widgets;
#endif #endif

View File

@ -525,8 +525,9 @@ void tst_QMessageBox::testSymbols()
button = QMessageBox::Escape; button = QMessageBox::Escape;
button = QMessageBox::FlagMask; button = QMessageBox::FlagMask;
mb1.setText("Foo"); const QString text = QStringLiteral("Foo");
QCOMPARE(mb1.text(), "Foo"); mb1.setText(text);
QCOMPARE(mb1.text(), text);
icon = mb1.icon(); icon = mb1.icon();
QVERIFY(icon == QMessageBox::NoIcon); QVERIFY(icon == QMessageBox::NoIcon);
@ -537,26 +538,28 @@ void tst_QMessageBox::testSymbols()
mb1.setIconPixmap(iconPixmap); mb1.setIconPixmap(iconPixmap);
QVERIFY(mb1.icon() == QMessageBox::NoIcon); 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::Cancel), QString());
QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString()); QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString());
mb2.setButtonText(QMessageBox::Cancel, "Foo"); const QString button1 = QStringLiteral("Bar");
mb2.setButtonText(QMessageBox::Ok, "Bar"); mb2.setButtonText(QMessageBox::Cancel, QStringLiteral("Foo"));
mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz"); mb2.setButtonText(QMessageBox::Ok, button1);
mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, QStringLiteral("Baz"));
QCOMPARE(mb2.buttonText(QMessageBox::Cancel), QString()); 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")); QVERIFY(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes"));
QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString());
QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString());
mb3b.setButtonText(QMessageBox::Yes, "Blah"); const QString button2 = QStringLiteral("Blah");
mb3b.setButtonText(QMessageBox::YesAll, "Zoo"); mb3b.setButtonText(QMessageBox::Yes, button2);
mb3b.setButtonText(QMessageBox::Ok, "Zoo"); 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::YesAll), QString());
QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString());

View File

@ -3017,6 +3017,7 @@ signals:
void work(); void work();
}; };
namespace QObjectTest { // Do not clash with WinAPI 'DeleteObject'
class DeleteObject : public QObject class DeleteObject : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -3036,12 +3037,13 @@ public slots:
signals: signals:
void relayedSignal(); void relayedSignal();
}; };
} // namespace QObjectTest
void tst_QObject::deleteSelfInSlot() void tst_QObject::deleteSelfInSlot()
{ {
{ {
SenderObject sender; SenderObject sender;
DeleteObject *receiver = new DeleteObject(); QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject();
receiver->connect(&sender, receiver->connect(&sender,
SIGNAL(signal1()), SIGNAL(signal1()),
SLOT(deleteSelf()), SLOT(deleteSelf()),
@ -3052,7 +3054,7 @@ void tst_QObject::deleteSelfInSlot()
thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection); thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection);
thread.start(); thread.start();
QPointer<DeleteObject> p = receiver; QPointer<QObjectTest::DeleteObject> p = receiver;
sender.emitSignal1(); sender.emitSignal1();
QVERIFY(p.isNull()); QVERIFY(p.isNull());
@ -3061,7 +3063,7 @@ void tst_QObject::deleteSelfInSlot()
{ {
SenderObject sender; SenderObject sender;
DeleteObject *receiver = new DeleteObject(); QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject();
receiver->connect(&sender, receiver->connect(&sender,
SIGNAL(signal1()), SIGNAL(signal1()),
SLOT(relaySignalAndProcessEvents()), SLOT(relaySignalAndProcessEvents()),
@ -3076,7 +3078,7 @@ void tst_QObject::deleteSelfInSlot()
thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection); thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection);
thread.start(); thread.start();
QPointer<DeleteObject> p = receiver; QPointer<QObjectTest::DeleteObject> p = receiver;
sender.emitSignal1(); sender.emitSignal1();
QVERIFY(p.isNull()); QVERIFY(p.isNull());
@ -3085,9 +3087,9 @@ void tst_QObject::deleteSelfInSlot()
{ {
EmitThread sender; EmitThread sender;
DeleteObject *receiver = new DeleteObject(); QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject();
connect(&sender, SIGNAL(work()), receiver, SLOT(deleteSelf()), Qt::DirectConnection); connect(&sender, SIGNAL(work()), receiver, SLOT(deleteSelf()), Qt::DirectConnection);
QPointer<DeleteObject> p = receiver; QPointer<QObjectTest::DeleteObject> p = receiver;
sender.start(); sender.start();
QVERIFY(sender.wait(10000)); QVERIFY(sender.wait(10000));
QVERIFY(p.isNull()); QVERIFY(p.isNull());

View File

@ -94,9 +94,6 @@ private slots:
void isEmpty_data(); void isEmpty_data();
void isEmpty(); void isEmpty();
#ifdef Q_OS_WIN
void handle();
#endif
#if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) #if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL)
void clipRectangles(); void clipRectangles();
#endif #endif
@ -865,16 +862,6 @@ void tst_QRegion::isEmpty()
QVERIFY(region.rects().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) #if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL)
void tst_QRegion::clipRectangles() void tst_QRegion::clipRectangles()
{ {

View File

@ -40,9 +40,12 @@
****************************************************************************/ ****************************************************************************/
#include <QtTest/QtTest> #include <QtTest/QTest>
#include <QtTest/QSignalSpy>
#include <QtTest/QTestEventLoop>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QTimer>
#include <QtCore/QSocketNotifier> #include <QtCore/QSocketNotifier>
#include <QtNetwork/QTcpServer> #include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket> #include <QtNetwork/QTcpSocket>
@ -55,9 +58,14 @@
#endif #endif
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
#include <private/qnet_unix_p.h> #include <private/qnet_unix_p.h>
#include <sys/select.h>
#endif #endif
#include <limits> #include <limits>
#include <sys/select.h>
#if defined (Q_CC_MSVC) && defined(max)
# undef max
# undef min
#endif // Q_CC_MSVC
class tst_QSocketNotifier : public QObject class tst_QSocketNotifier : public QObject
{ {

View File

@ -40,9 +40,13 @@
****************************************************************************/ ****************************************************************************/
#include <QtTest/QtTest> #include <QtTest/QTest>
#include <QtTest/QTestEventLoop>
#include <qcoreapplication.h> #include <QtCore/QQueue>
#include <QtCore/QString>
#include <QtCore/QCoreApplication>
#include <QtCore/QMetaType>
#include <private/qsocks5socketengine_p.h> #include <private/qsocks5socketengine_p.h>
#include <qhostinfo.h> #include <qhostinfo.h>

View File

@ -1,5 +1,7 @@
load(qttest_p4) load(qttest_p4)
QT += gui widgets
INCLUDEPATH += $$PWD/../modeltest INCLUDEPATH += $$PWD/../modeltest
SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp

View File

@ -48,6 +48,7 @@
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
#include <QtWidgets/QSortFilterProxyModel>
#include <qdebug.h> #include <qdebug.h>

View File

@ -54,8 +54,10 @@
#include <QNetworkProxy> #include <QNetworkProxy>
#include <QAuthenticator> #include <QAuthenticator>
#include "private/qhostinfo_p.h" #include <private/qhostinfo_p.h>
#include "private/qsslsocket_openssl_p.h" #ifndef QT_NO_OPENSSL
# include <private/qsslsocket_openssl_p.h>
#endif
#include "../network-settings.h" #include "../network-settings.h"

View File

@ -55,9 +55,8 @@
class tst_QStaticText: public QObject class tst_QStaticText: public QObject
{ {
Q_OBJECT Q_OBJECT
public:
private: tst_QStaticText() {}
bool supportsTransformations() const;
private slots: private slots:
void initTestCase(); void initTestCase();
@ -103,6 +102,8 @@ private slots:
void textDocumentColor(); void textDocumentColor();
private: private:
bool supportsTransformations() const;
QImage const m_whiteSquare; QImage const m_whiteSquare;
}; };

View File

@ -235,7 +235,7 @@ Q_DECLARE_METATYPE(IntList)
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
#if defined (Q_WS_WIN) #if defined (Q_OS_WIN)
# include <windows.h> # include <windows.h>
// mingw defines NAN and INFINITY to 0/0 and x/0 // mingw defines NAN and INFINITY to 0/0 and x/0
# if defined(Q_CC_GNU) # if defined(Q_CC_GNU)

View File

@ -172,14 +172,14 @@ void tst_QTabBar::setIconSize_data()
QTest::addColumn<int>("sizeToSet"); QTest::addColumn<int>("sizeToSet");
QTest::addColumn<int>("expectedWidth"); QTest::addColumn<int>("expectedWidth");
int iconDefault = qApp->style()->pixelMetric(QStyle::PM_TabBarIconSize); const int iconDefault = qApp->style()->pixelMetric(QStyle::PM_TabBarIconSize);
int small = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize); const int smallIconSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize);
int large = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize); const int largeIconSize = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize);
QTest::newRow("default") << -1 << iconDefault; QTest::newRow("default") << -1 << iconDefault;
QTest::newRow("zero") << 0 << 0; QTest::newRow("zero") << 0 << 0;
QTest::newRow("same as default") << iconDefault << iconDefault; QTest::newRow("same as default") << iconDefault << iconDefault;
QTest::newRow("large") << large << large; QTest::newRow("large") << largeIconSize << largeIconSize;
QTest::newRow("small") << small << small; QTest::newRow("small") << smallIconSize << smallIconSize;
} }
void tst_QTabBar::setIconSize() void tst_QTabBar::setIconSize()

View File

@ -112,7 +112,7 @@ void tst_QTransform::cleanup()
// No cleanup is required. // No cleanup is required.
} }
#ifdef Q_OS_WIN32 #if defined(Q_OS_WIN) && !defined(M_PI)
#define M_PI 3.14159265897932384626433832795f #define M_PI 3.14159265897932384626433832795f
#endif #endif
@ -740,10 +740,10 @@ void tst_QTransform::inverted_data()
QTest::newRow("big") << big; QTest::newRow("big") << big;
QTransform small; QTransform smallTransform;
small.scale(1/s, 1/s); smallTransform.scale(1/s, 1/s);
QTest::newRow("small") << small; QTest::newRow("small") << smallTransform;
} }
void tst_QTransform::inverted() void tst_QTransform::inverted()

View File

@ -1,6 +1,6 @@
load(qttest_p4) load(qttest_p4)
QT += gui-private QT += gui-private widgets
SOURCES += tst_qvolatileimage.cpp SOURCES += tst_qvolatileimage.cpp

View File

@ -1,4 +1,4 @@
load(qttest_p4) load(qttest_p4)
SOURCES += tst_qwineventnotifier.cpp SOURCES += tst_qwineventnotifier.cpp
QT = core QT = core core-private
CONFIG += parallel_test CONFIG += parallel_test