From ee36f0456c6308d10085d79b0d211b70f97388b7 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 27 Mar 2024 11:38:44 +0100 Subject: tdf#160386: Add support for switch element For now, only use language tag, meaning if there is a file like in the unittest with Howdy! Wotcha! G'day! Hello! "Hello!" with be displayed in a en_AU system locale This patch partially reverts 13a41e7a12598c7896d6dc8d34aba6af5b80b83c "tdf#150124: do nothing when parent is of unkown type" making 0dfd8288a87b58e503bb3a41be6137485fbf3f68 "ofz#60384 Direct-leak" no longer necessary Change-Id: Ifc73bc69aa997088dc0a2b11d7d30446303fa3b3 Change-Id: I885ef0f2c44b86196881fe55a963db2e5c7eb1be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165394 Tested-by: Jenkins Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165438 --- svgio/qa/cppunit/SvgImportTest.cxx | 23 +++++++++++++++++++++++ svgio/qa/cppunit/data/tdf160386.svg | 16 ++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 svgio/qa/cppunit/data/tdf160386.svg (limited to 'svgio/qa') diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 75d42adf4397..2ec9df26418f 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -39,6 +39,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) @@ -60,6 +61,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; @@ -401,6 +413,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"); diff --git a/svgio/qa/cppunit/data/tdf160386.svg b/svgio/qa/cppunit/data/tdf160386.svg new file mode 100644 index 000000000000..1644b0d15514 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf160386.svg @@ -0,0 +1,16 @@ + + + مرحبا + Hallo! + Howdy! + Wotcha! + G'day! + Hello! + Hola! + Bonjour! + こんにちは + Привет! + + + + -- cgit