diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-14 17:34:00 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-15 03:53:18 +0200 |
commit | a2b6be8af9be3237efc3ed1244302cf899680e97 (patch) | |
tree | 017b45b5a69c97a8301dbea0431edb2ae4da1424 /svgio/qa/cppunit | |
parent | 5cfd31e505b4d1b4f9d2e21b0f9f8aac22539f47 (diff) |
tdf#86938: fix calculation of baseline-shift
Change-Id: I8c30c29052f2ea1fe6e49360b972af868851131b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155671
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 25 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf86938.svg | 13 |
2 files changed, 38 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 53f6b23da4fd..d68e7ebf728a 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -746,6 +746,31 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "familyname", "Times New Roman"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf86938) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf86938.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "290"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "183"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "above"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", "290"); + + // Without the fix in place, this test would have failed with + // - Expected: 159 + // - Actual : 207 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "159"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", "below"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", "290"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", "207"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf93583) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf93583.svg"); diff --git a/svgio/qa/cppunit/data/tdf86938.svg b/svgio/qa/cppunit/data/tdf86938.svg new file mode 100644 index 000000000000..40287a39de88 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf86938.svg @@ -0,0 +1,13 @@ +<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"> + <text + x="290" + y="183"> line </text> + <text + x="290" + y="183" + baseline-shift="24"> above </text> + <text + x="290" + y="183" + baseline-shift="-24"> below </text> +</svg> |