diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-07 09:41:10 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-07 09:44:04 (GMT) |
commit | 90e009e9e273a4fea5166007e4c2b0638c6588cd (patch) | |
tree | 69934c951bac5db28d8c09f4177e340d1ad272ad | |
parent | 6c5a6ed08d0aa470daf46c9b5d9a2ce02bbb222f (diff) | |
download | Qt-90e009e9e273a4fea5166007e4c2b0638c6588cd.zip Qt-90e009e9e273a4fea5166007e4c2b0638c6588cd.tar.gz Qt-90e009e9e273a4fea5166007e4c2b0638c6588cd.tar.bz2 |
Fix QTransform::map(const QPainterPath &) not working with paths that
have only one element
Replaced the isEmpty() check for the shortcut in map() with elementCount() == 0
Task-number: QTBUG-11264
Reviewed-by: Samuel
-rw-r--r-- | src/gui/painting/qtransform.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qtransform/tst_qtransform.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 423cce9..47b7758 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1626,7 +1626,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat QPainterPath QTransform::map(const QPainterPath &path) const { TransformationType t = inline_type(); - if (t == TxNone || path.isEmpty()) + if (t == TxNone || path.elementCount() == 0) return path; if (t >= TxProject) diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index a3ded8e..c784b3a 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -85,6 +85,7 @@ private slots: void inverted(); void projectivePathMapping(); void mapInt(); + void mapPathWithPoint(); private: void mapping_data(); @@ -793,6 +794,13 @@ void tst_QTransform::mapInt() QCOMPARE(y, 10); } +void tst_QTransform::mapPathWithPoint() +{ + QPainterPath p(QPointF(10, 10)); + p = QTransform::fromTranslate(10, 10).map(p); + QCOMPARE(p.currentPosition(), QPointF(20, 20)); +} + QTEST_APPLESS_MAIN(tst_QTransform) |