diff options
author | Andy Shaw <andy.shaw@qt.io> | 2021-10-14 13:24:50 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-17 10:57:56 +0000 |
commit | e0df5720b6fb0f9f2d93f0de719126d4a571bbec (patch) | |
tree | 952550b719dcf75a4695d8759332d06994ca4a5c /tests/auto | |
parent | 0e35d3cfa17d02fd3d70269da503eaa19c0c06b7 (diff) |
When filling a pixmap after an assignment ensure the set DPR is not lost
Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a36c84c6a3dca29afdb7741b16975c108be341ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index a70305bb14..6c6c282af4 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -121,6 +121,7 @@ private slots: void copy(); void move(); void deepCopyPreservesDpr(); + void fillPreservesDpr(); void dprPassthrough(); void depthOfNullObjects(); @@ -1172,6 +1173,19 @@ void tst_QPixmap::deepCopyPreservesDpr() QCOMPARE(dest.devicePixelRatio(), dpr); } +// Check that the DPR is preserved after doing a fill after an +// assigned copy of the QPixmap +void tst_QPixmap::fillPreservesDpr() +{ + const qreal dpr = 2; + QPixmap src(32, 32); + src.setDevicePixelRatio(dpr); + src.fill(Qt::red); + QPixmap dest = src; + dest.fill(Qt::blue); + QCOMPARE(dest.devicePixelRatio(), dpr); +} + void tst_QPixmap::dprPassthrough() { const qreal dpr = 2; |