diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-10-05 13:36:38 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-06 03:07:24 (GMT) |
commit | 8b7fb503e67ad43374df166cddde158a205b3981 (patch) | |
tree | f1c917785228641a6a3fb20184b9e9935ded5c61 /tests | |
parent | 1decaac044da42a6ccbf84898f0ded6d3b5c70d0 (diff) | |
download | Qt-8b7fb503e67ad43374df166cddde158a205b3981.zip Qt-8b7fb503e67ad43374df166cddde158a205b3981.tar.gz Qt-8b7fb503e67ad43374df166cddde158a205b3981.tar.bz2 |
Fixed bug in X11 paint engine causing source pixmap depth to change.
Setting a pixmap brush when painting to a 32-bit target might cause the
source pixmap to be converted to 32-bit. We should detach the pixmap if
we need to convert it.
Reviewed-by: Trond
(cherry picked from commit 1210fa5b2d65895ad2be1f9ca7cae586e3b29dc1)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 2568b94..36c1518 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -166,6 +166,8 @@ private slots: void fromImage_crash(); void fromData(); + + void preserveDepth(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1448,6 +1450,23 @@ void tst_QPixmap::task_246446() QVERIFY(pm.mask().isNull()); } +void tst_QPixmap::preserveDepth() +{ + QPixmap target(64, 64); + target.fill(Qt::transparent); + + QPixmap source(64, 64); + source.fill(Qt::white); + + int depth = source.depth(); + + QPainter painter(&target); + painter.setBrush(source); + painter.drawRect(target.rect()); + painter.end(); + + QCOMPARE(depth, source.depth()); +} QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" |