summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-10-19 06:25:29 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-10-19 06:25:29 (GMT)
commita761b0e60bab05fe50d07de2a78840337dce6370 (patch)
treea438f04d4407da61c4cd7363031cfc5606c6d5fc /tests
parentaf1fa7fe766980210d7363c1559197f34b10d834 (diff)
parent62b884a0ff3d9285b2ea4e1513dfe9e49f7edc5b (diff)
downloadQt-a761b0e60bab05fe50d07de2a78840337dce6370.zip
Qt-a761b0e60bab05fe50d07de2a78840337dce6370.tar.gz
Qt-a761b0e60bab05fe50d07de2a78840337dce6370.tar.bz2
Merge branch '4.6' of ..\qt-graphics-4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index e4f267d..8ed83cb 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -238,6 +238,8 @@ private slots:
void taskQT4444_dontOverflowDashOffset();
+ void painterBegin();
+
private:
void fillData();
QColor baseColor( int k, int intensity=255 );
@@ -4312,5 +4314,43 @@ void tst_QPainter::taskQT4444_dontOverflowDashOffset()
QVERIFY(true); // Don't crash
}
+void tst_QPainter::painterBegin()
+{
+ QImage nullImage;
+ QImage indexed8Image(16, 16, QImage::Format_Indexed8);
+ QImage rgb32Image(16, 16, QImage::Format_RGB32);
+ QImage argb32Image(16, 16, QImage::Format_ARGB32_Premultiplied);
+
+ QPainter p;
+
+ // Painting on null image should fail.
+ QVERIFY(!p.begin(&nullImage));
+
+ // Check that the painter is not messed up by using it on another image.
+ QVERIFY(p.begin(&rgb32Image));
+ QVERIFY(p.end());
+
+ // If painting on indexed8 image fails, the painter state should still be OK.
+ if (p.begin(&indexed8Image))
+ QVERIFY(p.end());
+ QVERIFY(p.begin(&rgb32Image));
+ QVERIFY(p.end());
+
+ // Try opening a painter on the two different images.
+ QVERIFY(p.begin(&rgb32Image));
+ QVERIFY(!p.begin(&argb32Image));
+ QVERIFY(p.end());
+
+ // Try opening two painters on the same image.
+ QVERIFY(p.begin(&rgb32Image));
+ QPainter q;
+ QVERIFY(!q.begin(&rgb32Image));
+ QVERIFY(!q.end());
+ QVERIFY(p.end());
+
+ // Try ending an inactive painter.
+ QVERIFY(!p.end());
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"