diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-08-30 14:45:42 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-09-02 12:08:40 +0200 |
commit | 6bb51e0f08bb810245e5dd4b00ee3c36d0811a48 (patch) | |
tree | 93aee6af1a16dc2ac2b1cc9fc1452a88614faed9 /tests | |
parent | f6b34ce173830e470ae01597c7c1d66eaee58617 (diff) |
QPainter lancelot test: improve drawImage testing
In QPainter, there is a shortcut code path for the drawImage(point,
image) call, relative to the full drawImage(targetRect, img,
srcRect). The lance script interpreter would only use the latter, so
the former was not covered by the tests.
As a driveby, remove the pointless usage of non-default dithering
flags in drawImage(), since it is more important to test the default.
Change-Id: Id373fd528a0c4c40b6bd8eea37b960fd7cdb2cc7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 8aa3a035e3..60f95ed2ae 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -1010,7 +1010,10 @@ void PaintCommands::command_drawPixmap(QRegularExpressionMatch re) qPrintable(re.captured(1)), pm.width(), pm.height(), pm.depth(), tx, ty, tw, th, sx, sy, sw, sh); - m_painter->drawPixmap(QRectF(tx, ty, tw, th), pm, QRectF(sx, sy, sw, sh)); + if (!re.capturedLength(4)) // at most two coordinates specified + m_painter->drawPixmap(QPointF(tx, ty), pm); + else + m_painter->drawPixmap(QRectF(tx, ty, tw, th), pm, QRectF(sx, sy, sw, sh)); } /***************************************************************************************************/ @@ -1057,7 +1060,10 @@ void PaintCommands::command_drawImage(QRegularExpressionMatch re) printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n", qPrintable(re.captured(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); - m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh), Qt::OrderedDither | Qt::OrderedAlphaDither); + if (!re.capturedLength(4)) // at most two coordinates specified + m_painter->drawImage(QPointF(tx, ty), im); + else + m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh)); } /***************************************************************************************************/ |