summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 8dfaa6f5cd..ba405e2860 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -153,6 +153,7 @@ private slots:
void setEqualClipRegionAndPath();
void clipRectSaveRestore();
+ void clipStateSaveRestore();
void clippedFillPath_data();
void clippedFillPath();
@@ -3425,6 +3426,35 @@ void tst_QPainter::clipRectSaveRestore()
QCOMPARE(img.pixel(0, 0), QColor(Qt::black).rgba());
}
+void tst_QPainter::clipStateSaveRestore()
+{
+ QImage img(16, 16, QImage::Format_RGB32);
+ img.fill(Qt::blue);
+ {
+ QPainter p(&img);
+ p.setClipRect(QRect(5, 5, 10, 10));
+ p.save();
+ p.setClipping(false);
+ p.restore();
+ p.fillRect(0, 0, 16, 16, Qt::red);
+ p.end();
+ QCOMPARE(img.pixel(0, 0), QColor(Qt::blue).rgb());
+ }
+
+ img.fill(Qt::blue);
+ {
+ QPainter p(&img);
+ p.setClipRect(QRect(5, 5, 10, 10));
+ p.setClipping(false);
+ p.save();
+ p.setClipping(true);
+ p.restore();
+ p.fillRect(0, 0, 16, 16, Qt::red);
+ p.end();
+ QCOMPARE(img.pixel(0, 0), QColor(Qt::red).rgb());
+ }
+}
+
void tst_QPainter::clippedImage()
{
QImage img(16, 16, QImage::Format_ARGB32_Premultiplied);