summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-08 16:11:33 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-08 16:11:33 +0100
commit72e5124b8517662ca2cd25deb5806bc04d20c022 (patch)
tree5950af37125647a6f14369eab667c7d611d1ac69 /tests/auto/gui
parenta19c22ebf8775f73b840f52b7e03869166ca0dab (diff)
parenta12f6ba302e54c1570c54aa4c722f2dafbf794af (diff)
Merge remote-tracking branch 'origin/release' into stable
Conflicts: tests/auto/opengl/qgl/tst_qgl.cpp Change-Id: I3c601351c984c1f4b00478d3c47ac9eeb021e892
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp10
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp38
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index f5298a1690..61f53a5073 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -167,6 +167,8 @@ private slots:
void scaled_QTBUG19157();
void detachOnLoad_QTBUG29639();
+
+ void copyOnNonAlignedBoundary();
};
static bool lenientCompare(const QPixmap &actual, const QPixmap &expected)
@@ -1503,5 +1505,13 @@ void tst_QPixmap::detachOnLoad_QTBUG29639()
QVERIFY(a.toImage() != b.toImage());
}
+void tst_QPixmap::copyOnNonAlignedBoundary()
+{
+ QImage img(8, 2, QImage::Format_RGB16);
+
+ QPixmap pm1 = QPixmap::fromImage(img, Qt::NoFormatConversion);
+ QPixmap pm2 = pm1.copy(QRect(5, 0, 3, 2)); // When copying second line: 2 bytes too many are read which might cause an access violation.
+}
+
QTEST_MAIN(tst_QPixmap)
#include "tst_qpixmap.moc"
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index cf520c06a9..774ade5fb0 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -280,6 +280,7 @@ private slots:
void drawTextWithComplexBrush();
void QTBUG26013_squareCapStroke();
void QTBUG25153_drawLine();
+ void dashing_systemClip();
private:
void fillData();
@@ -4461,6 +4462,43 @@ void tst_QPainter::QTBUG25153_drawLine()
}
}
+static void dashing_systemClip_paint(QPainter *p)
+{
+ p->setPen(QPen(Qt::black, 1, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin));
+ p->drawLine(8, 8, 42, 8);
+ p->drawLine(42, 8, 42, 42);
+ p->drawLine(42, 42, 8, 42);
+ p->drawLine(8, 42, 8, 8);
+}
+
+void tst_QPainter::dashing_systemClip()
+{
+ QImage image(50, 50, QImage::Format_RGB32);
+ image.fill(Qt::white);
+
+ QPainter p(&image);
+ dashing_systemClip_paint(&p);
+ p.end();
+
+ QImage old = image.copy();
+
+ image.paintEngine()->setSystemClip(QRect(10, 0, image.width() - 10, image.height()));
+
+ p.begin(&image);
+ dashing_systemClip_paint(&p);
+
+ // doing same paint operation again with different system clip should not change the image
+ QCOMPARE(old, image);
+
+ old = image;
+
+ p.setClipRect(QRect(20, 20, 30, 30));
+ dashing_systemClip_paint(&p);
+
+ // ditto for regular clips
+ QCOMPARE(old, image);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"