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