[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx |2 +- svgio/source/svgreader/svgcharacternode.cxx | 11 --- 2 files changed, 1 insertion(+), 12 deletions(-) New commits: commit 820363418f5c6833757e43daaa877d845c75f1d7 Author: Xisco Fauli AuthorDate: Wed Sep 6 11:35:26 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Sep 6 16:56:43 2023 +0200 tdf#157113: Add gap even if baseline is different This was a workaround for https://bz.apache.org/ooo/show_bug.cgi?id=122524 but it's no longer needed since 5079e7937ef471a44dcf119dc6ae0a334d9c6adc "tdf#156251: Add gap between text elements when needed" Change-Id: I83af59a515d56af6b0e3cf3e351d3df52510a17d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156613 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit ae6f9f07df8565368d43c5014b8e1ac32acb51cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156597 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 624918559940..e59a92cffb97 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1840,7 +1840,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156837) // - Actual : 103 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "94"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "10"); -assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "3"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", " 3"); } CPPUNIT_TEST_FIXTURE(Test, testTdf156271) diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index cb39d6dc542f..022ba42bda9f 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -514,17 +514,6 @@ namespace svgio::svgreader if(pPreviousCharacterNode->mpParentLine != mpParentLine) bAddGap = false; -// With this option a baseline shift between two char parts ('words') -// will not add a space 'gap' to the end of the (non-last) word. This -// seems to be the standard behaviour, see last bugdoc attached #122524# -const SvgStyleAttributes* pStyleLast = pPreviousCharacterNode->getSvgStyleAttributes(); -const SvgStyleAttributes* pStyleCurrent = getSvgStyleAttributes(); - -if(pStyleLast && pStyleCurrent && pStyleLast->getBaselineShift() != pStyleCurrent->getBaselineShift()) -{ -bAddGap = false; -} - // add in-between whitespace (single space) to last // known character node if(bAddGap)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 35 +++ svgio/qa/cppunit/data/tdf156569.svg |4 svgio/source/svgreader/svgtools.cxx | 17 +++-- 3 files changed, 46 insertions(+), 10 deletions(-) New commits: commit 434885a3a9630050a6c88c1294841f0da3ea6a7b Author: Xisco Fauli AuthorDate: Tue Sep 5 13:09:40 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Sep 6 12:24:29 2023 +0200 tdf#156569: '%' can be in the middle of the string For an unknown reason Jenkins fails on windows with Test name: testTdf156569::TestBody equality assertion failed - Expected: 1 - Actual : 0 - In <>, XPath '/primitive2D/transform/textsimpleportion[1]' number of nodes is incorrect but it doesn't fail on master branch Change-Id: I5d6ab57c17ab2cbce4d3df629a91a006fad2198d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156564 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 78534e6fa741e3cb9cb756bea527400c34adbdf3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156548 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 06a5cfb63328..624918559940 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1783,6 +1783,41 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156283) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", "63"); } +#if !defined(_WIN32) +CPPUNIT_TEST_FIXTURE(Test, testTdf156569) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156569.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "0"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "20"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0", "40"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx1", "80"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx2", "91"); + +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", "0"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "30"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0", "40"); + +// Without the fix in place, this test would have failed with +// - Expected: 80 +// - Actual : 51 +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx1", "80"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", "91"); +} +#endif + CPPUNIT_TEST_FIXTURE(Test, testTdf156837) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156837.svg"); diff --git a/svgio/qa/cppunit/data/tdf156569.svg b/svgio/qa/cppunit/data/tdf156569.svg new file mode 100644 index ..ea9b3f513a0b --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156569.svg @@ -0,0 +1,4 @@ +http://www.w3.org/2000/svg;> +ABC +ABC + diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 9fb930a53467..92befcbd70d9 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -293,7 +293,13 @@ namespace svgio::svgreader { const sal_Unicode aCharA(rCandidate[nPos]); -if(nPos + 1 < nLen) +if('%' == aCharA) +{ +// percent used, relative to current +nPos++; +aRetval = SvgUnit::percent; +} +else if(nPos + 1 < nLen) { const sal_Unicode aCharB(rCandidate[nPos + 1]); bool bTwoCharValid(false); @@ -374,15 +380,6 @@ namespace svgio::svgreader nPos += 2; } } -else -{ -if('%' == aCharA) -{ -// percent used, relative to current -nPos++; -aRetval =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 25 + svgio/qa/cppunit/data/tdf86938.svg | 13 + svgio/source/svgreader/svgcharacternode.cxx |2 +- 3 files changed, 39 insertions(+), 1 deletion(-) New commits: commit 86d39aec6ab4205955921406d2512d6eab8d3fe8 Author: Xisco Fauli AuthorDate: Mon Aug 14 17:34:00 2023 +0200 Commit: Xisco Fauli CommitDate: Sat Aug 19 11:47:22 2023 +0200 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155725 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 73b3150b3a8d..298608773352 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -763,6 +763,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(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 ..40287a39de88 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf86938.svg @@ -0,0 +1,13 @@ +http://www.w3.org/2000/svg;> + line + above + below + diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index ebc317c3a445..91ec98ae9b68 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -301,7 +301,7 @@ namespace svgio::svgreader const SvgNumber aNumber(rSvgStyleAttributes.getBaselineShiftNumber()); const double mfBaselineShift(aNumber.solve(*this)); -aPosition.setY(aPosition.getY() + mfBaselineShift); +aPosition.setY(aPosition.getY() - mfBaselineShift); break; } default: // BaselineShift::Baseline
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx| 21 + svgio/qa/cppunit/data/tdf117920.svg |7 +++ svgio/source/svgreader/svgdocumenthandler.cxx |7 +-- 3 files changed, 29 insertions(+), 6 deletions(-) New commits: commit 06075cd2ffc490feb7560f92ffc894b1e6751f90 Author: Xisco Fauli AuthorDate: Thu Aug 17 09:24:18 2023 +0200 Commit: Xisco Fauli CommitDate: Fri Aug 18 21:38:46 2023 +0200 tdf#117920: Revert "related tdf#156579: just break for switch element" This reverts commit e222f60ac2a71032dbdf62d7c7e28978b5a0b19c. To make the switch element behave like a group as least, so the transform attribute is parsed Change-Id: Id8c21ac6da217d8f7bc350ff41022335bf1e0f1f Change-Id: If1e53f9baad8995f26f9b885cfef6265040736bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155770 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index bbaf2ec5d96d..73b3150b3a8d 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -962,6 +962,27 @@ CPPUNIT_TEST_FIXTURE(Test, testNoneColor) assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "width", "3"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf117920) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf117920.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/transform", "xy11", "1"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy12", "0"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy13", "-18"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy21", "0"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy22", "1"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy23", "-6"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy31", "0"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy32", "0"); +assertXPath(pDocument, "/primitive2D/transform/transform", "xy33", "1"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf97936) { // check that both rectangles are rendered in the viewBox diff --git a/svgio/qa/cppunit/data/tdf117920.svg b/svgio/qa/cppunit/data/tdf117920.svg new file mode 100644 index ..487e0f6cb925 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf117920.svg @@ -0,0 +1,7 @@ +http://www.w3.org/2000/svg; + xmlns:xlink="http://www.w3.org/1999/xlink;> + + + + diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx index f86d2603de2a..bd7a9c5791c9 100644 --- a/svgio/source/svgreader/svgdocumenthandler.cxx +++ b/svgio/source/svgreader/svgdocumenthandler.cxx @@ -199,6 +199,7 @@ namespace mpTarget->parseAttributes(xAttribs); break; } +case SVGToken::Switch: //TODO: Support switch element case SVGToken::Defs: case SVGToken::G: { @@ -442,12 +443,6 @@ namespace break; } -case SVGToken::Switch: -{ -//TODO: Support switch element -break; -} - default: { mpTarget = new SvgNode(SVGToken::Unknown, maDocument, mpTarget);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 21 + svgio/qa/cppunit/data/tdf156777.svg| 14 ++ svgio/source/svgreader/svgtextpathnode.cxx |2 +- 3 files changed, 36 insertions(+), 1 deletion(-) New commits: commit 72b99211cfb3755546b5bfeb13f7693dc95b79c1 Author: Xisco Fauli AuthorDate: Tue Aug 15 19:43:42 2023 +0200 Commit: Michael Stahl CommitDate: Thu Aug 17 11:14:41 2023 +0200 tdf#156777: check for css style in textpath Change-Id: I63a274dd9fba37852412a194a490cb2b7634f1cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155726 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli (cherry picked from commit 20f57e14362674d321ef184e1987f41a6418adc2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155702 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 4032c934658e..bbaf2ec5d96d 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -706,6 +706,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf97941) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156777) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156777.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 23); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "Quick brown fox jumps over the lazy dog."); + +// Without the fix in place, this test would have failed with +// - Expected: #008000 +// - Actual : #00 +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#008000"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "84"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "23"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf104339) { Primitive2DSequence aSequenceTdf104339 = parseSvg(u"/svgio/qa/cppunit/data/tdf104339.svg"); diff --git a/svgio/qa/cppunit/data/tdf156777.svg b/svgio/qa/cppunit/data/tdf156777.svg new file mode 100644 index ..9ce1dd8cd37c --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156777.svg @@ -0,0 +1,14 @@ +http://www.w3.org/2000/svg;> + + + + + Quick brown fox jumps over the lazy dog. + + + + diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx index 2c5a823566ed..4dad47f62bb6 100644 --- a/svgio/source/svgreader/svgtextpathnode.cxx +++ b/svgio/source/svgreader/svgtextpathnode.cxx @@ -252,7 +252,7 @@ namespace svgio::svgreader const SvgStyleAttributes* SvgTextPathNode::getSvgStyleAttributes() const { -return +return checkForCssStyle(maSvgStyleAttributes); } void SvgTextPathNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 31 svgio/qa/cppunit/data/tdf156577.svg |8 +++ svgio/source/svgreader/svgcharacternode.cxx | 22 +++ 3 files changed, 52 insertions(+), 9 deletions(-) New commits: commit d3a8c3d5a6db298d427999b84a474c982c26e6dd Author: Xisco Fauli AuthorDate: Wed Aug 2 11:49:56 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Aug 3 18:38:12 2023 +0200 tdf#156577: do no use parent position if x array is empty Change-Id: Id29e5a440dbc3719c53bcc9226336a3c99d469e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155216 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 79646e204f5d558f5519186cb62ef1c9254f857f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155248 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 17736515010a..ffd0f7b5c9bb 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1427,6 +1427,37 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156269) assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", "#00"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156577) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156577.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "30"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "20"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC"); +assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0"); + +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "16"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", "30"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "30"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC"); + +// Without the fix in place, this test would have failed with +// - Expected: 22 +// - Actual : 52 +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0", "22"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx1", "53"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", "94"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf156283) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156283.svg"); diff --git a/svgio/qa/cppunit/data/tdf156577.svg b/svgio/qa/cppunit/data/tdf156577.svg new file mode 100644 index ..de12f36667f8 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156577.svg @@ -0,0 +1,8 @@ +http://www.w3.org/2000/svg;> + +ABC + + +ABC + + diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 5fab853ed0a0..8a6610c91d25 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -263,23 +263,27 @@ namespace svgio::svgreader // prepare TextArray ::std::vector< double > aTextArray(rSvgTextPosition.getX()); -if(aTextArray.size() < nLength) +::std::vector< double > aDxArray(rSvgTextPosition.getDx()); + +// Do nothing when X and Dx arrays are empty +if((!aTextArray.empty() || !aDxArray.empty()) && aTextArray.size() < nLength) { const sal_uInt32 nArray(aTextArray.size()); double fStartX(0.0); - -if(rSvgTextPosition.getParent() && rSvgTextPosition.getParent()->getAbsoluteX()) -{ -fStartX = rSvgTextPosition.getParent()->getPosition().getX(); -} -else if (!aTextArray.empty()) +if (!aTextArray.empty()) { -fStartX = aTextArray[nArray - 1]; +if(rSvgTextPosition.getParent() && rSvgTextPosition.getParent()->getAbsoluteX()) +{ +fStartX = rSvgTextPosition.getParent()->getPosition().getX(); +} +else +{ +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 27 +++ svgio/qa/cppunit/data/tdf156269.svg |8 svgio/source/svgreader/svgcharacternode.cxx | 48 ++-- 3 files changed, 59 insertions(+), 24 deletions(-) New commits: commit 9694ed91483adbe0694764e6118d697cbf7f50b8 Author: Xisco Fauli AuthorDate: Thu Jul 13 11:14:25 2023 +0200 Commit: Xisco Fauli CommitDate: Fri Jul 14 12:15:58 2023 +0200 tdf#156269: dx and dy do not depend on x and y Change-Id: I99be5aa45b333ec3825373c3a10be0e24d23cb29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154380 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 09511f0ab66034a4a4db39ef318d25fddf92d25b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154413 Reviewed-by: Stéphane Guillou diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 46164357691b..5139d891eedc 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1400,6 +1400,33 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf97663) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "236"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156269) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156269.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "//textsimpleportion[@text='one']", "width", "16"); +assertXPath(pDocument, "//textsimpleportion[@text='one']", "height", "16"); +assertXPath(pDocument, "//textsimpleportion[@text='one']", "x", "10"); +assertXPath(pDocument, "//textsimpleportion[@text='one']", "y", "50"); +assertXPath(pDocument, "//textsimpleportion[@text='one']", "fontcolor", "#808080"); + +assertXPath(pDocument, "//textsimpleportion[@text='two']", "width", "16"); +assertXPath(pDocument, "//textsimpleportion[@text='two']", "height", "16"); + +// Without the fix in place, this test would have failed with +// - Expected: 60 +// - Actual : 10 +assertXPath(pDocument, "//textsimpleportion[@text='two']", "x", "60"); +assertXPath(pDocument, "//textsimpleportion[@text='two']", "y", "100"); +assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", "#00"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf149880) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg"); diff --git a/svgio/qa/cppunit/data/tdf156269.svg b/svgio/qa/cppunit/data/tdf156269.svg new file mode 100644 index ..e840b351d17d --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156269.svg @@ -0,0 +1,8 @@ +http://www.w3.org/2000/svg;> + + one + + + two + + diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 4ffc46a483db..e62d21528d96 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -645,23 +645,23 @@ namespace svgio::svgreader { maPosition.setX(pParent->getPosition().getX()); } +} + +const sal_uInt32 nSizeDx(rSvgTextPositions.getDx().size()); -const sal_uInt32 nSizeDx(rSvgTextPositions.getDx().size()); +if(nSizeDx) +{ +// relative positions given, translate position derived from parent +maPosition.setX(maPosition.getX() + rSvgTextPositions.getDx()[0].solve(rInfoProvider, NumberType::xcoordinate)); -if(nSizeDx) +if(nSizeDx > 1) { -// relative positions given, translate position derived from parent -maPosition.setX(maPosition.getX() + rSvgTextPositions.getDx()[0].solve(rInfoProvider, NumberType::xcoordinate)); +// fill deltas to maX +maX.reserve(nSizeDx); -if(nSizeDx > 1) +for(sal_uInt32 a(1); a < nSizeDx; a++) { -// fill deltas to maX -maX.reserve(nSizeDx); - -for(sal_uInt32 a(1); a < nSizeDx; a++) -{ - maX.push_back(rSvgTextPositions.getDx()[a].solve(rInfoProvider, NumberType::xcoordinate)); -} + maX.push_back(rSvgTextPositions.getDx()[a].solve(rInfoProvider, NumberType::xcoordinate)); } } } @@ -693,23 +693,23 @@ namespace svgio::svgreader { maPosition.setY(pParent->getPosition().getY()); } +} + +const sal_uInt32
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 20 ++-- svgio/qa/cppunit/data/tdf156236.svg|7 +++ svgio/source/svgreader/svgrectnode.cxx | 11 +++ 3 files changed, 28 insertions(+), 10 deletions(-) New commits: commit f6df2e640342b6114e46b7957de093386ad35459 Author: Xisco Fauli AuthorDate: Tue Jul 11 16:08:38 2023 +0200 Commit: Michael Stahl CommitDate: Wed Jul 12 10:50:19 2023 +0200 tdf#156236: For the rx or ry properties, "0" is valid Change-Id: I32c865e409a339c40e00ee0f624c45380773 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154307 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 9a5c1bbedad8813e7563bd5f3a3c1217d38a3c25) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154318 Reviewed-by: Michael Stahl diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 5b733e960b77..ee21d95c1970 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1044,11 +1044,11 @@ CPPUNIT_TEST_FIXTURE(Test, testClipRule) // - Actual : 10 assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point", 5); assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor", "color", "#ff"); -assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 5); +assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 4); assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon/point", 5); assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor", "color", "#ff"); -assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 5); +assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 4); } CPPUNIT_TEST_FIXTURE(Test, testi125329) @@ -1267,6 +1267,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94765) assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endy", "0"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156236) +{ +Primitive2DSequence aSequenceTdf94765 = parseSvg(u"/svgio/qa/cppunit/data/tdf156236.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceTdf94765.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf94765)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "path", "m50 180h-30v-60h60v60z"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "path", "m150 180h15c8.2842712474619 0 15-6.7157287525381 15-15v-30c0-8.2842712474619-6.7157287525381-15-15-15h-30c-8.2842712474619 0-15 6.7157287525381-15 15v30c0 8.2842712474619 6.7157287525381 15 15 15z"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]/polypolygon", "path", "m250 180h15c8.2842712474619 0 15-6.7157287525381 15-15v-30c0-8.2842712474619-6.7157287525381-15-15-15h-30c-8.2842712474619 0-15 6.7157287525381-15 15v30c0 8.2842712474619 6.7157287525381 15 15 15z"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]/polypolygon", "path", "m350 180c16.5685424949238 0 30-6.7157287525381 30-15v-30c0-8.2842712474619-13.4314575050762-15-30-15s-30 6.7157287525381-30 15v30c0 8.2842712474619 13.4314575050762 15 30 15z"); +} + CPPUNIT_TEST_FIXTURE(Test, testBehaviourWhenWidthAndHeightIsOrIsNotSet) { // This test checks the behaviour when width and height attributes diff --git a/svgio/qa/cppunit/data/tdf156236.svg b/svgio/qa/cppunit/data/tdf156236.svg new file mode 100644 index ..12268652c03b --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156236.svg @@ -0,0 +1,7 @@ +http://www.w3.org/2000/svg;> + + + + + + diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx index 291d8540912f..c063ecf87195 100644 --- a/svgio/source/svgreader/svgrectnode.cxx +++ b/svgio/source/svgreader/svgrectnode.cxx @@ -32,9 +32,7 @@ namespace svgio::svgreader maX(0), maY(0), maWidth(0), -maHeight(0), -maRx(0), -maRy(0) +maHeight(0) { } @@ -176,14 +174,11 @@ namespace svgio::svgreader double frX(getRx().isSet() ? getRx().solve(*this, NumberType::xcoordinate) : 0.0); double frY(getRy().isSet() ? getRy().solve(*this, NumberType::ycoordinate) : 0.0); -frX = std::max(0.0, frX); -frY = std::max(0.0, frY); - -if(0.0 == frY && frX > 0.0) +if(!getRy().isSet() && 0.0 == frY && frX > 0.0) { frY = frX; } -else
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 19 svgio/qa/cppunit/data/tdf156167.svg | 18 svgio/source/svgreader/svgtoken.cxx | 156 +++- 3 files changed, 175 insertions(+), 18 deletions(-) New commits: commit 0b0e2e1660cb43608f6c8d2d7264dda9857a6e82 Author: Xisco Fauli AuthorDate: Wed Jul 5 13:31:27 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Jul 6 17:17:54 2023 +0200 tdf#156167: create separate map for case insensitive strings Add static_assert to make sure both maps have the same size Regression from: svgio: use "frozen" for mapping between token strings and enums Change-Id: I2061606146cfcb34169dccf69b6f720727839d04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153174 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl Change-Id: Ic54dfe45eaff5ef75bcd4ebab715f278540da913 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154055 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154132 Tested-by: Jenkins diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 8e301469394b..56e896c56eac 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -501,6 +501,25 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156018) assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#ff"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156167) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156167.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", "#ffa500"); + +// Without the fix in place, this test would have failed with +// - Expected: #ffa500 +// - Actual : #ff +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#ffa500"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", "#ffa500"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf155932) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155932.svg"); diff --git a/svgio/qa/cppunit/data/tdf156167.svg b/svgio/qa/cppunit/data/tdf156167.svg new file mode 100644 index ..5ab1254013c4 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156167.svg @@ -0,0 +1,18 @@ +http://www.w3.org/2000/svg; + xmlns:xlink="http://www.w3.org/1999/xlink;> + + + + + + + + + +#c {fill: red } +#c {FiLl: oRaNgE } + + + + diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx index 1e2d3d7486da..0d77ca901ee8 100644 --- a/svgio/source/svgreader/svgtoken.cxx +++ b/svgio/source/svgreader/svgtoken.cxx @@ -180,25 +180,95 @@ constexpr frozen::unordered_map aSVGTokenMap { u"flowRoot", SVGToken::FlowRoot } }; -constexpr frozen::unordered_map aLowerCaseList +// The same elements as the map above but lowercase. CSS is case insensitive +// TODO: create separate maps for css and xml elements +constexpr frozen::unordered_map aSVGLowerCaseTokenMapperList { +{ u"width", SVGToken::Width }, +{ u"height", SVGToken::Height }, { u"viewbox", SVGToken::ViewBox }, +{ u"transform", SVGToken::Transform }, +{ u"style", SVGToken::Style }, +{ u"display", SVGToken::Display }, // #i121656# +{ u"d", SVGToken::D }, +{ u"x", SVGToken::X }, +{ u"y", SVGToken::Y }, +{ u"xmlns", SVGToken::Xmlns }, +{ u"version", SVGToken::Version }, +{ u"id", SVGToken::Id }, +{ u"in", SVGToken::In }, +{ u"rx", SVGToken::Rx }, +{ u"ry", SVGToken::Ry }, +{ u"points", SVGToken::Points }, +{ u"dx", SVGToken::Dx }, +{ u"dy", SVGToken::Dy }, +{ u"rotate", SVGToken::Rotate }, { u"textlength", SVGToken::TextLength }, { u"lengthadjust", SVGToken::LengthAdjust }, +{ u"font", SVGToken::Font }, +{ u"font-family", SVGToken::FontFamily }, +{ u"font-size", SVGToken::FontSize }, +{ u"font-size-adjust", SVGToken::FontSizeAdjust }, +{ u"font-stretch", SVGToken::FontStretch }, +{ u"font-style", SVGToken::FontStyle }, +{ u"font-variant", SVGToken::FontVariant }, +{ u"font-weight", SVGToken::FontWeight }, +{ u"direction", SVGToken::Direction }, +{ u"letter-spacing", SVGToken::LetterSpacing }, +{ u"text-decoration", SVGToken::TextDecoration }, +{ u"unicode-bidi", SVGToken::UnicodeBidi }, +{ u"word-spacing", SVGToken::WordSpacing }, +{ u"tspan", SVGToken::Tspan }, +{ u"tref", SVGToken::Tref }, { u"textpath", SVGToken::TextPath }, { u"startoffset", SVGToken::StartOffset }, +{ u"method", SVGToken::Method }, +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 38 svgio/qa/cppunit/data/tdf156168.svg | 34 svgio/source/svgreader/svgnode.cxx |4 +-- 3 files changed, 74 insertions(+), 2 deletions(-) New commits: commit 88e3e855006e18e146a0619311629c44788a2d71 Author: Xisco Fauli AuthorDate: Wed Jul 5 14:36:06 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Jul 5 17:09:09 2023 +0200 tdf#156168: do nothing when there is no concatenation Regression from: tdf#156034: check for css style further up in the hierarchy Change-Id: I92c6673f1249cc4a273c490cdc0496474ce1f0c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153498 Tested-by: Jenkins Reviewed-by: Xisco Fauli Change-Id: Ie699f40ea813d2ba5dc031008d56e2fce73a5715 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154034 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index c2dad58de2de..8e301469394b 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -403,6 +403,44 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145896) assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", "#ff"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156168) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156168.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", 8); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", "color", "#00"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", "color", "#00"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", "#ff"); + +// Without the fix in place, this test would have failed with +// - Expected: 4 +// - Actual : 3 +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke", 4); +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[1]/line", "width", "5"); + +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[1]/line", "color", "#00ff00"); +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[2]/line", "width", "5"); + +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[2]/line", "color", "#00ff00"); +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[3]/line", "width", "5"); + +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[3]/line", "color", "#00ff00"); +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line", "width", "5"); + +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line", "color", "#00ff00"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf156034) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156034.svg"); diff --git a/svgio/qa/cppunit/data/tdf156168.svg b/svgio/qa/cppunit/data/tdf156168.svg new file mode 100644 index ..2cdbd35afd09 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156168.svg @@ -0,0 +1,34 @@ + + +http://www.w3.org/2000/svg; + xmlns:xlink="http://www.w3.org/1999/xlink; + style="font-family: 'Times New Roman', serif; +font-size:large" > +stroke enabled + + +#MyRed { +fill: red; +} +#MyBlue { +fill: blue; +} +.MyLime { +stroke: lime; +stroke-width: 5; +} + + + + + + + + + + + + + diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index d87c76d81e20..bbf0f2342d22 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -120,7 +120,7 @@ namespace { addCssStyle(rDocument, aNewConcatenated); // look further up in the hierarchy -if(pParent && pParent->getId()) +if(!aConcatenated.isEmpty() && pParent && pParent->getId()) { const OUString& rParentId = pParent->getId().value(); addCssStyle(rDocument, "#" + rParentId + aConcatenated); @@ -140,7
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx| 14 ++ svgio/qa/cppunit/data/tdf150124.svg | 12 svgio/source/svgreader/svgdocumenthandler.cxx |9 +++-- svgio/source/svgreader/svgnode.cxx| 14 ++ 4 files changed, 31 insertions(+), 18 deletions(-) New commits: commit a11ad45498ff2ff2b1698715114e5ea8eabdd609 Author: Xisco Fauli AuthorDate: Mon Jul 3 14:11:43 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Jul 3 20:51:21 2023 +0200 tdf#150124: do nothing when parent is of unkown type Change-Id: I745b2a81200b0d8138b5f1b844849f20571d9546 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153906 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 0af2cd35a96e..c2dad58de2de 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -135,6 +135,20 @@ CPPUNIT_TEST_FIXTURE(Test, testSymbol) assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00d000"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf150124) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf150124.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +assertXPathChildren(pDocument, "/primitive2D", 1); +assertXPath(pDocument, "/primitive2D/hiddengeometry", 1); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf155819) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155819.svg"); diff --git a/svgio/qa/cppunit/data/tdf150124.svg b/svgio/qa/cppunit/data/tdf150124.svg new file mode 100644 index ..29b2a1e3fd46 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf150124.svg @@ -0,0 +1,12 @@ +http://www.w3.org/2000/svg; + xmlns:xlink="http://www.w3.org/1999/xlink;> + + + + + + + + + diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx index 7a313df98648..d95690e6f5d7 100644 --- a/svgio/source/svgreader/svgdocumenthandler.cxx +++ b/svgio/source/svgreader/svgdocumenthandler.cxx @@ -413,8 +413,7 @@ namespace default: { -/// invalid token, ignore -SAL_INFO( "svgio", "Unknown Base SvgToken <" + aName + "> (!)" ); +mpTarget = new SvgNode(SVGToken::Unknown, maDocument, mpTarget); break; } } @@ -498,6 +497,8 @@ namespace /// structural element pattern case SVGToken::Pattern: +default: + /// content handling after parsing { if(mpTarget) @@ -516,10 +517,6 @@ namespace } break; } -default: -{ -/// invalid token, ignore -} } if(pSvgTitleDescNode && mpTarget) diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index 37b34deff0f6..d87c76d81e20 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -395,21 +395,11 @@ namespace { mbDecomposing(false), mbCssStyleVectorBuilt(false) { -OSL_ENSURE(SVGToken::Unknown != maType, "SvgNode with unknown type created (!)"); - -if(pParent) +// tdf#150124 ignore when parent is unknown +if(pParent && pParent->getType() != SVGToken::Unknown) { pParent->maChildren.emplace_back(this); } -else -{ -#ifdef DBG_UTIL -if(SVGToken::Svg != getType()) -{ -OSL_ENSURE(false, "No parent for this node (!)"); -} -#endif -} } SvgNode::~SvgNode()
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx| 19 ++- svgio/qa/cppunit/data/tdf145896.svg | 12 svgio/source/svgreader/svgdocumenthandler.cxx | 17 +++-- svgio/source/svgreader/svgstylenode.cxx |6 +++--- 4 files changed, 36 insertions(+), 18 deletions(-) New commits: commit 7dbf237636f02b0f25aa9aedeaed227124ec12a4 Author: Xisco Fauli AuthorDate: Mon Jun 19 16:17:00 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Jun 19 20:39:05 2023 +0200 tdf#145896: set style to 'text/css' by default This is a regression from 4c31a0be1d8048bf3340acbb59248185e4b93041 "Resolves: #i125326# accept CssStyles with missing type attribute" Calling setTextCss(true) when there are no attributes is wrong, since it might have attributes like 'id'. The unittest added also covers i125326 is still fixed Change-Id: Ic5e4899211ae98c866f64f17e69a3a8cd24e4959 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153279 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index d7e7a07e644f..716bfba38763 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -312,9 +312,26 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", "serif"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf145896) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +// Without the fix in place, this test would have failed with +// - Expected: #00 +// - Actual : #00 +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", "#00"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000"); +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", "#ff"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf97717) { -//Check when font-size uses relative units (em,ex) and it's based on its parent's font-size Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97717.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); diff --git a/svgio/qa/cppunit/data/tdf145896.svg b/svgio/qa/cppunit/data/tdf145896.svg new file mode 100644 index ..d434a961b9d0 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf145896.svg @@ -0,0 +1,12 @@ +http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="-0 0 300 300"> + + +.st0{fill:yellow;}.st1{fill:green;} + + +.st2{fill:red;} + + + + + diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx index 43151253aacc..e26312d43163 100644 --- a/svgio/source/svgreader/svgdocumenthandler.cxx +++ b/svgio/source/svgreader/svgdocumenthandler.cxx @@ -302,21 +302,10 @@ namespace { SvgStyleNode* pNew = new SvgStyleNode(maDocument, mpTarget); mpTarget = pNew; -const sal_uInt32 nAttributes(xAttribs->getLength()); -if(0 == nAttributes) -{ -// #i125326# no attributes, thus also no type="text/css". This is allowed to be missing, -// thus do mark this style as CssStyle. This is required to read the contained -// text (which defines the css style) -pNew->setTextCss(true); -} -else -{ -// #i125326# there are attributes, read them. This will set isTextCss to true if -// a type="text/css" is contained as exact match, else not -mpTarget->parseAttributes(xAttribs); -} +// #i125326# there are attributes, read them. This will set isTextCss to false if +// type attibute is different to "text/css" +mpTarget->parseAttributes(xAttribs); if(pNew->isTextCss()) { diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx index ef25e6a83b47..b11f7129e0b3 100644 --- a/svgio/source/svgreader/svgstylenode.cxx +++ b/svgio/source/svgreader/svgstylenode.cxx @@ -28,7 +28,7 @@ namespace svgio::svgreader SvgDocument& rDocument, SvgNode* pParent) : SvgNode(SVGToken::Style, rDocument, pParent), -mbTextCss(false) +mbTextCss(true) { } @@ -57,9 +57,9 @@
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 19 ++ svgio/qa/cppunit/data/tdf97717.svg | 11 ++ svgio/source/svgreader/svggnode.cxx | 38 3 files changed, 47 insertions(+), 21 deletions(-) New commits: commit 28ce98bb97c382b1035bb7ce14f76e4a871f839a Author: Xisco Fauli AuthorDate: Mon Jun 19 13:18:42 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Jun 19 15:55:01 2023 +0200 tdf#97717: do not call add_postProcess from g element Otherwise, it will be called twice, from g and from its children Change-Id: I88535a7caab6a7711f917b3f383cd79b3b9fbd2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153276 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 7184c5fa500b..d7e7a07e644f 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -312,6 +312,25 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", "serif"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf97717) +{ +//Check when font-size uses relative units (em,ex) and it's based on its parent's font-size +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97717.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[1]", "transparence", "50"); +// Without the fix in place, this test would have failed here since the patch +// would have contained two unifiedtransparence +assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[1]/polypolygoncolor", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[2]", "transparence", "50"); +assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[2]/polypolygoncolor", "color", "#ff"); +} + CPPUNIT_TEST_FIXTURE(Test, testMarkerOrient) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/MarkerOrient.svg"); diff --git a/svgio/qa/cppunit/data/tdf97717.svg b/svgio/qa/cppunit/data/tdf97717.svg new file mode 100644 index ..c354e4416827 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97717.svg @@ -0,0 +1,11 @@ +http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="-0 0 300 300"> + + + + + + + + diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx index aca500af60ab..f49e737daafa 100644 --- a/svgio/source/svgreader/svggnode.cxx +++ b/svgio/source/svgreader/svggnode.cxx @@ -19,6 +19,7 @@ #include #include +#include namespace svgio::svgreader { @@ -85,31 +86,26 @@ namespace svgio::svgreader void SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { -if(SVGToken::Defs == getType()) -{ -// #i125258# no decompose needed for defs element, call parent for SVGTokenDefs -SvgNode::decomposeSvgNode(rTarget, bReferenced); -} -else -{ -// #i125258# for SVGTokenG decompose children -const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); +SvgNode::decomposeSvgNode(rTarget, bReferenced); -if(pStyle) +// if g element has transform, apply it +if(SVGToken::G == getType()) +{ +if(getTransform()) { -const double fOpacity(pStyle->getOpacity().getNumber()); - -if(fOpacity > 0.0 && Display::None != getDisplay()) -{ -drawinglayer::primitive2d::Primitive2DContainer aContent; +drawinglayer::primitive2d::Primitive2DContainer aSource(std::move(rTarget)); +// create embedding group element with transformation +const drawinglayer::primitive2d::Primitive2DReference xRef( +new drawinglayer::primitive2d::TransformPrimitive2D( +*getTransform(), +std::move(aSource))); -// decompose children -SvgNode::decomposeSvgNode(aContent, bReferenced); +aSource = drawinglayer::primitive2d::Primitive2DContainer { xRef }; -if(!aContent.empty()) -{ -pStyle->add_postProcess(rTarget, std::move(aContent), getTransform()); -} +if(!aSource.empty()) +{ +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx | 13 ++ svgio/qa/cppunit/data/tdf155833.svg | 31 svgio/source/svgreader/svgimagenode.cxx | 60 +--- 3 files changed, 70 insertions(+), 34 deletions(-) New commits: commit 0718628ee0173abb703b9d1999e89eabc26476c9 Author: Xisco Fauli AuthorDate: Thu Jun 15 10:10:38 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 15 20:53:09 2023 +0200 tdf#155833: apply transform to image even if target is equal to viewbox Change-Id: Ie820528384d096c6a332e2abd0095f68c7f64a0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153103 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 6dce36484bfcac711251710697dca961fd77ca20) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153082 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index bdfbfcccb911..7184c5fa500b 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -423,6 +423,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf45771) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf155833) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155833.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/transform/transform/bitmap", 1); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf97941) { //Check tspan fontsize when using relative units diff --git a/svgio/qa/cppunit/data/tdf155833.svg b/svgio/qa/cppunit/data/tdf155833.svg new file mode 100644 index ..8cc908424af0 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155833.svg @@ -0,0 +1,31 @@ + + + +http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg;> + + + + + + + + diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index ed7b81cef61a..19c8c9404541 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -310,45 +310,37 @@ namespace svgio::svgreader if(aNewTarget.empty()) return; -if(aTarget.equal(aViewBox)) -{ -// just add to rTarget -rTarget.append(aNewTarget); -} -else -{ -// create mapping -const SvgAspectRatio& rRatio = maSvgAspectRatio; +// create mapping +const SvgAspectRatio& rRatio = maSvgAspectRatio; -// even when ratio is not set, use the defaults -// let mapping be created from SvgAspectRatio -const basegfx::B2DHomMatrix aEmbeddingTransform(rRatio.createMapping(aTarget, aViewBox)); +// even when ratio is not set, use the defaults +// let mapping be created from SvgAspectRatio +const basegfx::B2DHomMatrix aEmbeddingTransform(rRatio.createMapping(aTarget, aViewBox)); -if(!aEmbeddingTransform.isIdentity()) -{ -const drawinglayer::primitive2d::Primitive2DReference xRef( -new drawinglayer::primitive2d::TransformPrimitive2D( -aEmbeddingTransform, -std::move(aNewTarget))); - -aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xRef }; -} +if(!aEmbeddingTransform.isIdentity()) +{ +const drawinglayer::primitive2d::Primitive2DReference xRef( +new drawinglayer::primitive2d::TransformPrimitive2D( +aEmbeddingTransform, +std::move(aNewTarget))); -if(!rRatio.isMeetOrSlice()) -{ -// need to embed in MaskPrimitive2D to ensure clipping -const drawinglayer::primitive2d::Primitive2DReference xMask( -new drawinglayer::primitive2d::MaskPrimitive2D( -basegfx::B2DPolyPolygon( - basegfx::utils::createPolygonFromRect(aTarget)), -std::move(aNewTarget))); - -aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xMask }; -} +aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xRef }; +} -// embed and add to rTarget, take local extra-transform into account -pStyle->add_postProcess(rTarget,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx| 18 ++ svgio/qa/cppunit/data/tdf155819.svg | 15 +++ svgio/source/svgreader/svgstyleattributes.cxx |5 +++-- 3 files changed, 36 insertions(+), 2 deletions(-) New commits: commit edc8dfa49c1c5371177a49c9e661cbda4efd9dd6 Author: Xisco Fauli AuthorDate: Wed Jun 14 01:10:50 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 14 08:57:56 2023 +0200 tdf#155819: check marker property comes from a style sheet Since 242b7d0162d55be0945ca849c3de841fbf6cb475 "svgio: simplify code" where bIsInStyleSheet was replaced by getCssStyleParent() incorrectly Change-Id: I48632e9374f4615e32d18a141aeabec2936e6ec8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153016 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index ad5852127551..559af49af695 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -135,6 +135,24 @@ CPPUNIT_TEST_FIXTURE(Test, testSymbol) assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00d000"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf155819) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155819.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 1); +assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon", 1); +// Without the fix in place, this test would have failed with +// - Expected: 4 +// - Actual : 0 +assertXPath(pDocument, "/primitive2D/transform/transform", 4); +} + CPPUNIT_TEST_FIXTURE(Test, testFilterLuminanceToAlpha) { Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg"); diff --git a/svgio/qa/cppunit/data/tdf155819.svg b/svgio/qa/cppunit/data/tdf155819.svg new file mode 100644 index ..30c2da4d1a5a --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155819.svg @@ -0,0 +1,15 @@ + +http://www.w3.org/2000/svg; viewBox="0 0 100 100"> + +path { + fill: none; + stroke-width: 4px; + marker: url(#diamond); +} + + + + + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 58a982a8a927..9e9bd5e47e6d 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1151,7 +1151,7 @@ namespace svgio::svgreader if(SVGToken::Path == mrOwner.getType() || // path SVGToken::Polygon == mrOwner.getType() || // polygon, polyline SVGToken::Line == mrOwner.getType() ||// line -getCssStyleParent()) +SVGToken::Style == mrOwner.getType())// tdf#150323 { // try to add markers add_markers(rPath, rTarget, pHelpPointIndices); @@ -1895,7 +1895,8 @@ namespace svgio::svgreader } case SVGToken::Marker: { -if(getCssStyleParent()) +// tdf#155819: Using the marker property from a style sheet is equivalent to using all three (start, mid, end). +if(mrOwner.getType() == SVGToken::Style) { readLocalUrl(aContent, maMarkerEndXLink); maMarkerStartXLink = maMarkerMidXLink = maMarkerEndXLink;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - svgio/qa svgio/source
svgio/qa/cppunit/SvgImportTest.cxx| 18 ++ svgio/qa/cppunit/data/tdf155733.svg | 20 svgio/source/svgreader/svgstyleattributes.cxx | 12 ++-- 3 files changed, 44 insertions(+), 6 deletions(-) New commits: commit 8274361b482f006fbab3f845c5f2e2d259a3955e Author: Xisco Fauli AuthorDate: Thu Jun 8 13:49:11 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 8 20:55:42 2023 +0200 tdf#155733: no need to store these values Change-Id: I1c22f8f344731eb5fbc5f77fc80267ebcdc81ed6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152740 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 9662b23182174888045726fd57bf7d93c16cf4fb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152757 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 967bcc0275cf..ce4db97e0954 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -989,6 +989,24 @@ CPPUNIT_TEST_FIXTURE(Test, testBehaviourWhenWidthAndHeightIsOrIsNotSet) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf155733) +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155733.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/transform[1]/softedge", "radius", "5"); + +// Without the fix in place, the softedge would have been applied to the second element +// - Expected: 1 +// - Actual : 0 +assertXPath(pDocument, "/primitive2D/transform/transform[2]/unifiedtransparence", "transparence", "50"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf97663) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/em_units.svg"); diff --git a/svgio/qa/cppunit/data/tdf155733.svg b/svgio/qa/cppunit/data/tdf155733.svg new file mode 100644 index ..db04ba9afd21 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155733.svg @@ -0,0 +1,20 @@ +http://www.w3.org/2000/svg; + xmlns:xlink="http://www.w3.org/1999/xlink;> + + + + + + + + + + + + + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index eda757af80d3..600f1690cb80 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -2879,7 +2879,7 @@ namespace svgio::svgreader if(!aClipPath.isEmpty()) { -const_cast< SvgStyleAttributes* >(this)->mpClipPathXLink = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(aClipPath)); +return dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(aClipPath)); } } @@ -2914,7 +2914,7 @@ namespace svgio::svgreader if(!aFilter.isEmpty()) { -const_cast< SvgStyleAttributes* >(this)->mpFilterXLink = dynamic_cast< const SvgFilterNode* >(mrOwner.getDocument().findSvgNodeById(aFilter)); +return dynamic_cast< const SvgFilterNode* >(mrOwner.getDocument().findSvgNodeById(aFilter)); } } @@ -2949,7 +2949,7 @@ namespace svgio::svgreader if(!aMask.isEmpty()) { -const_cast< SvgStyleAttributes* >(this)->mpMaskXLink = dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(aMask)); +return dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(aMask)); } } @@ -2984,7 +2984,7 @@ namespace svgio::svgreader if(!aMarker.isEmpty()) { -const_cast< SvgStyleAttributes* >(this)->mpMarkerStartXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink())); +return dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink())); } } @@ -3019,7 +3019,7 @@ namespace svgio::svgreader if(!aMarker.isEmpty()) { -const_cast< SvgStyleAttributes* >(this)->mpMarkerMidXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink())); +return dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink())); } } @@ -3054,7 +3054,7 @@ namespace svgio::svgreader if(!aMarker.isEmpty()) { -const_cast< SvgStyleAttributes* >(this)->mpMarkerEndXLink = dynamic_cast<