From 3874022ec046865f80af3b2d772bc00310e0437c Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 5 Jun 2012 13:58:15 +0200 Subject: Make qpainter autotest build without widgets Change-Id: I4e05871e44f7a69aaa9cd5d876c249c7dd9d86e8 Reviewed-by: Gunnar Sletta --- tests/auto/gui/painting/qpainter/qpainter.pro | 3 ++- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 30 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 5a799ea0ff..5371aa451a 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -2,7 +2,8 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qpainter -QT += widgets widgets-private printsupport testlib +QT += testlib +!contains(QT_CONFIG, no-widgets): QT += widgets widgets-private printsupport SOURCES += tst_qpainter.cpp diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 553e36a884..2ff6098035 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -42,32 +42,42 @@ #include #include +#ifndef QT_NO_WIDGETS #include #include #include +#endif #include #include #include #include #include #if !defined(Q_OS_WINCE) +#ifndef QT_NO_WIDGETS #include +#endif #include #endif #include +#ifndef QT_NO_WIDGETS #include +#endif #include #include +#ifndef QT_NO_WIDGETS #include +#endif #include +#ifndef QT_NO_WIDGETS #include #include #include #include +#endif #include Q_DECLARE_METATYPE(QGradientStops) @@ -92,12 +102,16 @@ public slots: void cleanupTestCase(); private slots: void getSetCheck(); +#ifndef QT_NO_WIDGETS void drawPixmap_comp_data(); void drawPixmap_comp(); +#endif void saveAndRestore_data(); void saveAndRestore(); +#ifndef QT_NO_WIDGETS void drawBorderPixmap(); +#endif void drawPixmapFragments(); void drawLine_data(); @@ -136,7 +150,9 @@ private slots: void qimageFormats(); void textOnTransparentImage(); +#ifndef QT_NO_WIDGETS void initFrom(); +#endif void setWindow(); @@ -173,7 +189,9 @@ private slots: void drawhelper_blend_color(); +#ifndef QT_NO_WIDGETS void childWidgetViewport(); +#endif void fillRect_objectBoundingModeGradient(); void fillRect_stretchToDeviceMode(); @@ -246,7 +264,9 @@ private slots: void setPenColorOnImage(); void setPenColorOnPixmap(); +#ifndef QT_NO_WIDGETS void QTBUG5939_attachPainterPrivate(); +#endif void drawPointScaled(); @@ -350,7 +370,7 @@ Q_DECLARE_METATYPE(QRegion) tst_QPainter::tst_QPainter() { // QtTestCase sets this to false, but this turns off alpha pixmaps on Unix. - QApplication::setDesktopSettingsAware(true); + QGuiApplication::setDesktopSettingsAware(true); } tst_QPainter::~tst_QPainter() @@ -417,6 +437,7 @@ static const char* const maskResult_data[] = { "...ddddddddddddd"}; +#ifndef QT_NO_WIDGETS void tst_QPainter::drawPixmap_comp_data() { if (qApp->desktop()->depth() < 24) @@ -511,6 +532,7 @@ void tst_QPainter::drawPixmap_comp() QVERIFY(!different); } +#endif void tst_QPainter::saveAndRestore_data() { @@ -696,6 +718,7 @@ static QRect getPaintedSize(const QPixmap &pm, const QColor &background) return getPaintedSize(pm.toImage(), background); } +#ifndef QT_NO_WIDGETS void tst_QPainter::initFrom() { QWidget *widget = new QWidget(); @@ -731,6 +754,7 @@ void tst_QPainter::drawBorderPixmap() qDrawBorderPixmap(&p, QRect(0,0,75,105), QMargins(39,39,39,39), src, QRect(0,0,79,79), QMargins(39,39,39,39), QTileRules(Qt::StretchTile,Qt::StretchTile), 0); } +#endif void tst_QPainter::drawPixmapFragments() { @@ -2452,6 +2476,7 @@ void tst_QPainter::drawhelper_blend_color() QCOMPARE(dest, expected); } +#ifndef QT_NO_WIDGETS class ViewportTestWidget : public QWidget { public: @@ -2488,6 +2513,7 @@ void tst_QPainter::childWidgetViewport() qWarning("Failed to ensure that paintEvent has been run. Could not run test."); } } +#endif void tst_QPainter::fillRect_objectBoundingModeGradient() { @@ -4058,6 +4084,7 @@ void tst_QPainter::setPenColorOnPixmap() setPenColor(p); } +#ifndef QT_NO_WIDGETS class TestProxy : public QGraphicsProxyWidget { public: @@ -4106,6 +4133,7 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate() QVERIFY(widget->worldTransform.isIdentity()); QCOMPARE(widget->deviceTransform, proxy->deviceTransform); } +#endif void tst_QPainter::clipBoundingRect() { -- cgit v1.2.3