From f0f1d8588892ba94301ecad2aa4495e9bfa364ae Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 25 Jan 2010 14:45:46 +0100 Subject: Handle RGB_32 format pixmaps correctly The alpha channel is undefined for RGB_32 --- tests/auto/qwidget/tst_qwidget.cpp | 7 +++++-- 1 file 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; \ } \ -- cgit v0.12