summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/painting
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/gui/painting
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp8
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp27
-rw-r--r--tests/auto/gui/painting/qprinter/tst_qprinter.cpp17
-rw-r--r--tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp14
4 files changed, 32 insertions, 34 deletions
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 7db941bb20..1090b5ddcf 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -111,7 +111,7 @@ private slots:
void achromaticHslHue();
-#if defined(Q_WS_X11) && !defined(Q_OS_IRIX)
+#ifdef Q_WS_X11
void setallowX11ColorNames();
#endif
};
@@ -1335,10 +1335,12 @@ void tst_QColor::achromaticHslHue()
QCOMPARE(hsl.hslHue(), -1);
}
-// This test fails on IRIX due to the gamma settings in the SGI X server.
-#if defined(Q_WS_X11) && !defined(Q_OS_IRIX)
+#ifdef Q_WS_X11
void tst_QColor::setallowX11ColorNames()
{
+#if defined(Q_OS_IRIX)
+ QSKIP("This fails due to the gamma settings in the SGI X server");
+#endif
RGBData x11RgbTbl[] = {
// a few standard X11 color names
{ "DodgerBlue1", qRgb(30, 144, 255) },
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index d41e0e4650..529bb3ee20 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -94,10 +94,8 @@ public slots:
void cleanup();
private slots:
void getSetCheck();
-#ifndef Q_WS_MAC
void drawPixmap_comp_data();
void drawPixmap_comp();
-#endif
void saveAndRestore_data();
void saveAndRestore();
@@ -183,10 +181,8 @@ private slots:
void fillRect_stretchToDeviceMode();
void monoImages();
-#ifndef Q_WS_QWS
void linearGradientSymmetry_data();
void linearGradientSymmetry();
-#endif
void gradientInterpolation();
void fpe_pixmapTransform();
@@ -219,9 +215,7 @@ private slots:
void drawRect_task215378();
void drawRect_task247505();
-#if defined(Q_OS_MAC)
void drawText_subPixelPositionsInRaster_qtbug5053();
-#endif
void drawImage_data();
void drawImage();
@@ -416,8 +410,6 @@ static const char* const maskResult_data[] = {
"...ddddddddddddd"};
-// Mac has other ideas about alpha composition
-#ifndef Q_WS_MAC
void tst_QPainter::drawPixmap_comp_data()
{
if (qApp->desktop()->depth() < 24)
@@ -462,6 +454,9 @@ QRgb qt_compose_alpha(QRgb source, QRgb dest)
*/
void tst_QPainter::drawPixmap_comp()
{
+#ifdef Q_WS_MAC
+ QSKIP("Mac has other ideas about alpha composition");
+#endif
QFETCH(uint, dest);
QFETCH(uint, source);
@@ -509,7 +504,6 @@ void tst_QPainter::drawPixmap_comp()
QVERIFY(!different);
}
-#endif
void tst_QPainter::saveAndRestore_data()
{
@@ -3522,8 +3516,6 @@ static QLinearGradient inverseGradient(QLinearGradient g)
return g2;
}
-// QWS has limited resolution in the gradient color table
-#ifndef Q_WS_QWS
void tst_QPainter::linearGradientSymmetry_data()
{
QTest::addColumn<QGradientStops>("stops");
@@ -3555,6 +3547,9 @@ void tst_QPainter::linearGradientSymmetry_data()
void tst_QPainter::linearGradientSymmetry()
{
+#ifdef Q_WS_QWS
+ QSKIP("QWS has limited resolution in the gradient color table");
+#else
QFETCH(QGradientStops, stops);
QImage a(64, 8, QImage::Format_ARGB32_Premultiplied);
@@ -3576,8 +3571,8 @@ void tst_QPainter::linearGradientSymmetry()
b = b.mirrored(true);
QCOMPARE(a, b);
-}
#endif
+}
void tst_QPainter::gradientInterpolation()
{
@@ -4148,11 +4143,12 @@ void tst_QPainter::clipBoundingRect()
}
-//Only Mac/Cocoa supports sub pixel positions in raster engine currently
-#ifdef Q_OS_MAC
void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
{
- QFontMetricsF fm(qApp->font());
+#if !defined(Q_OS_MAC)
+ QSKIP("Only Mac supports sub pixel positions in raster engine currently");
+#endif
+ QFontMetricsF fm(qApp->font());
QImage baseLine(fm.width(QChar::fromLatin1('e')), fm.height(), QImage::Format_RGB32);
baseLine.fill(Qt::white);
@@ -4179,7 +4175,6 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
QVERIFY(foundDifferentRasterization);
}
-#endif
void tst_QPainter::drawPointScaled()
{
diff --git a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp
index 0fac12d227..cbfa8a2d35 100644
--- a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp
+++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp
@@ -74,17 +74,13 @@ public slots:
private slots:
void getSetCheck();
// Add your testfunctions and testdata create functions here
-#ifdef Q_WS_WIN
void testPageSize();
-#endif
void testPageRectAndPaperRect();
void testPageRectAndPaperRect_data();
void testSetOptions();
void testMargins_data();
void testMargins();
-#ifdef Q_OS_WIN
void testNonExistentPrinter();
-#endif // Q_OS_WIN
void testPageSetupDialog();
void testMulitpleSets_data();
void testMulitpleSets();
@@ -224,10 +220,11 @@ void tst_QPrinter::testPageSetupDialog()
}
}
-// QPrinter::winPageSize() does not exist for non-Windows platforms.
-#ifdef Q_WS_WIN
void tst_QPrinter::testPageSize()
{
+#ifndef Q_OS_WIN
+ QSKIP("QPrinter::winPageSize() does not exist for non-Windows platforms");
+#else
QPrinter prn;
prn.setPageSize(QPrinter::Letter);
@@ -245,8 +242,8 @@ void tst_QPrinter::testPageSize()
prn.setWinPageSize(DMPAPER_A4);
MYCOMPARE(prn.winPageSize(), DMPAPER_A4);
MYCOMPARE(prn.pageSize(), QPrinter::A4);
-}
#endif
+}
void tst_QPrinter::testPageRectAndPaperRect_data()
{
@@ -385,9 +382,11 @@ void tst_QPrinter::testMargins()
delete painter;
}
-#ifdef Q_OS_WIN
void tst_QPrinter::testNonExistentPrinter()
{
+#ifndef Q_OS_WIN
+ QSKIP("QPrinter::testNonExistentPrinter() is not relevant for this platform");
+#else
QPrinter printer;
QPainter painter;
@@ -415,8 +414,8 @@ void tst_QPrinter::testNonExistentPrinter()
QCOMPARE(printer.printEngine()->metric(QPaintDevice::PdmPhysicalDpiY), 0);
QVERIFY(!painter.begin(&printer));
+#endif
}
-#endif // Q_OS_WIN
void tst_QPrinter::testMulitpleSets_data()
{
diff --git a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp
index e039347801..f9734df10d 100644
--- a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp
@@ -66,10 +66,8 @@ public slots:
void initTestCase();
#else
private slots:
-#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32)
void testForDefaultPrinter();
void testForPrinters();
-#endif
void testForPaperSizes();
void testConstructors();
void testAssignment();
@@ -208,9 +206,9 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command)
#endif
}
-#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32)
void tst_QPrinterInfo::testForDefaultPrinter()
{
+#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32)
# ifdef Q_OS_WIN32
if (QHostInfo::localHostName() == "fantomet" || QHostInfo::localHostName() == "bobo") {
QWARN("Test is hardcoded to \"fantomet\" and \"bobo\" on Windows and may fail");
@@ -242,12 +240,14 @@ void tst_QPrinterInfo::testForDefaultPrinter()
}
if (!found && defSysPrinter != "") QFAIL("No default printer reported by Qt, although there is one");
-}
+#else
+ QSKIP("Test doesn't work on non-Unix");
#endif
+}
-#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32)
void tst_QPrinterInfo::testForPrinters()
{
+#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32)
# ifdef Q_OS_WIN32
if (QHostInfo::localHostName() == "fantomet" || QHostInfo::localHostName() == "bobo") {
QWARN("Test is hardcoded to \"fantomet\" and \"bobo\" on Windows and may fail");
@@ -291,8 +291,10 @@ void tst_QPrinterInfo::testForPrinters()
QFAIL(qPrintable(QString("Printer '%1' reported by system, but not reported by Qt").arg(sysPrinters.at(i))));
}
}
-}
+#else
+ QSKIP("Test doesn't work on non-Unix");
#endif
+}
void tst_QPrinterInfo::testForPaperSizes()
{