summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp10
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp5
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp38
3 files changed, 51 insertions, 2 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index b9b61425da..531ec68fdc 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -168,6 +168,8 @@ private slots:
void scaled_QTBUG19157();
void detachOnLoad_QTBUG29639();
+
+ void copyOnNonAlignedBoundary();
};
static bool lenientCompare(const QPixmap &actual, const QPixmap &expected)
@@ -1526,5 +1528,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/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index 4470961f7b..89807f3747 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -208,11 +208,12 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt
// Windows: Due to implementation changes, the event loop needs
// to be spun since we ourselves also need to answer the
// WM_DRAWCLIPBOARD message as we are in the chain of clipboard
- // viewers.
+ // viewers. Check for running before waitForFinished() in case
+ // the process terminated while processEvents() was executed.
bool running = true;
for (int i = 0; i < 60 && running; ++i) {
QGuiApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
- if (process.waitForFinished(500))
+ if (process.state() != QProcess::Running || process.waitForFinished(500))
running = false;
}
if (running) {
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 2e5f43807a..6c37f1fc27 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -277,6 +277,7 @@ private slots:
void drawTextWithComplexBrush();
void QTBUG26013_squareCapStroke();
void QTBUG25153_drawLine();
+ void dashing_systemClip();
private:
void fillData();
@@ -4458,6 +4459,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"