From 285799f27444fc7898641c0098e90d95c5e605e6 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 14 Sep 2010 09:33:45 +0200 Subject: Q_MAC_USE_COCOA -> QT_MAC_USE_COCOA Make sure test is run on Cocoa like intended Reviewed-by: TrustMe --- tests/auto/qpainter/tst_qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 3efc54d..d16c37a 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -4566,7 +4566,7 @@ void tst_QPainter::clipBoundingRect() void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053() { -#if !defined(Q_WS_MAC) || !defined(Q_MAC_USE_COCOA) +#if !defined(Q_WS_MAC) || !defined(QT_MAC_USE_COCOA) QSKIP("Only Mac/Cocoa supports sub pixel positions in raster engine currently", SkipAll); #endif -- cgit v0.12 From 919c5a0e4b15b993d438dd137b17d4710228c595 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 14 Sep 2010 09:38:33 +0200 Subject: Skip sub pixel positions test if font smoothing is off Copy/paste the test from qapplication_mac.mm where we detect if font smoothing is actually on by drawing an x into a buffer and checking the result for non-gray pixels. Reviewed-by: Jiang Jiang --- tests/auto/qpainter/tst_qpainter.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index d16c37a..9b8444c 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -4570,6 +4570,31 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053() QSKIP("Only Mac/Cocoa supports sub pixel positions in raster engine currently", SkipAll); #endif + int w = 10, h = 10; + QImage image(w, h, QImage::Format_RGB32); + image.fill(0xffffffff); + QPainter p(&image); + p.drawText(0, h, "X\\"); + p.end(); + + bool foundNonGrayPixel = false; + const int *bits = (const int *) ((const QImage &) image).bits(); + int bpl = image.bytesPerLine() / 4; + for (int y=0; yfont()); QImage baseLine(fm.width(QChar::fromLatin1('e')), fm.height(), QImage::Format_RGB32); -- cgit v0.12