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;
// COM interface macro.
#if defined(Q_OS_WIN) && defined(interface)
# undef interface
#endif
//TESTED_CLASS=
//TESTED_FILES=

View File

@ -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<int> vector;
vector.push_back(1);

View File

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

View File

@ -445,7 +445,7 @@ void tst_QtConcurrentThreadEngine::exceptions()
QtConcurrentExceptionThrower *e = new QtConcurrentExceptionThrower();
QFuture<void> 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<void> 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;
}

View File

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

View File

@ -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");

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@
****************************************************************************/
#include <QtTest/QtTest>
#include <QtTest/QTest>
#ifdef Q_OS_WIN
#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);
#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;

View File

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

View File

@ -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

View File

@ -47,6 +47,7 @@
#include <QtWidgets/qgraphicsview.h>
#include <QtWidgets/qwindowsstyle.h>
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");
//<!-- Trunk -->
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");
//<!-- Trunk -->
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));
}
/*

View File

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

View File

@ -57,14 +57,24 @@
#include <QtWidgets/QDialog>
#include <QtWidgets/QStyledItemDelegate>
#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
#include <windows.h>
#endif
# include <windows.h>
# include <QtGui/QGuiApplication>
# include <QtGui/QPlatformNativeInterface>
#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<HWND> (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
}

View File

@ -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

View File

@ -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());

View File

@ -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<DeleteObject> p = receiver;
QPointer<QObjectTest::DeleteObject> 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<DeleteObject> p = receiver;
QPointer<QObjectTest::DeleteObject> 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<DeleteObject> p = receiver;
QPointer<QObjectTest::DeleteObject> p = receiver;
sender.start();
QVERIFY(sender.wait(10000));
QVERIFY(p.isNull());

View File

@ -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()
{

View File

@ -40,9 +40,12 @@
****************************************************************************/
#include <QtTest/QtTest>
#include <QtTest/QTest>
#include <QtTest/QSignalSpy>
#include <QtTest/QTestEventLoop>
#include <QtCore/QCoreApplication>
#include <QtCore/QTimer>
#include <QtCore/QSocketNotifier>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
@ -55,9 +58,14 @@
#endif
#ifdef Q_OS_UNIX
#include <private/qnet_unix_p.h>
#include <sys/select.h>
#endif
#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
{

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 <qhostinfo.h>

View File

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

View File

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

View File

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

View File

@ -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;
};

View File

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

View File

@ -172,14 +172,14 @@ void tst_QTabBar::setIconSize_data()
QTest::addColumn<int>("sizeToSet");
QTest::addColumn<int>("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()

View File

@ -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()

View File

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

View File

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