summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2021-11-19 07:32:05 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-19 14:28:12 +0000
commite7b2bd0dfa4f94189aea05aa5e575468776dbdba (patch)
tree6ba30fb8d21a28b99fb0021c145956391119bdc8 /tests
parent7951f47ea53f4edf989719d09732ec388fdf6958 (diff)
Fix boundsOnElement() for text nodes having transformations
Text layout calculations are done with a local scaling, and that was mixed up with the node transformation when computing the bounds. Fixes: QTBUG-98139 Change-Id: Id3ab0500cfba4578989b5766677a53340e8cecde Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit d180cb47b147ca07874b7defe1ed2771d5cb73fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index e368444..fca52ea 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -599,6 +599,8 @@ void tst_QSvgRenderer::boundsOnElement() const
"<use x=\"0\" y=\"0\" transform=\"rotate(45)\" xlink:href=\"#baconost\"/>"
"</g>"
"</g>"
+ "<text id=\"textA\" x=\"50\" y=\"100\">Lorem ipsum</text>"
+ "<text id=\"textB\" transform=\"matrix(1 0 0 1 50 100)\">Lorem ipsum</text>"
"</svg>");
qreal sqrt2 = qSqrt(2);
@@ -610,6 +612,10 @@ void tst_QSvgRenderer::boundsOnElement() const
QCOMPARE(renderer.boundsOnElement(QLatin1String("baconost")), QRectF(-10 * sqrt2, -10 * sqrt2, 20 * sqrt2, 20 * sqrt2));
QCOMPARE(renderer.boundsOnElement(QLatin1String("hapaa")), QRectF(-13, -9, 22, 22));
QCOMPARE(renderer.boundsOnElement(QLatin1String("prim")), QRectF(-10 * sqrt2 - 3, -10 * sqrt2 + 1, 20 * sqrt2, 20 * sqrt2));
+
+ QRectF textBoundsA = renderer.boundsOnElement(QLatin1String("textA"));
+ QVERIFY(!textBoundsA.isEmpty());
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("textB")), textBoundsA);
}
void tst_QSvgRenderer::gradientStops() const