summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-01-04 07:39:22 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-01-04 07:44:26 (GMT)
commitcb470a33bf85cf15b9df57e3ade27c6a0720d138 (patch)
treebd4174e685dceb8da656ec11220ecd1420c0bc2b /tests
parent8365b863419ad68f7dde7b7595e1b943ad9670ca (diff)
downloadQt-cb470a33bf85cf15b9df57e3ade27c6a0720d138.zip
Qt-cb470a33bf85cf15b9df57e3ade27c6a0720d138.tar.gz
Qt-cb470a33bf85cf15b9df57e3ade27c6a0720d138.tar.bz2
Fixed first element being a LineToElement in QPainterPath::connectPath()
This would produce an invalid path, causing potential crashes in various parts of Qt. Task-number: QTBUG-16377 Reviewed-by: Gunnar Sletta
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qpainterpath/tst_qpainterpath.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp
index d0cddda..66e6d10 100644
--- a/tests/auto/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp
@@ -107,6 +107,7 @@ private slots:
void operators();
void connectPathDuplicatePoint();
+ void connectPathMoveTo();
void translate();
};
@@ -1169,6 +1170,31 @@ void tst_QPainterPath::connectPathDuplicatePoint()
QCOMPARE(c, a);
}
+void tst_QPainterPath::connectPathMoveTo()
+{
+ QPainterPath path1;
+ QPainterPath path2;
+ QPainterPath path3;
+ QPainterPath path4;
+
+ path1.moveTo(1,1);
+
+ path2.moveTo(4,4);
+ path2.lineTo(5,6);
+ path2.lineTo(6,7);
+
+ path3.connectPath(path2);
+
+ path4.lineTo(5,5);
+
+ path1.connectPath(path2);
+
+ QVERIFY(path1.elementAt(0).type == QPainterPath::MoveToElement);
+ QVERIFY(path2.elementAt(0).type == QPainterPath::MoveToElement);
+ QVERIFY(path3.elementAt(0).type == QPainterPath::MoveToElement);
+ QVERIFY(path4.elementAt(0).type == QPainterPath::MoveToElement);
+}
+
void tst_QPainterPath::translate()
{
QPainterPath path;