summaryrefslogtreecommitdiff
path: root/svgio/qa
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-04-10 12:15:55 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-04-19 05:31:51 +0200
commit2642643ec07cd7f3d28fe558769297578c36de19 (patch)
treef86a597e9d05e9d3e91f0f9bd4a905d6fbcb5a5f /svgio/qa
parent58e79c4394783033f61e1309214d9060e2f0adf2 (diff)
tdf#160622: Let SalLayout::GetBoundRect return basegfx::B2DRectangle
This avoids premature rounding in TextLayouterDevice::getTextBoundRect. The box in D2DWriteTextOutRenderer::performRender needs to be expanded to allow room for the line width (which now will be guaranteed on all sides; previously, the rounding could happen to give no room on some side, even prior to commit 8962141a12c966b2d891829925e6203bf8d51852). Fixes some lines partially cut off in smaller text (or zoomed out). Change-Id: I07335136021f894cf045363b4d736bfab06c64d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166236 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svgio/qa')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index fe7c51d11324..3d6ef34d5857 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -40,6 +40,8 @@ protected:
Primitive2DSequence parseSvg(std::u16string_view aSource);
xmlDocUniquePtr dumpAndParseSvg(std::u16string_view aSource);
+ void assertXPathDouble(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath,
+ const OString& rAttribute, double nExpectedValue, double delta);
};
Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
@@ -90,6 +92,13 @@ void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive)
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "width"_ostr, "3"); // rect stroke width
}
+void Test::assertXPathDouble(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath,
+ const OString& rAttribute, double nExpectedValue, double delta)
+{
+ auto sVal = getXPath(pXmlDoc, rXPath, rAttribute);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(nExpectedValue, sVal.toDouble(), delta);
+}
+
namespace
{
bool arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB)
@@ -725,7 +734,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834)
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "Hanging");
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "30");
- assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "94");
+ assertXPathDouble(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, 93.5, 0.5);
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "Central");
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "x"_ostr, "30");