summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-01 01:01:01 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-01 01:01:02 +0100
commit4b0af2cdbf61572b22ea6b8aa17fc9f52c71ac4b (patch)
tree60fb25a6772f5ac2d26af005b9888ff09c08a6c1 /tests/auto/widgets
parentcff492fed1d98f45c4c1f4011f1451120c0d1c23 (diff)
parent36e277e91732d6d75fb6d9cb691fe9c0f83f6178 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index f7e7022059..2822279190 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
@@ -159,6 +159,14 @@ void tst_QGraphicsPixmapItem::contains()
QFETCH(QPointF, point);
QFETCH(bool, contains);
+ // At the time of writing, by default pixmaps will have:
+ // - The same pixel format of the primary screen (which is platform dependent and may contain alpha)
+ // - Uninitialized pixels, potentially including an alpha channel
+ // - A ShapeMode of Mask (which mean it will use the alpha channel as a mask for contains())
+ // This means that in order to prevent undefined behavior in this test, we either need to set
+ // the shapeMode to something else, or set the pixels of the pixmap.
+ pixmap.fill(); // Filling the pixmap to be on the safe side.
+
SubQGraphicsPixmapItem item(pixmap);
QCOMPARE(item.contains(point), contains);
}