diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-05-05 16:30:28 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-05-05 16:30:28 (GMT) |
commit | 9e95890804d8b5114f8090496b82327178055348 (patch) | |
tree | dbc17e0bceadcbd771e45a29cb1addcdd7fa18c2 /tests/auto/qpainter | |
parent | 671fff6071d1064094bf41364b11df3b55e7a65c (diff) | |
parent | d1ac6af4f30e822e161fd8772104aa2e30e55a2f (diff) | |
download | Qt-9e95890804d8b5114f8090496b82327178055348.zip Qt-9e95890804d8b5114f8090496b82327178055348.tar.gz Qt-9e95890804d8b5114f8090496b82327178055348.tar.bz2 |
Merge remote-tracking branch 'origin/4.8'
Diffstat (limited to 'tests/auto/qpainter')
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 76bc5d63..9844434 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -72,6 +72,7 @@ #include <qgraphicsscene.h> #include <qgraphicsproxywidget.h> #include <qlayout.h> +#include <qfontdatabase.h> #if defined(Q_OS_SYMBIAN) # define SRCDIR "." @@ -266,6 +267,8 @@ private slots: void QTBUG17053_zeroDashPattern(); + void drawTextOutsideGuiThread(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4739,6 +4742,44 @@ void tst_QPainter::QTBUG17053_zeroDashPattern() QCOMPARE(image, original); } +class TextDrawerThread : public QThread +{ +public: + void run(); + QImage rendering; +}; + +void TextDrawerThread::run() +{ + rendering = QImage(100, 100, QImage::Format_ARGB32_Premultiplied); + rendering.fill(0); + QPainter p(&rendering); + p.fillRect(10, 10, 100, 100, Qt::blue); + p.setPen(Qt::green); + p.drawText(20, 20, "some text"); + p.end(); +} + +void tst_QPainter::drawTextOutsideGuiThread() +{ + if (!QFontDatabase::supportsThreadedFontRendering()) + QSKIP("No threaded font rendering", SkipAll); + + QImage referenceRendering(100, 100, QImage::Format_ARGB32_Premultiplied); + referenceRendering.fill(0); + QPainter p(&referenceRendering); + p.fillRect(10, 10, 100, 100, Qt::blue); + p.setPen(Qt::green); + p.drawText(20, 20, "some text"); + p.end(); + + TextDrawerThread t; + t.start(); + t.wait(); + + QCOMPARE(referenceRendering, t.rendering); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |