summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-04-11 10:48:35 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-04-11 10:48:35 (GMT)
commit0f7a4790bb0e3435a02f8751a29dc06c1f88d8d5 (patch)
tree048becf4088502e3b8cdf018b37d966ef3887357
parentde9dd35dd8dc7502fcb4bd94ec1bbf2ff2435a68 (diff)
downloadQt-0f7a4790bb0e3435a02f8751a29dc06c1f88d8d5.zip
Qt-0f7a4790bb0e3435a02f8751a29dc06c1f88d8d5.tar.gz
Qt-0f7a4790bb0e3435a02f8751a29dc06c1f88d8d5.tar.bz2
tst_QStyle::drawItemPixmap test case fails on Symbian^3
The autotest assumes that created QPixmap are exactly same irregardless how the pixmaps were created. However, there is no guarantee that pixmaps that look the same (i.e. in this case green rectangles) are "same". QPixmap is platform dependent and might have e.g. optimized format in some of the platforms. Task-number: QT-4805 Reviewed-by: Jani Hautakangas
-rw-r--r--tests/auto/qstyle/tst_qstyle.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp
index ad5d7ff..5c319f0 100644
--- a/tests/auto/qstyle/tst_qstyle.cpp
+++ b/tests/auto/qstyle/tst_qstyle.cpp
@@ -272,6 +272,18 @@ void tst_QStyle::drawItemPixmap()
QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG");
QPixmap actualPix = QPixmap::grabWidget(testWidget);
+
+#ifdef Q_OS_SYMBIAN
+ // QPixmap cannot be assumed to be exactly same, unless it is created from exactly same content.
+ // In Symbian, pixmap format might get "optimized" depending on how QPixmap is created.
+ // Therefore, force the content to specific format and compare QImages.
+ // Then re-create the QPixmaps and compare those.
+ QImage i1 = p.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ p = QPixmap::fromImage(i1);
+ QImage i2 = actualPix.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ actualPix = QPixmap::fromImage(i2);
+ QVERIFY(i1 == i2);
+#endif
QVERIFY(pixmapsAreEqual(&actualPix,&p));
testWidget->hide();
}