summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-01-25 13:45:46 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-01-25 13:45:46 (GMT)
commitf0f1d8588892ba94301ecad2aa4495e9bfa364ae (patch)
tree28e4020b4e651ac8a60595666cc4122fad2f587e /tests/auto/qwidget
parent05fefd9fcfb05d6ca6d60c1da2d8a1dca9b32874 (diff)
downloadQt-f0f1d8588892ba94301ecad2aa4495e9bfa364ae.zip
Qt-f0f1d8588892ba94301ecad2aa4495e9bfa364ae.tar.gz
Qt-f0f1d8588892ba94301ecad2aa4495e9bfa364ae.tar.bz2
Handle RGB_32 format pixmaps correctly
The alpha channel is undefined for RGB_32
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index ea90ae3..9ed2d37 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -5450,9 +5450,12 @@ public:
QCOMPARE(pixmap.size(), rect.size()); \
QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \
expectedPixmap.fill(color); \
- if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 ) \
+ QImage image = pixmap.toImage(); \
+ uint alphaCorrection = image.format() == QImage::Format_RGB32 ? 0xff000000 : 0; \
+ uint firstPixel = image.pixel(0,0) | alphaCorrection; \
+ if ( firstPixel != QColor(color).rgb() && t < 4 ) \
{ QTest::qWait(200); continue; } \
- QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); \
+ QCOMPARE(firstPixel, QColor(color).rgb()); \
QCOMPARE(pixmap, expectedPixmap); \
break; \
} \