summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-06-05 13:58:15 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-07 00:37:58 +0200
commit3874022ec046865f80af3b2d772bc00310e0437c (patch)
tree0a360fbd01302d7c10578fdcce57c068ef74562a /tests
parent5951b613741389508cd580629caa0ea93a35b43b (diff)
Make qpainter autotest build without widgets
Change-Id: I4e05871e44f7a69aaa9cd5d876c249c7dd9d86e8 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/painting/qpainter/qpainter.pro3
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp30
2 files changed, 31 insertions, 2 deletions
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 <QtTest/QtTest>
#include <qpainter.h>
+#ifndef QT_NO_WIDGETS
#include <qdrawutil.h>
#include <qapplication.h>
#include <qwidget.h>
+#endif
#include <qfontmetrics.h>
#include <qbitmap.h>
#include <qimage.h>
#include <qthread.h>
#include <limits.h>
#if !defined(Q_OS_WINCE)
+#ifndef QT_NO_WIDGETS
#include <qprinter.h>
+#endif
#include <math.h>
#endif
#include <qpaintengine.h>
+#ifndef QT_NO_WIDGETS
#include <qdesktopwidget.h>
+#endif
#include <qpixmap.h>
#include <qpainter.h>
+#ifndef QT_NO_WIDGETS
#include <qlabel.h>
+#endif
#include <qqueue.h>
+#ifndef QT_NO_WIDGETS
#include <qgraphicsview.h>
#include <qgraphicsscene.h>
#include <qgraphicsproxywidget.h>
#include <qlayout.h>
+#endif
#include <qfontdatabase.h>
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()
{