diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 05:03:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 05:03:24 +0000 |
commit | e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 (patch) | |
tree | 3c1753125149dcf36ba42a57f1574369e8524225 /svgio/qa | |
parent | Adding debian version 4:24.2.2-3. (diff) | |
download | libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.tar.xz libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.zip |
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svgio/qa')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 37 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf160373.svg | 14 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf160386.svg | 16 |
3 files changed, 67 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 326e8f38ff..6969dc406a 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -38,6 +38,7 @@ protected: void checkRectPrimitive(Primitive2DSequence const & rPrimitive); Primitive2DSequence parseSvg(std::u16string_view aSource); + xmlDocUniquePtr dumpAndParseSvg(std::u16string_view aSource); }; Primitive2DSequence Test::parseSvg(std::u16string_view aSource) @@ -59,6 +60,17 @@ Primitive2DSequence Test::parseSvg(std::u16string_view aSource) return xSvgParser->getDecomposition(aInputStream, aPath); } +xmlDocUniquePtr Test::dumpAndParseSvg(std::u16string_view aSource) +{ + Primitive2DSequence aSequence = parseSvg(aSource); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + return pDocument; +} + void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) { drawinglayer::Primitive2dXmlDump dumper; @@ -385,6 +397,17 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "DejaVu Serif"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160386) +{ + xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160386.svg"); + + // Without the fix in place, this test would have failed with + // - Expected: 1 + // - Actual : 11 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 1); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, "text"_ostr, "Hello!"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf145896) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.svg"); @@ -441,6 +464,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156168) assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr, "color"_ostr, "#00ff00"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160373) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf160373.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, nothing would be displayed + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#0000ff"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf129356) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf129356.svg"); diff --git a/svgio/qa/cppunit/data/tdf160373.svg b/svgio/qa/cppunit/data/tdf160373.svg new file mode 100644 index 0000000000..73b18bb2ea --- /dev/null +++ b/svgio/qa/cppunit/data/tdf160373.svg @@ -0,0 +1,14 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='503.75pt' height='503.25pt' viewBox='0 0 503.75 503.25'> +<defs> + <style type='text/css'><![CDATA[ + rect { fill: none; } + ]]></style> +</defs> + <clipPath id='cpMC4wMHw1MDMuNzV8MC4wMHw1MDMuMjU='> + <rect x='0.00' y='0.00' width='503.75' height='503.25' /> + </clipPath> +<g clip-path='url(#cpMC4wMHw1MDMuNzV8MC4wMHw1MDMuMjU=)'> +<rect class="r5" x="10" y="0" height="50" width="50" style="fill:blue"></rect> +</g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf160386.svg b/svgio/qa/cppunit/data/tdf160386.svg new file mode 100644 index 0000000000..1644b0d155 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf160386.svg @@ -0,0 +1,16 @@ +<svg viewBox="0 -20 100 50" xmlns="http://www.w3.org/2000/svg"> + <switch font-family="DejaVu Sans"> + <text systemLanguage="ar">مرحبا</text> + <text systemLanguage="de,nl">Hallo!</text> + <text systemLanguage="en-us">Howdy!</text> + <text systemLanguage="en-gb">Wotcha!</text> + <text systemLanguage="en-au">G'day!</text> + <text systemLanguage="en">Hello!</text> + <text systemLanguage="es">Hola!</text> + <text systemLanguage="fr">Bonjour!</text> + <text systemLanguage="ja">こんにちは</text> + <text systemLanguage="ru">Привет!</text> + <text>☺</text> + </switch> +</svg> + |