diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-31 16:06:00 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-31 16:06:00 (GMT) |
commit | f93db15d46ddcb88189a5ba010b27aeac783ed24 (patch) | |
tree | ba52b6be0d1927ee694bb78daa13cdeb001c9927 /tests/auto | |
parent | 4a6386b0b75f97c6d53efbeb5cd51fb4247c4c11 (diff) | |
parent | 349b6c734aa7af85f3709312325c3b2e9abdad2b (diff) | |
download | Qt-f93db15d46ddcb88189a5ba010b27aeac783ed24.zip Qt-f93db15d46ddcb88189a5ba010b27aeac783ed24.tar.gz Qt-f93db15d46ddcb88189a5ba010b27aeac783ed24.tar.bz2 |
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index f7db6b3..42303d2 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -49,6 +49,7 @@ #include <qfontmetrics.h> #include <qbitmap.h> #include <qimage.h> +#include <qthread.h> #include <limits.h> #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) #include <qprinter.h> @@ -258,6 +259,8 @@ private slots: void drawPointScaled(); + void QTBUG14614_gradientCacheRaceCondition(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4652,6 +4655,36 @@ void tst_QPainter::drawPointScaled() QCOMPARE(image.pixel(16, 16), 0xffff0000); } +class GradientProducer : public QThread +{ +protected: + void run(); +}; + +void GradientProducer::run() +{ + QImage image(1, 1, QImage::Format_RGB32); + QPainter p(&image); + + for (int i = 0; i < 1000; ++i) { + QLinearGradient g; + g.setColorAt(0, QColor(i % 256, 0, 0)); + g.setColorAt(1, Qt::white); + + p.fillRect(image.rect(), g); + } +} + +void tst_QPainter::QTBUG14614_gradientCacheRaceCondition() +{ + const int threadCount = 16; + GradientProducer producers[threadCount]; + for (int i = 0; i < threadCount; ++i) + producers[i].start(); + for (int i = 0; i < threadCount; ++i) + producers[i].wait(); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |