diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /svgio/qa/cppunit | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svgio/qa/cppunit')
94 files changed, 3624 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx new file mode 100644 index 0000000000..1b0be44177 --- /dev/null +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -0,0 +1,1984 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <test/bootstrapfixture.hxx> +#include <test/xmltesttools.hxx> + +#include <comphelper/seqstream.hxx> + +#include <com/sun/star/graphic/SvgTools.hpp> +#include <com/sun/star/graphic/XPrimitive2D.hpp> + +#include <drawinglayer/primitive2d/Tools.hxx> +#include <drawinglayer/tools/primitive2dxmldump.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + +#include <memory> +#include <string_view> + +using namespace css; +using namespace css::uno; +using namespace css::io; +using namespace css::graphic; +using drawinglayer::primitive2d::Primitive2DSequence; +using drawinglayer::primitive2d::Primitive2DContainer; +using drawinglayer::primitive2d::Primitive2DReference; + +class Test : public test::BootstrapFixture, public XmlTestTools +{ +protected: + void checkRectPrimitive(Primitive2DSequence const & rPrimitive); + + Primitive2DSequence parseSvg(std::u16string_view aSource); +}; + +Primitive2DSequence Test::parseSvg(std::u16string_view aSource) +{ + const Reference<XSvgParser> xSvgParser = SvgTools::create(m_xContext); + + OUString aUrl = m_directories.getURLFromSrc(aSource); + OUString aPath = m_directories.getPathFromSrc(aSource); + + SvFileStream aFileStream(aUrl, StreamMode::READ); + std::size_t nSize = aFileStream.remainingSize(); + std::unique_ptr<sal_Int8[]> pBuffer(new sal_Int8[nSize + 1]); + aFileStream.ReadBytes(pBuffer.get(), nSize); + pBuffer[nSize] = 0; + + Sequence<sal_Int8> aData(pBuffer.get(), nSize + 1); + Reference<XInputStream> aInputStream(new comphelper::SequenceInputStream(aData)); + + return xSvgParser->getDecomposition(aInputStream, aPath); +} + +void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) +{ + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(rPrimitive)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#00cc00"); // rect background color + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "height"_ostr, "100"); // rect background height + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "width"_ostr, "100"); // rect background width + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "minx"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "miny"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxx"_ostr, "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxy"_ostr, "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "color"_ostr, "#ff0000"); // rect stroke color + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "width"_ostr, "3"); // rect stroke width + + +} + +namespace +{ +bool arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB) +{ + return std::equal(rA.begin(), rA.end(), rB.begin(), rB.end(), + [](const css::uno::Reference<css::graphic::XPrimitive2D>& a, + const css::uno::Reference<css::graphic::XPrimitive2D>& b) + { + return drawinglayer::primitive2d::arePrimitive2DReferencesEqual(a, b); + }); +} +} + +// Attributes for an object (like rect as in this case) can be defined +// in different ways (directly with xml attributes, or with CSS styles), +// however the end result should be the same. +CPPUNIT_TEST_FIXTURE(Test, testStyles) +{ + Primitive2DSequence aSequenceRect = parseSvg(u"/svgio/qa/cppunit/data/Rect.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRect.getLength())); + checkRectPrimitive(aSequenceRect); + + Primitive2DSequence aSequenceRectWithStyle = parseSvg(u"/svgio/qa/cppunit/data/RectWithStyles.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStyle.getLength())); + checkRectPrimitive(aSequenceRectWithStyle); + + Primitive2DSequence aSequenceRectWithParentStyle = parseSvg(u"/svgio/qa/cppunit/data/RectWithParentStyles.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithParentStyle.getLength())); + checkRectPrimitive(aSequenceRectWithParentStyle); + + Primitive2DSequence aSequenceRectWithStylesByGroup = parseSvg(u"/svgio/qa/cppunit/data/RectWithStylesByGroup.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStylesByGroup.getLength())); + checkRectPrimitive(aSequenceRectWithStylesByGroup); + + CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithStyle)); + CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithParentStyle)); + CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithStylesByGroup)); +} + +CPPUNIT_TEST_FIXTURE(Test, testSymbol) +{ + Primitive2DSequence aSequenceTdf87309 = parseSvg(u"/svgio/qa/cppunit/data/symbol.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf87309); + + CPPUNIT_ASSERT (pDocument); + + // tdf#126330: Without the fix in place, this test would have failed with + // - Expected: 1 + // - Actual : 2 + // number of nodes is incorrect + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#00d000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf150124) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf150124.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPathChildren(pDocument, "/primitive2D"_ostr, 1); + assertXPath(pDocument, "/primitive2D/hiddengeometry"_ostr, 1); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf155819) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155819.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, 1); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon"_ostr, 1); + // Without the fix in place, this test would have failed with + // - Expected: 4 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, 4); +} + +CPPUNIT_TEST_FIXTURE(Test, testFeColorMatrix) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/filterFeColorMatrix.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[1]"_ostr, "modifier"_ostr, "matrix"); + assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[2]"_ostr, "modifier"_ostr, "saturate"); + assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[3]"_ostr, "modifier"_ostr, "hueRotate"); + assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[4]"_ostr, "modifier"_ostr, "luminance_to_alpha"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur) +{ + Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterFeGaussianBlur.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/softedge"_ostr, "radius"_ostr, "5"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFilterFeOffset) +{ + Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterFeOffset.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy11"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy12"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy13"_ostr, "44"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy21"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy22"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy23"_ostr, "66"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy31"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy32"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/mask/transform"_ostr, "xy33"_ostr, "1"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFilterFeFlood) +{ + Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterFeFlood.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence"_ostr, "transparence"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr, "minx"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr, "miny"_ostr, "50"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFilterFeDropShadow) +{ + Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterFeDropShadow.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence"_ostr, "transparence"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/shadow"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/shadow"_ostr, "blur"_ostr, "0.2"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/shadow"_ostr, "blur"_ostr, "0.2"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#ffc0cb"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFilterFeImage) +{ + Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterFeImage.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/bitmap"_ostr); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf87309) +{ + Primitive2DSequence aSequenceTdf87309 = parseSvg(u"/svgio/qa/cppunit/data/tdf87309.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf87309); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "minx"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "miny"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxx"_ostr, "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxy"_ostr, "110"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFontsizeKeywords) +{ + Primitive2DSequence aSequenceFontsizeKeywords = parseSvg(u"/svgio/qa/cppunit/data/FontsizeKeywords.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeKeywords.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceFontsizeKeywords); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "9"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "fontcolor"_ostr, "#ffffff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "11"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "fontcolor"_ostr, "#ffd700"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "height"_ostr, "13"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "fontcolor"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "fontcolor"_ostr, "#ffff00"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "height"_ostr, "19"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "fontcolor"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "height"_ostr, "23"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "fontcolor"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "height"_ostr, "27"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "fontcolor"_ostr, "#ff7f50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "height"_ostr, "13"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "fontcolor"_ostr, "#ffc0cb"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "height"_ostr, "19"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "familyname"_ostr, "Times New Roman"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]"_ostr, "fontcolor"_ostr, "#fffff0"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "familyname"_ostr, "Times New Roman"); +} + + +CPPUNIT_TEST_FIXTURE(Test, testFontsizePercentage) +{ + //Check when font-size uses percentage and defined globally + Primitive2DSequence aSequenceFontsizePercentage = parseSvg(u"/svgio/qa/cppunit/data/FontsizePercentage.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizePercentage.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceFontsizePercentage); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Times New Roman"); +} + +CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative) +{ + //Check when font-size uses relative units (em,ex) and it's based on its parent's font-size + Primitive2DSequence aSequenceFontsizeRelative = parseSvg(u"/svgio/qa/cppunit/data/FontsizeRelative.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeRelative.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceFontsizeRelative); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "DejaVu Serif"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "DejaVu Serif"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf145896) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.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, this test would have failed with + // - Expected: #ffff00 + // - Actual : #000000 + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#ffff00"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]"_ostr, "color"_ostr, "#0000ff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156168) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156168.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, 8); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]"_ostr, "color"_ostr, "#ff0000"); + + // Without the fix in place, this test would have failed with + // - Expected: 4 + // - Actual : 3 + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke"_ostr, 4); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[1]/line"_ostr, "width"_ostr, "5"); + + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[1]/line"_ostr, "color"_ostr, "#00ff00"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[2]/line"_ostr, "width"_ostr, "5"); + + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[2]/line"_ostr, "color"_ostr, "#00ff00"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[3]/line"_ostr, "width"_ostr, "5"); + + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[3]/line"_ostr, "color"_ostr, "#00ff00"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr, "width"_ostr, "5"); + + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr, "color"_ostr, "#00ff00"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf129356) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf129356.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, this test would have failed with + // - Expected: #008000 + // - Actual : #0000ff + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]"_ostr, "color"_ostr, "#008000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156034) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156034.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, this test would have failed with + // - Expected: #008000 + // - Actual : #0000ff + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]"_ostr, "color"_ostr, "#008000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156038) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156038.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#0000ff"); + + // Without the fix in place, this test would have failed with + // - Expected: #008000 + // - Actual : #0000ff + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]"_ostr, "color"_ostr, "#008000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156018) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156018.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, this test would have failed with + // - Expected: #008000 + // - Actual : #0000ff + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#0000ff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156201) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156201.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#2f3ba1"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156167) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156167.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#ffa500"); + + // Without the fix in place, this test would have failed with + // - Expected: #ffa500 + // - Actual : #ff0000 + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#ffa500"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]"_ostr, "color"_ostr, "#ffa500"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf155932) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155932.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/mask/unifiedtransparence"_ostr, "transparence"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/mask/mask/unifiedtransparence[1]/polypolygoncolor"_ostr, "color"_ostr, "#0000ff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97717) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97717.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[1]"_ostr, "transparence"_ostr, "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"_ostr, "color"_ostr, "#ccccff"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[2]"_ostr, "transparence"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[2]/polypolygoncolor"_ostr, "color"_ostr, "#ccccff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testMarkerOrient) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/MarkerOrient.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy11"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy12"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy13"_ostr, "7"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy21"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy22"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy23"_ostr, "13"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy31"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy32"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]"_ostr, "xy33"_ostr, "1"); + + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy11"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy12"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy13"_ostr, "87"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy21"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy22"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy23"_ostr, "87"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy31"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy32"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]"_ostr, "xy33"_ostr, "1"); +} + +CPPUNIT_TEST_FIXTURE(Test, testMarkerInPresentation) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/markerInPresentation.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr, 1); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon"_ostr, 1); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon"_ostr, 1); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 2 + assertXPath(pDocument, "/primitive2D/transform/transform/transform"_ostr, 0); +} + +CPPUNIT_TEST_FIXTURE(Test, testMarkerInCssStyle) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/markerInCssStyle.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, this test would have failed with + // - Expected: 20 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr, 20); + + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr, "width"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr, "linejoin"_ostr, "Miter"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr, "miterangle"_ostr, "28"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr, "linecap"_ostr, "BUTT"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTextXmlSpace) +{ + //Check tspan fontsize when using relative units + Primitive2DSequence aSequenceTdf97941 = parseSvg(u"/svgio/qa/cppunit/data/textXmlSpace.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf97941); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "text"_ostr, "a b"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "text"_ostr, "a b"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "text"_ostr, "a b"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "text"_ostr, "ab"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]"_ostr, "text"_ostr, " a b "); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]"_ostr, "text"_ostr, "a b"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[7]"_ostr, "text"_ostr, "a b"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[8]"_ostr, "text"_ostr, "a b"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf45771) +{ + //Check text fontsize when using relative units + Primitive2DSequence aSequenceTdf45771 = parseSvg(u"/svgio/qa/cppunit/data/tdf45771.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf45771.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf45771); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "32"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Times New Roman"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf155833) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155833.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/transform/transform/bitmap"_ostr, 1); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97941) +{ + //Check tspan fontsize when using relative units + Primitive2DSequence aSequenceTdf97941 = parseSvg(u"/svgio/qa/cppunit/data/tdf97941.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf97941); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Sample"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "48"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Times New Roman"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156777) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156777.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"_ostr, 23); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Quick brown fox jumps over the lazy dog."); + + // Without the fix in place, this test would have failed with + // - Expected: #008000 + // - Actual : #000000 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "84"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "23"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156834) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156834.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"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Auto"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "Middle"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "56"); + + 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"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf104339) +{ + Primitive2DSequence aSequenceTdf104339 = parseSvg(u"/svgio/qa/cppunit/data/tdf104339.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf104339.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf104339); + + CPPUNIT_ASSERT (pDocument); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#000000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf85770) +{ + Primitive2DSequence aSequenceTdf85770 = parseSvg(u"/svgio/qa/cppunit/data/tdf85770.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf85770.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf85770)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Start Middle End"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "11"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Times New Roman"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "Start"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "11"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "Times New Roman"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "fontcolor"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, " End"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "height"_ostr, "11"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "familyname"_ostr, "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]"_ostr, "text"_ostr, "line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "290"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "183"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "above"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "290"); + + // Without the fix in place, this test would have failed with + // - Expected: 159 + // - Actual : 207 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "159"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "below"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "290"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "207"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf93583) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf93583.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]"_ostr, "text"_ostr, "This is the"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "62"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "303"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, " first"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "127"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "303"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "width"_ostr, "32"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "32"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, " line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "187"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "303"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "height"_ostr, "16"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156616) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156616.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]"_ostr, "text"_ostr, "First"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "114"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "103"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, " line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "142"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "103"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "Second line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "114"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "122"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "First"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "x"_ostr, "86"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "y"_ostr, "153"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "text"_ostr, " line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "x"_ostr, "114"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "y"_ostr, "153"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "text"_ostr, "Second line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "x"_ostr, "77"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "y"_ostr, "172"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "text"_ostr, "First"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "x"_ostr, "59"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "y"_ostr, "203"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "text"_ostr, " line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "x"_ostr, "87"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "y"_ostr, "203"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "text"_ostr, "Second line"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "x"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "y"_ostr, "222"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf79163) +{ + //Check Opacity + Primitive2DSequence aSequenceTdf79163 = parseSvg(u"/svgio/qa/cppunit/data/tdf79163.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf79163.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf79163)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence"_ostr, "transparence"_ostr, "50"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97542_1) +{ + Primitive2DSequence aSequenceTdf97542_1 = parseSvg(u"/svgio/qa/cppunit/data/tdf97542_1.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_1.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_1)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr, "fontcolor"_ostr, "#ffff00"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr, "text"_ostr, "Text"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr, "height"_ostr, "48"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr, "familyname"_ostr, "DejaVu Serif"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97542_2) +{ + Primitive2DSequence aSequenceTdf97542_2 = parseSvg(u"/svgio/qa/cppunit/data/tdf97542_2.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_2.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_2)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr, "startx"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr, "starty"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient/focalx"_ostr, 0); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient/focaly"_ostr, 0); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr, "radius"_ostr, "3"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr, "spreadmethod"_ostr, "pad"); + assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr, "opacity"_ostr, "1"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97543) +{ + // check visibility="inherit" + Primitive2DSequence aSequenceTdf97543 = parseSvg(u"/svgio/qa/cppunit/data/tdf97543.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97543.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97543)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#00cc00"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "minx"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "miny"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxx"_ostr, "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxy"_ostr, "110"); +} + +CPPUNIT_TEST_FIXTURE(Test, testRGBColor) +{ + Primitive2DSequence aSequenceRGBColor = parseSvg(u"/svgio/qa/cppunit/data/RGBColor.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBColor.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceRGBColor)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#646464"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "minx"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "miny"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxx"_ostr, "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr, "maxy"_ostr, "110"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf149673) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149673.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/unifiedtransparence"_ostr, "transparence"_ostr, "90"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[1]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[2]"_ostr, "color"_ostr, "#00ff00"); + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[3]"_ostr, "color"_ostr, "#0000ff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testRGBAColor) +{ + Primitive2DSequence aSequenceRGBAColor = parseSvg(u"/svgio/qa/cppunit/data/RGBAColor.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence"_ostr, "transparence"_ostr, "50"); +} + +CPPUNIT_TEST_FIXTURE(Test, testNoneColor) +{ + Primitive2DSequence aSequenceRGBAColor = parseSvg(u"/svgio/qa/cppunit/data/noneColor.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor)); + + CPPUNIT_ASSERT (pDocument); + + //No polypolygoncolor exists + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor"_ostr, 0); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr, "width"_ostr, "3"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf117920) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf117920.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/transform"_ostr, "xy11"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy12"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy13"_ostr, "-18"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy21"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy22"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy23"_ostr, "-6"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy31"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy32"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy33"_ostr, "1"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97936) +{ + // check that both rectangles are rendered in the viewBox + Primitive2DSequence aSequenceTdf97936 = parseSvg(u"/svgio/qa/cppunit/data/tdf97936.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97936.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97936)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"_ostr); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "height"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "width"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "minx"_ostr, "70"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "miny"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "maxx"_ostr, "120"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "maxy"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"_ostr); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "height"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "width"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "minx"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "miny"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "maxx"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "maxy"_ostr, "100"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf149893) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149893.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed with + // - Expected: #008000 + // - Actual : #000000 + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#008000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testShapeWithClipPathAndCssStyle) +{ + // tdf#97539: Check there is a mask and 3 polygons + Primitive2DSequence aSequenceClipPathAndStyle = parseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon"_ostr, 2); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon"_ostr, 1); +} + +CPPUNIT_TEST_FIXTURE(Test, testClipPathAndParentStyle) +{ + //Check that fill color, stroke color and stroke-width are inherited from use element + //when the element is within a clipPath element + Primitive2DSequence aSequenceClipPathAndParentStyle = parseSvg(u"/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndParentStyle.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndParentStyle)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr, "width"_ostr, "5"); + +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf155814) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155814.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/mask/mask/transform/unifiedtransparence"_ostr, "transparence"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/mask/mask/transform/unifiedtransparence/polypolygoncolor"_ostr, "color"_ostr, "#0000ff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testClipPathAndStyle) +{ + //Check that fill color, stroke color and stroke-width are inherited from use element + //when the element is within a clipPath element + Primitive2DSequence aSequenceClipPathAndStyle = parseSvg(u"/svgio/qa/cppunit/data/ClipPathAndStyle.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#ccccff"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr, "color"_ostr, "#0000cc"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr, "width"_ostr, "2"); + +} + +CPPUNIT_TEST_FIXTURE(Test, testShapeWithClipPath) +{ + // Check there is a mask and 3 polygons + Primitive2DSequence aSequenceClipPathAndStyle = parseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPath.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon"_ostr, 2); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon"_ostr, 1); +} + +CPPUNIT_TEST_FIXTURE(Test, testClipPathUsingClipPath) +{ + Primitive2DSequence aSequenceClipPathAndStyle = parseSvg(u"/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon/point"_ostr, 20); + assertXPath(pDocument, "/primitive2D/transform/mask/mask/polypolygon/polygon/point"_ostr, 13); +} + +CPPUNIT_TEST_FIXTURE(Test, testFillRule) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/FillRule.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/polypolygoncolor"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon/polygon"_ostr, 2); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon/polygon"_ostr, 2); +} + +CPPUNIT_TEST_FIXTURE(Test, testClipRule) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/ClipRule.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // Without the place in place, this test would have failed with + // - Expected: 5 + // - Actual : 10 + assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point"_ostr, 5); + assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor"_ostr, "color"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point"_ostr, 4); + + assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon/point"_ostr, 5); + assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point"_ostr, 4); +} + +CPPUNIT_TEST_FIXTURE(Test, testi125329) +{ + //Check style inherit from * css element + Primitive2DSequence aSequencei125329 = parseSvg(u"/svgio/qa/cppunit/data/i125329.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequencei125329.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequencei125329)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor"_ostr, "color"_ostr, "#c0c0c0"); // rect background color + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr, "height"_ostr, "30"); // rect background height + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr, "width"_ostr, "50"); // rect background width + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr, "minx"_ostr, "15"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr, "miny"_ostr, "15"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr, "maxx"_ostr, "65"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr, "maxy"_ostr, "45"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line"_ostr, "color"_ostr, "#008000"); // rect stroke color + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line"_ostr, "width"_ostr, "1"); // rect stroke width +} + +CPPUNIT_TEST_FIXTURE(Test, testMaskingPath07b) +{ + //For the time being, check that masking-path-07-b.svg can be imported and it doesn't hang on loading + //it used to hang after d5649ae7b76278cb3155f951d6327157c7c92b65 + Primitive2DSequence aSequenceMaskingPath07b = parseSvg(u"/svgio/qa/cppunit/data/masking-path-07-b.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskingPath07b.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceMaskingPath07b)); + + CPPUNIT_ASSERT (pDocument); + +} + +CPPUNIT_TEST_FIXTURE(Test, test123926) +{ + Primitive2DSequence aSequence123926 = parseSvg(u"/svgio/qa/cppunit/data/tdf123926.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence123926.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence123926)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/transform/unifiedtransparence/polypolygoncolor"_ostr, "color"_ostr, "#7cb5ec"); +} + +CPPUNIT_TEST_FIXTURE(Test, test47446) +{ + //Check that marker's fill attribute is black is not set + Primitive2DSequence aSequence47446 = parseSvg(u"/svgio/qa/cppunit/data/47446.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence47446)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#000000"); + +} + +CPPUNIT_TEST_FIXTURE(Test, test47446b) +{ + //Check that marker's fill attribute is inherit from def + Primitive2DSequence aSequence47446b = parseSvg(u"/svgio/qa/cppunit/data/47446b.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446b.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence47446b)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#ffff00"); + +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf103888) +{ + Primitive2DSequence aSequenceMaskText = parseSvg(u"/svgio/qa/cppunit/data/tdf103888.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceMaskText)); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed here with number of nodes is incorrect + assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Her"); + assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[2]"_ostr, "text"_ostr, "vor"); + assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[3]"_ostr, "text"_ostr, "hebung"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156251) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156251.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed with + // - Expected: 'You are ' + // - Actual : 'You are' + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "You are"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, " not"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, " a banana!"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "You are"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "text"_ostr, " not"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "text"_ostr, " a banana!"); +} + +CPPUNIT_TEST_FIXTURE(Test, testMaskText) +{ + //Check that mask is applied on text + Primitive2DSequence aSequenceMaskText = parseSvg(u"/svgio/qa/cppunit/data/maskText.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceMaskText)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr, "fontcolor"_ostr, "#ffffff"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr, "text"_ostr, "Black White"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr, "height"_ostr, "26"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr, "familyname"_ostr, "Times New Roman"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf99994) +{ + //Check text fontsize when using relative units + Primitive2DSequence aSequenceTdf99994 = parseSvg(u"/svgio/qa/cppunit/data/tdf99994.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99994.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf99994)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "test"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "DejaVu Sans"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf99115) +{ + //Check that styles are resolved correctly where there is a * css selector + Primitive2DSequence aSequenceTdf99115 = parseSvg(u"/svgio/qa/cppunit/data/tdf99115.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99115.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf99115) ); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "red 1"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "red 2"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "fontcolor"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "red 3"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "fontcolor"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "blue 4"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "fontcolor"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "text"_ostr, "blue 5"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "fontcolor"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "text"_ostr, "blue 6"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "fontcolor"_ostr, "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "text"_ostr, "green 7"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "fontcolor"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "text"_ostr, "green 8"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "fontcolor"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "height"_ostr, "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "text"_ostr, "green 9"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "fontcolor"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "height"_ostr, "18"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf101237) +{ + //Check that fill color, stroke color and stroke-width are inherited from use element + //when the element is within a clipPath element + Primitive2DSequence aSequenceTdf101237 = parseSvg(u"/svgio/qa/cppunit/data/tdf101237.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf101237.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf101237)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "width"_ostr, "5"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97710) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97710.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/mask/polypolygoncolor[1]"_ostr, "color"_ostr, "#000000"); + + // Without the fix in place, this test would have failed with + // - Expected: 100 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]"_ostr, "color"_ostr, "#008000"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr, "width"_ostr, "1"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf94765) +{ + Primitive2DSequence aSequenceTdf94765 = parseSvg(u"/svgio/qa/cppunit/data/tdf94765.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf94765)); + + CPPUNIT_ASSERT (pDocument); + + //Check that both rectangles use the gradient as fill + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]"_ostr, "startx"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]"_ostr, "starty"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]"_ostr, "endx"_ostr, "2"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]"_ostr, "endy"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]"_ostr, "startx"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]"_ostr, "starty"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]"_ostr, "endx"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]"_ostr, "endy"_ostr, "0"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156236) +{ + Primitive2DSequence aSequenceTdf94765 = parseSvg(u"/svgio/qa/cppunit/data/tdf156236.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf94765)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr, "path"_ostr, "m50 180h-30v-60h60v60z"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr, "path"_ostr, "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"_ostr, "path"_ostr, "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"_ostr, "path"_ostr, "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 + // are and are not set. In both cases the result must be the same, + // however if the width / height are set, then the size of the image + // is enforced, but this isn't really possible in LibreOffice (or + // maybe we could lock the size in this case). + // The behaviour in browsers is that when a SVG image has width / height + // attributes set, then the image is shown with that size, but if it + // isn't set then it is shown as scalable image which is the size of + // the container. + + { + const Primitive2DSequence aSequence = parseSvg(u"svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg"); + CPPUNIT_ASSERT(aSequence.hasElements()); + + geometry::RealRectangle2D aRealRect; + basegfx::B2DRange aRange; + uno::Sequence<beans::PropertyValue> aViewParameters; + + for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aSequence) + { + if (xReference.is()) + { + aRealRect = xReference->getRange(aViewParameters); + aRange.expand(basegfx::B2DRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2)); + } + } + + double fWidth = (aRange.getWidth() / 2540.0) * 96.0; + double fHeight = (aRange.getHeight() / 2540.0) * 96.0; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth, 1E-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight, 1E-12); + } + + { + const Primitive2DSequence aSequence = parseSvg(u"svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg"); + CPPUNIT_ASSERT(aSequence.hasElements()); + + + geometry::RealRectangle2D aRealRect; + basegfx::B2DRange aRange; + uno::Sequence<beans::PropertyValue> aViewParameters; + + for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aSequence) + { + if (xReference.is()) + { + aRealRect = xReference->getRange(aViewParameters); + aRange.expand(basegfx::B2DRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2)); + } + } + + double fWidth = (aRange.getWidth() / 2540.0) * 96.0; + double fHeight = (aRange.getHeight() / 2540.0) * 96.0; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth, 1E-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight, 1E-12); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf155733) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155733.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/softedge"_ostr, "radius"_ostr, "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/unifiedtransparence"_ostr, "transparence"_ostr, "50"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97663) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/em_units.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // tdf#97663: Without the fix in place, this test would have failed with + // - Expected: 236 + // - Actual : 204 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "236"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156269) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156269.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "//textsimpleportion[@text='one']"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "//textsimpleportion[@text='one']"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "//textsimpleportion[@text='one']"_ostr, "x"_ostr, "10"); + assertXPath(pDocument, "//textsimpleportion[@text='one']"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "//textsimpleportion[@text='one']"_ostr, "fontcolor"_ostr, "#808080"); + + assertXPath(pDocument, "//textsimpleportion[@text='two']"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "//textsimpleportion[@text='two']"_ostr, "height"_ostr, "16"); + + // Without the fix in place, this test would have failed with + // - Expected: 60 + // - Actual : 10 + assertXPath(pDocument, "//textsimpleportion[@text='two']"_ostr, "x"_ostr, "60"); + assertXPath(pDocument, "//textsimpleportion[@text='two']"_ostr, "y"_ostr, "100"); + assertXPath(pDocument, "//textsimpleportion[@text='two']"_ostr, "fontcolor"_ostr, "#000000"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf95400) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf95400.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]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "ABC"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx0"_ostr, "36"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx1"_ostr, "69"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx2"_ostr, "102"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "width"_ostr, "48"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "ABC"); + assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx0"_ostr); +} + +CPPUNIT_TEST_FIXTURE(Test, testTextAnchor) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf151103.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]"_ostr, "x"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "43"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "26"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "x"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "x"_ostr, "43"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "x"_ostr, "26"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "y"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "x"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "x"_ostr, "43"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "x"_ostr, "26"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "y"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]"_ostr, "text"_ostr, "ABC"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]"_ostr, "x"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]"_ostr, "text"_ostr, "A"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]"_ostr, "x"_ostr, "72"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]"_ostr, "text"_ostr, "B"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]"_ostr, "x"_ostr, "83"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]"_ostr, "text"_ostr, "C"); + + // Without the fix in place, this test would have failed with + // - Expected: 43 + // - Actual : 54 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]"_ostr, "x"_ostr, "43"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]"_ostr, "text"_ostr, "A"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]"_ostr, "x"_ostr, "55"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]"_ostr, "text"_ostr, "B"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]"_ostr, "x"_ostr, "66"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]"_ostr, "y"_ostr, "50"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]"_ostr, "text"_ostr, "C"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]"_ostr, "x"_ostr, "26"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]"_ostr, "y"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]"_ostr, "text"_ostr, "A"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]"_ostr, "x"_ostr, "38"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]"_ostr, "y"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]"_ostr, "text"_ostr, "B"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]"_ostr, "x"_ostr, "49"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]"_ostr, "y"_ostr, "60"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]"_ostr, "text"_ostr, "C"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156577) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156577.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]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "ABC"); + assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx0"_ostr); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "ABC"); + + // Without the fix in place, this test would have failed with + // - Expected: 22 + // - Actual : 52 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx0"_ostr, "22"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx1"_ostr, "53"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx2"_ostr, "94"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156283) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156283.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]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "ABC"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx0"_ostr, "41"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx1"_ostr, "52"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx2"_ostr, "63"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "ABC"); + + // Without the fix in place, this test would have failed with + // - Expected: 41 + // - Actual : 12 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx0"_ostr, "41"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx1"_ostr, "52"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx2"_ostr, "63"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156569) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156569.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]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "ABC"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx0"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx1"_ostr, "80"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "dx2"_ostr, "91"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "ABC"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx0"_ostr, "40"); + + // Without the fix in place, this test would have failed with + // - Expected: 80 + // - Actual : 51 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx1"_ostr, "80"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "dx2"_ostr, "91"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156837) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156837.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"_ostr, 2); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "114"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "103"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "x"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "x"_ostr, "122"); + + // Without the fix in place, this test would have failed with + // - Expected: 94 + // - Actual : 103 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "y"_ostr, "94"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, " 3"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf156271) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156271.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/mask/textsimpleportion[1]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "x"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "y"_ostr, "10"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "text"_ostr, "AB"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "dx0"_ostr, "-30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr, "dx1"_ostr, "-19"); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "x"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "y"_ostr, "20"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "text"_ostr, "AB"); + + // Without the fix in place, this test would have failed with + // - Expected: -30 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "dx0"_ostr, "-30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr, "dx1"_ostr, "-19"); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "x"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "y"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "text"_ostr, "AB"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "dx0"_ostr, "-30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr, "dx1"_ostr, "-19"); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "width"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "height"_ostr, "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "x"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "y"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "text"_ostr, "AB"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "dx0"_ostr, "12"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "dx1"_ostr, "23"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf149880) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed with + // - Expected: 1 + // - Actual : 0 + // - In <>, XPath '/primitive2D/transform/mask/unhandled' number of nodes is incorrect + assertXPath(pDocument, + "/primitive2D/transform/mask/unhandled"_ostr, "id"_ostr, "PATTERNFILL"); + assertXPath(pDocument, + "/primitive2D/transform/mask/unhandled/mask/transform/transform/bitmap"_ostr, 28); +} + +CPPUNIT_TEST_FIXTURE(Test, testCssClassRedefinition) +{ + // Tests for svg css class redefinition behavior + // Example: + // .c1 {fill:#00ff00} + // .c1 {font-family:Sans} + // .c1 {fill:#ff0000} + // Expected result is .c1 {font-family:Sans; fill:#ff0000} because + // the second redefinition appends attributes to the class and the + // third redefinition replaces the already existing + // attribute in the original definition + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/CssClassRedefinition.svg"); + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + CPPUNIT_ASSERT (pDocument); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "012"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "fontcolor"_ostr, "#ff0000"); + assertXPath( + pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Open Symbol"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTspanFillOpacity) +{ + // Given an SVG file with <tspan fill-opacity="0.30">: + std::u16string_view aPath = u"/svgio/qa/cppunit/data/tspan-fill-opacity.svg"; + + // When rendering that SVG: + Primitive2DSequence aSequence = parseSvg(aPath); + + // Then make sure that the text portion is wrapped in a transparency primitive with the correct + // transparency value: + drawinglayer::Primitive2dXmlDump aDumper; + xmlDocUniquePtr pDocument = aDumper.dumpAndParse(Primitive2DContainer(aSequence)); + sal_Int32 nTransparence = getXPath(pDocument, "//textsimpleportion[@text='hello']/parent::unifiedtransparence"_ostr, "transparence"_ostr).toInt32(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // - XPath '//textsimpleportion[@text='hello']/parent::unifiedtransparence' number of nodes is incorrect + // i.e. the relevant <textsimpleportion> had no <unifiedtransparence> parent, the text was not + // semi-transparent. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(70), nTransparence); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/qa/cppunit/SvgNumberTest.cxx b/svgio/qa/cppunit/SvgNumberTest.cxx new file mode 100644 index 0000000000..f420a44b42 --- /dev/null +++ b/svgio/qa/cppunit/SvgNumberTest.cxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <SvgNumber.hxx> + +namespace +{ +class TestNumber : public CppUnit::TestFixture +{ + void testSetting(); + void testSolve(); + +public: + CPPUNIT_TEST_SUITE(TestNumber); + CPPUNIT_TEST(testSetting); + CPPUNIT_TEST(testSolve); + CPPUNIT_TEST_SUITE_END(); +}; + +class TestInfoProvider : public svgio::svgreader::InfoProvider +{ +public: + basegfx::B2DRange getCurrentViewPort() const override + { + return basegfx::B2DRange(0.0, 0.0, 0.0, 0.0); + } + + double getCurrentFontSizeInherited() const override { return 12.0; } + + double getCurrentXHeightInherited() const override { return 5.0; } +}; + +void TestNumber::testSetting() +{ + { + svgio::svgreader::SvgNumber aNumber; + CPPUNIT_ASSERT_EQUAL(svgio::svgreader::SvgUnit::px, aNumber.getUnit()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, aNumber.getNumber(), 1e-8); + CPPUNIT_ASSERT_EQUAL(false, aNumber.isSet()); + } + { + svgio::svgreader::SvgNumber aNumber(0.01); + CPPUNIT_ASSERT_EQUAL(svgio::svgreader::SvgUnit::px, aNumber.getUnit()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.01, aNumber.getNumber(), 1e-8); + CPPUNIT_ASSERT_EQUAL(true, aNumber.isSet()); + } + { + svgio::svgreader::SvgNumber aNumber(1.01, svgio::svgreader::SvgUnit::cm); + CPPUNIT_ASSERT_EQUAL(svgio::svgreader::SvgUnit::cm, aNumber.getUnit()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.01, aNumber.getNumber(), 1e-8); + CPPUNIT_ASSERT_EQUAL(true, aNumber.isSet()); + } +} + +void TestNumber::testSolve() +{ + { + svgio::svgreader::SvgNumber aNumber(1.01); + TestInfoProvider aInfoProvider; + double aSolvedNumber = aNumber.solve(aInfoProvider); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.01, aSolvedNumber, 1e-8); + } + { + svgio::svgreader::SvgNumber aNumber(1.0, svgio::svgreader::SvgUnit::pt); + TestInfoProvider aInfoProvider; + double aSolvedNumber = aNumber.solve(aInfoProvider); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.333, aSolvedNumber, 1e-3); + } + { + svgio::svgreader::SvgNumber aNumber(2.54, svgio::svgreader::SvgUnit::cm); + TestInfoProvider aInfoProvider; + double aSolvedNumber = aNumber.solve(aInfoProvider); + CPPUNIT_ASSERT_DOUBLES_EQUAL(96.0, aSolvedNumber, 1e-3); + } +} + +CPPUNIT_TEST_SUITE_REGISTRATION(TestNumber); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/qa/cppunit/SvgRead.cxx b/svgio/qa/cppunit/SvgRead.cxx new file mode 100644 index 0000000000..a26556dd7a --- /dev/null +++ b/svgio/qa/cppunit/SvgRead.cxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <test/bootstrapfixture.hxx> + +#include <memory> + +#include <comphelper/seqstream.hxx> +#include <comphelper/processfactory.hxx> +#include <tools/stream.hxx> + +#include <com/sun/star/graphic/SvgTools.hpp> +#include <com/sun/star/graphic/XSvgParser.hpp> + +#include <basegfx/DrawCommands.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> + +namespace +{ +using namespace css; + +class TestParsing : public test::BootstrapFixture +{ + void testSimpleRectangle(); + void testPath(); + uno::Reference<io::XInputStream> parseSvg(const OUString& aSource); + +public: + CPPUNIT_TEST_SUITE(TestParsing); + CPPUNIT_TEST(testSimpleRectangle); + CPPUNIT_TEST(testPath); + CPPUNIT_TEST_SUITE_END(); +}; + +uno::Reference<io::XInputStream> TestParsing::parseSvg(const OUString& aSource) +{ + SvFileStream aFileStream(aSource, StreamMode::READ); + std::size_t nSize = aFileStream.remainingSize(); + std::unique_ptr<sal_Int8[]> pBuffer(new sal_Int8[nSize + 1]); + aFileStream.ReadBytes(pBuffer.get(), nSize); + pBuffer[nSize] = 0; + + uno::Sequence<sal_Int8> aData(pBuffer.get(), nSize + 1); + uno::Reference<io::XInputStream> aInputStream(new comphelper::SequenceInputStream(aData)); + + return aInputStream; +} + +void TestParsing::testSimpleRectangle() +{ + OUString aSvgFile = "/svgio/qa/cppunit/data/VisiotorTest-Rect.svg"; + OUString aUrl = m_directories.getURLFromSrc(aSvgFile); + OUString aPath = m_directories.getPathFromSrc(aSvgFile); + + uno::Reference<io::XInputStream> xStream = parseSvg(aUrl); + CPPUNIT_ASSERT(xStream.is()); + + uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); + const uno::Reference<graphic::XSvgParser> xSvgParser = graphic::SvgTools::create(xContext); + + uno::Any aAny = xSvgParser->getDrawCommands(xStream, aPath); + CPPUNIT_ASSERT(aAny.has<sal_uInt64>()); + auto* pDrawRoot = reinterpret_cast<gfx::DrawRoot*>(aAny.get<sal_uInt64>()); + + basegfx::B2DRange aSurfaceRectangle(0, 0, 120, 120); + + CPPUNIT_ASSERT_EQUAL(size_t(1), pDrawRoot->maChildren.size()); + CPPUNIT_ASSERT_EQUAL(aSurfaceRectangle, pDrawRoot->maRectangle); + + auto* pDrawBase = pDrawRoot->maChildren[0].get(); + CPPUNIT_ASSERT_EQUAL(gfx::DrawCommandType::Rectangle, pDrawRoot->maChildren[0]->getType()); + auto* pDrawRect = static_cast<gfx::DrawRectangle*>(pDrawBase); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DRange(10, 10, 110, 110), pDrawRect->maRectangle); + CPPUNIT_ASSERT_EQUAL(3.0, pDrawRect->mnStrokeWidth); + CPPUNIT_ASSERT(bool(pDrawRect->mpStrokeColor)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(*pDrawRect->mpStrokeColor)); + CPPUNIT_ASSERT(bool(pDrawRect->mpFillColor)); + CPPUNIT_ASSERT_EQUAL(Color(0x00cc00), Color(*pDrawRect->mpFillColor)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.1, pDrawRect->mnOpacity, 1E-12); +} + +void TestParsing::testPath() +{ + OUString aSvgFile = "/svgio/qa/cppunit/data/path.svg"; + OUString aUrl = m_directories.getURLFromSrc(aSvgFile); + OUString aPath = m_directories.getPathFromSrc(aSvgFile); + + uno::Reference<io::XInputStream> xStream = parseSvg(aUrl); + CPPUNIT_ASSERT(xStream.is()); + + uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); + const uno::Reference<graphic::XSvgParser> xSvgParser = graphic::SvgTools::create(xContext); + + uno::Any aAny = xSvgParser->getDrawCommands(xStream, aPath); + CPPUNIT_ASSERT(aAny.has<sal_uInt64>()); + auto* pDrawRoot = reinterpret_cast<gfx::DrawRoot*>(aAny.get<sal_uInt64>()); + + CPPUNIT_ASSERT_EQUAL(size_t(1), pDrawRoot->maChildren.size()); + + auto* pDrawBase = pDrawRoot->maChildren[0].get(); + CPPUNIT_ASSERT_EQUAL(gfx::DrawCommandType::Path, pDrawBase->getType()); + auto* pDrawPath = static_cast<gfx::DrawPath*>(pDrawBase); + + CPPUNIT_ASSERT_EQUAL(OUString("m1 1h42v24h-42v-24z"), + basegfx::utils::exportToSvgD(pDrawPath->maPolyPolygon, true, true, false)); + CPPUNIT_ASSERT_EQUAL(0.0, pDrawPath->mnStrokeWidth); + CPPUNIT_ASSERT(bool(pDrawPath->mpStrokeColor)); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(*pDrawPath->mpStrokeColor)); + CPPUNIT_ASSERT(bool(pDrawPath->mpFillColor)); + CPPUNIT_ASSERT_EQUAL(Color(0x007aff), Color(*pDrawPath->mpFillColor)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.1, pDrawPath->mnOpacity, 1E-12); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(TestParsing); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/qa/cppunit/data/47446.svg b/svgio/qa/cppunit/data/47446.svg new file mode 100644 index 0000000000..aec66b9bdc --- /dev/null +++ b/svgio/qa/cppunit/data/47446.svg @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" standalone="no" ?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="12cm" height="4cm" viewBox="0 0 1200 400"
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
+<defs>
+ <marker id="Triangle"
+ markerUnits="strokeWidth" refY="3"
+ markerWidth="6" markerHeight="6"
+ orient="auto">
+ <path d="M 0 0 L 6 3 L 0 6 z"
+ stroke-width="0.5" stroke="black"/>
+ </marker>
+</defs>
+
+<polyline fill="none" stroke="red" stroke-width="10"
+ points="450,50 550,50 650,150"
+ marker-end="url(#Triangle)" />
+</svg>
diff --git a/svgio/qa/cppunit/data/47446b.svg b/svgio/qa/cppunit/data/47446b.svg new file mode 100644 index 0000000000..29cfce5d84 --- /dev/null +++ b/svgio/qa/cppunit/data/47446b.svg @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" standalone="no" ?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="12cm" height="4cm" viewBox="0 0 1200 400"
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
+<defs fill="yellow">
+ <marker id="Triangle"
+ markerUnits="strokeWidth" refY="3"
+ markerWidth="6" markerHeight="6"
+ orient="auto">
+ <path d="M 0 0 L 6 3 L 0 6 z"
+ stroke-width="0.5" stroke="black"/>
+ </marker>
+</defs>
+<polyline fill="none" stroke="red" stroke-width="10"
+ points="450,50 550,50 650,150"
+ marker-end="url(#Triangle)" />
+</svg>
diff --git a/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg b/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg new file mode 100644 index 0000000000..d85a95995c --- /dev/null +++ b/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg @@ -0,0 +1,10 @@ +<svg version="1.1" baseProfile="basic" id="svg-root" + width="100%" height="100%" viewBox="0 0 480 360" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <clipPath> + <circle id="c1" cx="100" cy="100" r="50"/> + </clipPath> + + <use xlink:href="#c1" style="fill:red" stroke-width="5px" stroke="black"/> + +</svg> diff --git a/svgio/qa/cppunit/data/ClipPathAndStyle.svg b/svgio/qa/cppunit/data/ClipPathAndStyle.svg new file mode 100644 index 0000000000..f3b1777fa5 --- /dev/null +++ b/svgio/qa/cppunit/data/ClipPathAndStyle.svg @@ -0,0 +1,13 @@ +<svg version="1.1" baseProfile="basic" id="svg-root"
+ width="100%" height="100%" viewBox="0 0 480 360"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <clipPath>
+ <circle id="c1" cx="100" cy="100" r="50"
+ style="stroke: #0000cc;
+ stroke-width: 2px;
+ fill : #ccccff;"/>
+ </clipPath>
+
+ <use href="#c1" style="fill:red" stroke-width="5px" stroke="black"/>
+
+</svg>
diff --git a/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg b/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg new file mode 100644 index 0000000000..5eaa7928cb --- /dev/null +++ b/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<defs> + +<clipPath id="clip1"> + <polygon id="clip1Shape" points="100,10 40,180 190,60 10,60 160,180 100,10" stroke="blue" /> +</clipPath> + +<clipPath id="clip2"> + <circle id="clip2Shape" cx="100" cy="100" r="65" /> +</clipPath> + + +<clipPath id="clipIntersection" clip-path="url(#clip1)"> + <use x="0" y="0" width="200" height="200" xlink:href="#clip2Shape" /> +</clipPath> + +</defs> + +<rect x="10" y="10" width="180" height="180" fill="red" + clip-path="url(#clipIntersection)" transform="translate(200)" /> + +</svg> diff --git a/svgio/qa/cppunit/data/ClipRule.svg b/svgio/qa/cppunit/data/ClipRule.svg new file mode 100644 index 0000000000..55f0cb9eee --- /dev/null +++ b/svgio/qa/cppunit/data/ClipRule.svg @@ -0,0 +1,18 @@ +<svg version="1.1" baseProfile="basic" id="svg-root" + width="100%" height="100%" viewBox="0 0 480 360" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <!-- Define star path --> + <defs> + <path d="M50,0 21,90 98,35 2,35 79,90z" id="star" /> + </defs> + <clipPath id="emptyStar"> + <use xlink:href="#star" clip-rule="evenodd" /> + </clipPath> + <rect clip-path="url(#emptyStar)" width="50" height="90" fill="blue" /> + + <clipPath id="filledStar"> + <use xlink:href="#star" clip-rule="evenodd" /> + </clipPath> + <rect clip-path="url(#filledStar)" width="50" height="90" x="50" fill="red" /> +</svg> + diff --git a/svgio/qa/cppunit/data/CssClassRedefinition.svg b/svgio/qa/cppunit/data/CssClassRedefinition.svg new file mode 100644 index 0000000000..591f07f8b4 --- /dev/null +++ b/svgio/qa/cppunit/data/CssClassRedefinition.svg @@ -0,0 +1,13 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="50 px" height="100 px"> + <style type="text/css"> + .c1 {fill:#00ff00} + <!-- this redefinition should be appended --> + .c1 {font-family:Open Symbol} + <!-- this redefinition should change the color to red, replacing the first definition --> + .c1 {fill:#ff0000} + <!-- finally c1 should be equal to fill:#ff0000 and font-family:Sans --> + </style> + <text x="20" y="20" > + <tspan class="c1">012</tspan> + </text> +</svg> diff --git a/svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg b/svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg new file mode 100644 index 0000000000..59520d6ab9 --- /dev/null +++ b/svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + viewBox="0 0 10 10"> + <rect + width="3" + height="3" + x="6" + y="6" + style="fill:#008000;stroke-width:0.15288568" /> +</svg> diff --git a/svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg b/svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg new file mode 100644 index 0000000000..bc5afb553e --- /dev/null +++ b/svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + viewBox="0 0 10 10" + height="10" + width="10"> + <rect + width="3" + height="3" + x="6" + y="6" + style="fill:#008000;stroke-width:0.15288568" /> +</svg> diff --git a/svgio/qa/cppunit/data/FillRule.svg b/svgio/qa/cppunit/data/FillRule.svg new file mode 100644 index 0000000000..c406065fbe --- /dev/null +++ b/svgio/qa/cppunit/data/FillRule.svg @@ -0,0 +1,6 @@ +<svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg"> + <path fill-rule="evenodd" stroke="red" + d="M110,0 h90 v90 h-90 z + M130,20 h50 v50 h-50 z"/> +</svg> + diff --git a/svgio/qa/cppunit/data/FontsizeKeywords.svg b/svgio/qa/cppunit/data/FontsizeKeywords.svg new file mode 100644 index 0000000000..9a97983c01 --- /dev/null +++ b/svgio/qa/cppunit/data/FontsizeKeywords.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg height="600" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + +<text x="5" y="15" font-size="xx-small" fill="black">Sample</text> +<text x="5" y="50" font-size="x-small" fill="white">Sample</text> +<text x="5" y="100" font-size="small" fill="gold">Sample</text> +<text x="5" y="150" font-size="medium" fill="red">Sample</text> +<text x="5" y="200" font-size="large" fill="yellow">Sample</text> +<text x="5" y="250" font-size="x-large" fill="blue">Sample</text> +<text x="5" y="300" font-size="xx-large" fill="green">Sample</text> +<text x="5" y="350" font-size="smaller" fill="coral">Sample</text> +<text x="5" y="400" font-size="larger" fill="pink">Sample</text> +<text x="5" y="450" font-size="initial" fill="ivory">Sample</text> +</svg> diff --git a/svgio/qa/cppunit/data/FontsizePercentage.svg b/svgio/qa/cppunit/data/FontsizePercentage.svg new file mode 100644 index 0000000000..fc7c9fa61c --- /dev/null +++ b/svgio/qa/cppunit/data/FontsizePercentage.svg @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> <svg height="600" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" font-size="100%"> + <text x="5" y="15">Sample</text> +</svg> diff --git a/svgio/qa/cppunit/data/FontsizeRelative.svg b/svgio/qa/cppunit/data/FontsizeRelative.svg new file mode 100644 index 0000000000..4b74aa692b --- /dev/null +++ b/svgio/qa/cppunit/data/FontsizeRelative.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <svg height="600" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<g font-size="5px" font-family="DejaVu Serif"> + <text x="10" y="150" font-size="10em" font-family="inherit">Sample</text> + <text x="200" y="150" font-size="10em" font-family="DejaVu Serif">Sample</text> +</g> +</svg> diff --git a/svgio/qa/cppunit/data/MarkerOrient.svg b/svgio/qa/cppunit/data/MarkerOrient.svg new file mode 100644 index 0000000000..7997e1cce9 --- /dev/null +++ b/svgio/qa/cppunit/data/MarkerOrient.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <defs> + <!-- arrowhead marker definition --> + <marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5" + markerWidth="6" markerHeight="6" + orient="auto-start-reverse"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + + <marker id="arrow2" viewBox="0 0 10 10" refX="5" refY="5" + markerWidth="6" markerHeight="6" + orient="auto-start-reverse"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + + </defs> + + <!-- Coordinate axes with a arrowhead in both direction --> + <polyline points="10,10 10,90 90,90" fill="none" stroke="black" + marker-start="url(#arrow)" marker-end="url(#arrow2)" /> +</svg> diff --git a/svgio/qa/cppunit/data/RGBAColor.svg b/svgio/qa/cppunit/data/RGBAColor.svg new file mode 100644 index 0000000000..ddd7a3cc03 --- /dev/null +++ b/svgio/qa/cppunit/data/RGBAColor.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect x="10" y="10" width="100" height="100" rx="10" ry="10" fill="rgba(20,10,100,0.5)" visibility="inherit" />
+</svg>
diff --git a/svgio/qa/cppunit/data/RGBColor.svg b/svgio/qa/cppunit/data/RGBColor.svg new file mode 100644 index 0000000000..ad60d5b55a --- /dev/null +++ b/svgio/qa/cppunit/data/RGBColor.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect x="10" y="10" width="100" height="100" rx="10" ry="10" fill="rgb(100,100,100)" visibility="inherit" />
+</svg>
diff --git a/svgio/qa/cppunit/data/Rect.svg b/svgio/qa/cppunit/data/Rect.svg new file mode 100644 index 0000000000..7567cdfb5b --- /dev/null +++ b/svgio/qa/cppunit/data/Rect.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <rect x="10" y="10" width="100" height="100" rx="10" ry="10" stroke="#ff0000" fill="#00cc00" stroke-width="3" /> +</svg> diff --git a/svgio/qa/cppunit/data/RectWithParentStyles.svg b/svgio/qa/cppunit/data/RectWithParentStyles.svg new file mode 100644 index 0000000000..a01ba3ff5b --- /dev/null +++ b/svgio/qa/cppunit/data/RectWithParentStyles.svg @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <style type="text/css" > + <![CDATA[ + svg + { + stroke: #ff0000; + fill: #00cc00; + } + ]]> + </style> + <rect x="10" y="10" width="100" height="100" rx="10" ry="10" style="stroke-width: 3;" /> +</svg> diff --git a/svgio/qa/cppunit/data/RectWithStyles.svg b/svgio/qa/cppunit/data/RectWithStyles.svg new file mode 100644 index 0000000000..b7068499be --- /dev/null +++ b/svgio/qa/cppunit/data/RectWithStyles.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <rect x="10" y="10" width="100" height="100" rx="10" ry="10" style="stroke: #ff0000; fill: #00cc00; stroke-width: 3" /> +</svg> diff --git a/svgio/qa/cppunit/data/RectWithStylesByGroup.svg b/svgio/qa/cppunit/data/RectWithStylesByGroup.svg new file mode 100644 index 0000000000..0a3b1e3cd8 --- /dev/null +++ b/svgio/qa/cppunit/data/RectWithStylesByGroup.svg @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs> + <style type="text/css"> + <![CDATA[ + g + { + stroke: #ff0000; + fill: #00cc00; + } + ]]> + </style> + </defs> + <g> + <rect x="10" y="10" width="100" height="100" rx="10" ry="10" style="stroke-width: 3;" /> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/ShapeWithClipPath.svg b/svgio/qa/cppunit/data/ShapeWithClipPath.svg new file mode 100644 index 0000000000..28c51b4dfb --- /dev/null +++ b/svgio/qa/cppunit/data/ShapeWithClipPath.svg @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<svg width="120" height="120" + viewPort="0 0 120 120" version="1.1" + xmlns="http://www.w3.org/2000/svg"> + + <clipPath id="myClip"> + <rect x="30" y="30" width="20" height="20"/> + <rect x="70" y="70" width="20" height="20"/> + </clipPath> + + <rect x="10" y="10" width="100" height="100" fill="#00D000" + clip-path="url(#myClip)"/> +</svg> diff --git a/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg b/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg new file mode 100644 index 0000000000..4b6455c649 --- /dev/null +++ b/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<svg width="120" height="120" + viewPort="0 0 120 120" version="1.1" + xmlns="http://www.w3.org/2000/svg"> + + <clipPath id="myClip"> + <rect x="30" y="30" width="20" height="20"/> + <rect x="70" y="70" width="20" height="20"/> + </clipPath> + + <rect x="10" y="10" width="100" height="100" style="fill:#00D000" + clip-path="url(#myClip)"/> +</svg> diff --git a/svgio/qa/cppunit/data/VisiotorTest-Rect.svg b/svgio/qa/cppunit/data/VisiotorTest-Rect.svg new file mode 100644 index 0000000000..4cd2d3602e --- /dev/null +++ b/svgio/qa/cppunit/data/VisiotorTest-Rect.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <rect x="10" y="10" width="100" height="100" rx="10" ry="10" stroke="#ff0000" opacity="0.1" fill="#00cc00" stroke-width="3" /> +</svg> diff --git a/svgio/qa/cppunit/data/em_units.svg b/svgio/qa/cppunit/data/em_units.svg new file mode 100644 index 0000000000..6a7947cb3c --- /dev/null +++ b/svgio/qa/cppunit/data/em_units.svg @@ -0,0 +1,14 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="10cm" height="10cm"> + + <style> + text {font-family: 'DejaVu Sans'; font-size: 36pt;} + new {font-family: 'DejaVu Sans'; font-size: 1em;} + </style> + + <line x1="5cm" y1="5cm" x2="8cm" y2="5cm" stroke="black" /> + <!-- 0.5in = 1.27cm = 36pt !--> + <line x1="5cm" y1="6.27cm" x2="8cm" y2="6.27cm" stroke="black" /> + <text x="5cm" y="5cm" class="new">AWlll<tspan x="5cm" dy="1em">AWlll</tspan> + </text> +</svg> + diff --git a/svgio/qa/cppunit/data/filterFeColorMatrix.svg b/svgio/qa/cppunit/data/filterFeColorMatrix.svg new file mode 100644 index 0000000000..a86c2debc2 --- /dev/null +++ b/svgio/qa/cppunit/data/filterFeColorMatrix.svg @@ -0,0 +1,59 @@ +<svg + width="100%" + height="100%" + viewBox="0 0 150 500" + preserveAspectRatio="xMidYMid meet" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <!-- ref --> + <defs> + <g id="circles"> + <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> + </g> + </defs> + <use href="#circles" /> + <text x="70" y="50">Reference</text> + + <!-- Combine RGB into green matrix --> + <filter id="colorMeGreen"> + <feColorMatrix + in="SourceGraphic" + values="0 0 0 0 0 + 1 1 1 1 0 + 0 0 0 0 0 + 0 0 0 1 0" /> + </filter> + <use + href="#circles" + transform="translate(0 70)" + filter="url(#colorMeGreen)" /> + <text x="70" y="120">rgbToGreen</text> + + <!-- saturate --> + <filter id="colorMeSaturate"> + <feColorMatrix in="SourceGraphic" type="saturate" values="0.2" /> + </filter> + <use + href="#circles" + transform="translate(0 140)" + filter="url(#colorMeSaturate)" /> + <text x="70" y="190">saturate</text> + + <!-- hueRotate --> + <filter id="colorMeHueRotate"> + <feColorMatrix in="SourceGraphic" type="hueRotate" values="180" /> + </filter> + <use + href="#circles" + transform="translate(0 210)" + filter="url(#colorMeHueRotate)" /> + <text x="70" y="260">hueRotate</text> + + <!-- luminanceToAlpha --> + <filter id="colorMeLTA"> + <feColorMatrix in="SourceGraphic" type="luminanceToAlpha" /> + </filter> + <use href="#circles" transform="translate(0 280)" filter="url(#colorMeLTA)" /> + <text x="70" y="330">luminanceToAlpha</text> +</svg> + diff --git a/svgio/qa/cppunit/data/filterFeDropShadow.svg b/svgio/qa/cppunit/data/filterFeDropShadow.svg new file mode 100644 index 0000000000..a6405c93af --- /dev/null +++ b/svgio/qa/cppunit/data/filterFeDropShadow.svg @@ -0,0 +1,10 @@ +<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> + <defs> + <filter id="shadow"> + <feDropShadow dx="0.6" dy="0.4" stdDeviation="0.2" flood-color="blue" flood-opacity="0.5" /> + </filter> + </defs> + + <circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);" /> +</svg> + diff --git a/svgio/qa/cppunit/data/filterFeFlood.svg b/svgio/qa/cppunit/data/filterFeFlood.svg new file mode 100644 index 0000000000..2c438ad1a9 --- /dev/null +++ b/svgio/qa/cppunit/data/filterFeFlood.svg @@ -0,0 +1,16 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> + <defs> + <filter id="floodFilter" filterUnits="userSpaceOnUse"> + <feFlood + x="50" + y="50" + width="100" + height="100" + flood-color="green" + flood-opacity="0.5" /> + </filter> + </defs> + + <use filter="url(#floodFilter)" /> +</svg> + diff --git a/svgio/qa/cppunit/data/filterFeGaussianBlur.svg b/svgio/qa/cppunit/data/filterFeGaussianBlur.svg new file mode 100644 index 0000000000..e8fd73068a --- /dev/null +++ b/svgio/qa/cppunit/data/filterFeGaussianBlur.svg @@ -0,0 +1,11 @@ +<svg + width="230" + height="120" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <filter id="blurMe"> + <feGaussianBlur in="SourceGraphic" stdDeviation="5"/> + </filter> + <circle cx="170" cy="60" r="50" fill="green" filter="url(#blurMe)" /> +</svg> + diff --git a/svgio/qa/cppunit/data/filterFeImage.svg b/svgio/qa/cppunit/data/filterFeImage.svg new file mode 100644 index 0000000000..5682dbf469 --- /dev/null +++ b/svgio/qa/cppunit/data/filterFeImage.svg @@ -0,0 +1,16 @@ +<svg + viewBox="0 0 200 200" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + width="200" + height="200"> + <defs> + <filter id="image"> + <feImage + xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAACBCAYAAADnoNlQAAAABHNCSVQICAgIfAhkiAAAAUJJREFUeJzt3EENAkEQRcG3aMAjMpYzBgjqSDCyWJhbZ5IqBf/w0sc+6rzaxnN6wLpzesC62/QA5okAESACEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAiojvv12+at7aPP9IRlO211CRABIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAdVzvtnlr22t6wLrnd3rBOpcAESACEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBFR/ALUM7y9VYLsAAAAASUVORK5CYII="/> + </filter> + </defs> + + <rect x="10%" y="10%" width="80%" height="80%" style="filter:url(#image);" /> +</svg> + diff --git a/svgio/qa/cppunit/data/filterFeOffset.svg b/svgio/qa/cppunit/data/filterFeOffset.svg new file mode 100644 index 0000000000..89bb40eef8 --- /dev/null +++ b/svgio/qa/cppunit/data/filterFeOffset.svg @@ -0,0 +1,18 @@ +<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> + <defs> + <filter id="offset" width="180" height="180"> + <feOffset in="SourceGraphic" dx="44" dy="66" /> + </filter> + </defs> + + <rect x="0" y="0" width="100" height="100" stroke="black" fill="green" /> + <rect + x="0" + y="0" + width="100" + height="100" + stroke="black" + fill="green" + filter="url(#offset)" /> +</svg> + diff --git a/svgio/qa/cppunit/data/i125329.svg b/svgio/qa/cppunit/data/i125329.svg new file mode 100644 index 0000000000..86e3bd8393 --- /dev/null +++ b/svgio/qa/cppunit/data/i125329.svg @@ -0,0 +1,12 @@ +<svg version="1.1" baseProfile="full" id="svg-root" + width="12cm" height="6cm" viewBox="0 0 120 60" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + + <title id="test-title">all selector</title> + <style type="text/css"> + * {fill:silver; stroke-width:1;stroke-miterlimit:100000;} + rect {stroke:green;} + #test-frame {stroke:blue; fill:none;} + </style> + <rect x="15" y="15" width="50" height="30" stroke-width="10"/> +</svg> diff --git a/svgio/qa/cppunit/data/markerInCssStyle.svg b/svgio/qa/cppunit/data/markerInCssStyle.svg new file mode 100644 index 0000000000..a7a8374f6e --- /dev/null +++ b/svgio/qa/cppunit/data/markerInCssStyle.svg @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<defs> +<marker style="overflow:visible;" id="bip" refX="0" refY="0" orient="auto"> + <path style="stroke: green" d="M 0,-3 v 6" /> +</marker> +</defs> + +<style> +path.boundary {stroke: red; fill: #ccc; stroke-width: 3; marker-mid: url(#bip); marker-end: url(#bip)} +</style> + +<path class="boundary" d="m 20,20 v 90 90 90 90 90 h 90 90 90 90 90 v -90 -90 -90 -90 -90 h -90 -90 -90 -90 z" /> +</svg> diff --git a/svgio/qa/cppunit/data/markerInPresentation.svg b/svgio/qa/cppunit/data/markerInPresentation.svg new file mode 100644 index 0000000000..5071544e39 --- /dev/null +++ b/svgio/qa/cppunit/data/markerInPresentation.svg @@ -0,0 +1,12 @@ +<svg version="1.1" baseProfile="full" id="svg-root" + width="100%" height="100%" viewBox="0 0 480 360" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs> + <marker id="marker2" markerUnits="strokeWidth" refX="100" refY="100" markerWidth="15" markerHeight="15" viewBox="0 0 200 200"> + <rect width="200" height="200" fill="red" stroke="none"/> + </marker> + </defs> + <g marker="url(#marker2)" fill="gold" stroke="black" fill-rule="evenodd" transform="translate(50,20)"> + <line x1="370" x2="280" y1="60" y2="140"/> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/maskText.svg b/svgio/qa/cppunit/data/maskText.svg new file mode 100644 index 0000000000..7405f6a569 --- /dev/null +++ b/svgio/qa/cppunit/data/maskText.svg @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<svg width="200" height="80" + viewBox="0 0 200 80" version="1.1" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <defs> + <mask id="myMask" + x="0" y="0" width="200" height="80"> + <rect x="0" y="0" width="100" height="80" fill="white"/> + </mask> + + <text id="Text" x="100" y="48" + font-size="26" font-weight="bold" text-anchor="middle"> + Black White + </text> + </defs> + + <!-- Draw black rectangle in the background --> + <rect x="100" y="10" width="95" height="60" /> + + <!-- Draw the text string twice. First, the white text without mask. + Second, the black text with the mask applied--> + <use xlink:href="#Text" fill="white"/> + <use xlink:href="#Text" fill="black" mask="url(#myMask)"/> +</svg> diff --git a/svgio/qa/cppunit/data/masking-path-07-b.svg b/svgio/qa/cppunit/data/masking-path-07-b.svg new file mode 100644 index 0000000000..eca3660bab --- /dev/null +++ b/svgio/qa/cppunit/data/masking-path-07-b.svg @@ -0,0 +1,147 @@ +<svg version="1.1" baseProfile="basic" id="svg-root" + width="100%" height="100%" viewBox="0 0 480 360" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <!--======================================================================--> + <!--= SVG 1.1 2nd Edition Test Case =--> + <!--======================================================================--> + <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> + <!--= Institute of Technology, European Research Consortium for =--> + <!--= Informatics and Mathematics (ERCIM), Keio University). =--> + <!--= All Rights Reserved. =--> + <!--= See http://www.w3.org/Consortium/Legal/. =--> + <!--======================================================================--> + <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" + template-version="1.3" reviewer="CM" author="ED" status="accepted" + version="$Revision: 1.11 $" testname="$RCSfile: masking-path-07-b.svg,v $"> + <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/masking.html#ClippingPaths"> + <p> + This tests that 'clipPath' elements can be used together and how the clipping paths are intersected. + </p> + <p> + There is a gray-white pattern as a background for the two subtest rectangles. This is to show that the holes that are cut out using clip-paths are transparent. + The first subtest verifies that when you use the 'clip-path' property on a child element inside a 'clipPath' element the child element is clipped correctly. + The second subtest verifies that when a 'clipPath' element has a 'clip-path' property the result is the intersection of the two clip paths. + </p> + </d:testDescription> + <d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> + <p> + Run the test. No interaction required. + </p> + </d:operatorScript> + <d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> + <p> + The test has passed if the following conditions are met: + </p> + <ul> + <li>There is no red visible.</li> + <li>No shapes extend outside of the rects that have a thick black border.</li> + <li>For the left subtest: + <ul> + <li>There must be a large blue rect with a transparent smaller rect in it, and the intersection of two circles.</li> + <li>The borders of the clipregions are shown with black stroke.</li> + <li>The blue shapes must be visible only inside of these stroked regions.</li> + </ul> + </li> + <li>For the right subtest: + <ul> + <li>The test on the right must show part of the large blue rect shape with a transparent rect in it, and part of a circle.</li> + <li>The blue shapes must only be visible inside of the circle that has black stroke.</li> + </ul> + </li> + </ul> + </d:passCriteria> + </d:SVGTestCase> + <title id="test-title">$RCSfile: masking-path-07-b.svg,v $</title> + <defs> + <font-face font-family="DejaVu Sans" unicode-range="U+0-7F"> + <font-face-src> + <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> + </font-face-src> + </font-face> + </defs> + <g id="test-body-content" font-family="DejaVu Sans" font-size="18"> + + <defs> + <clipPath id="clipCircle1"> + <circle id="c1" cx="100" cy="100" r="50"/> + </clipPath> + + <clipPath id="clipCircle2"> + <circle id="c2" cx="150" cy="150" r="50"/> + </clipPath> + + <clipPath id="clipPath1"> + <path id="p1" d="M10 10l100 0 0 100 -100 0ZM50 50l40 0 0 40 -40 0Z" clip-rule="evenodd"/> + </clipPath> + + <!-- "If a valid 'clip-path' reference is placed on one of the children of a 'clipPath' element, + then the given child element is clipped by the referenced clipping path before OR'ing the + silhouette of the child element with the silhouettes of the other child elements." --> + <clipPath id="clipRects1"> + <rect x="50" y="30" width="25" height="100"/> + <rect x="25" y="50" width="10" height="10" clip-path="url(#clipTwoCircles)"/> + </clipPath> + + <!-- Test use in a clipPath --> + <clipPath id="clipTwoCircles"> + <use xlink:href="#c1"/> + <use xlink:href="#c2"/> + </clipPath> + + <clipPath id="clipInClip1"> + <use xlink:href="#c2" clip-path="url(#clipCircle1)"/> + <use xlink:href="#p1"/> + </clipPath> + + <clipPath id="clipOnClip1" clip-path="url(#clipCircle1)"> + <use xlink:href="#c2"/> + <use xlink:href="#p1"/> + </clipPath> + + <pattern patternUnits="userSpaceOnUse" id="pattern" x="0" y="0" width="20" height="20"> + <rect x="0" y="0" width="10" height="10" fill="gray"/> + <rect x="10" y="10" width="10" height="10" fill="gray"/> + </pattern> + </defs> + + <rect x="20" y="70" width="210" height="210" fill="url(#pattern)" stroke="black" stroke-width="4"/> + <rect x="250" y="70" width="210" height="210" fill="url(#pattern)" stroke="black" stroke-width="4"/> + + <text x="240" y="2em" text-anchor="middle">Test clip unions and intersections</text> + + <g transform="translate(20, 70)"> + <g id="subtest1"> + <use xlink:href="#p1" fill="red" fill-rule="evenodd"/> + <use xlink:href="#c2" fill="red" clip-path="url(#clipCircle1)"/> + <use xlink:href="#c1" fill="red" clip-path="url(#clipCircle2)"/> + + <rect width="200" height="200" fill="blue" clip-path="url(#clipInClip1)"/> + + <use xlink:href="#c2" fill="none" clip-path="url(#clipCircle1)" stroke="black"/> + <use xlink:href="#c1" fill="none" clip-path="url(#clipCircle2)" stroke="black"/> + <use xlink:href="#p1" fill="none" stroke="black"/> + </g> + + <g id="subtest2" transform="translate(230,0)"> + <g clip-path="url(#clipCircle1)"> + <use xlink:href="#c2" fill="red"/> + <use xlink:href="#p1" fill="red" fill-rule="evenodd"/> + </g> + + <rect width="300" height="300" fill="blue" clip-path="url(#clipOnClip1)"/> + + <use xlink:href="#c1" fill="none" stroke="black"/> + </g> + </g> + </g> + <g font-family="DejaVu Sans" font-size="32"> + <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.11 $</text> + </g> + <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> + <!-- comment out this watermark once the test is approved --><!-- + <g id="draft-watermark"> + <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> + <text font-family="DejaVu Sans" font-weight="bold" font-size="20" x="240" + text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> + </g>--> +</svg> diff --git a/svgio/qa/cppunit/data/noneColor.svg b/svgio/qa/cppunit/data/noneColor.svg new file mode 100644 index 0000000000..552a1cf5af --- /dev/null +++ b/svgio/qa/cppunit/data/noneColor.svg @@ -0,0 +1,3 @@ +<svg width="400" height="110"> + <rect width="300" height="100" style="fill:none;stroke-width:3;stroke:rgb(0,0,0)" /> +</svg> diff --git a/svgio/qa/cppunit/data/path.svg b/svgio/qa/cppunit/data/path.svg new file mode 100644 index 0000000000..559ceec6d5 --- /dev/null +++ b/svgio/qa/cppunit/data/path.svg @@ -0,0 +1,3 @@ +<svg width="44" height="26" xmlns="http://www.w3.org/2000/svg"> + <path d="M1 1 H 43 V 25 H 1 L 1 1 Z" fill="#007aff" stroke="#fff" opacity="0.1" stroke-width="0"/> +</svg> diff --git a/svgio/qa/cppunit/data/symbol.svg b/svgio/qa/cppunit/data/symbol.svg new file mode 100644 index 0000000000..55110f3740 --- /dev/null +++ b/svgio/qa/cppunit/data/symbol.svg @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<svg width="120" height="120" + viewPort="0 0 120 120" version="1.1" + xmlns="http://www.w3.org/2000/svg"> + + <symbol> + <rect x="10" y="10" width="100" height="100" fill="red"/> + </symbol> + + <rect x="10" y="10" width="10" height="10" fill="#00D000"/> +</svg> diff --git a/svgio/qa/cppunit/data/tdf101237.svg b/svgio/qa/cppunit/data/tdf101237.svg new file mode 100644 index 0000000000..e5afa37384 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf101237.svg @@ -0,0 +1,11 @@ +<svg version="1.1" baseProfile="basic" id="svg-root" + width="100%" height="100%" viewBox="0 0 480 360" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none"> + + <clipPath id="p.0"> + <path + d="m0 0l437.0 0l0 487.0l-437.0 0l0 -487.0z" + clip-rule="nonzero"/> + </clipPath> + <circle clip-path="url(#p.0)" id="c1" cx="100" cy="100" r="50" style="fill:red" stroke-width="5px" stroke="black"/> +</svg> diff --git a/svgio/qa/cppunit/data/tdf103888.svg b/svgio/qa/cppunit/data/tdf103888.svg new file mode 100644 index 0000000000..157bb12571 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf103888.svg @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+ width="75mm"
+ height="15mm"
+ viewBox="0 0 250 50">
+ <text
+ style="font-size:30px;font-family:'DejaVu Sans';fill:#000000;stroke:none"
+ x="20"
+ y="30">Her<tspan style="font-weight:bold">vor</tspan>hebung</text>
+</svg>
diff --git a/svgio/qa/cppunit/data/tdf104339.svg b/svgio/qa/cppunit/data/tdf104339.svg new file mode 100644 index 0000000000..fe55c7bfc1 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf104339.svg @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + id="svg2" + version="1.1" + xml:space="preserve" + width="565.10504" + height="132.81749" + viewBox="0 0 565.10504 132.8175"> + <defs> + <clipPath clipPathUnits="userSpaceOnUse" id="clipPath16"> + <path d="M 0,612 792,612 792,0 0,0 0,612 Z"/> + </clipPath> + </defs> + <g transform="matrix(1.25,0,0,-1.25,-221.64057,456.20243)"> + <g transform="translate(16.855932,5.8347458)"> + <g clip-path="url(#clipPath16)"> + <g transform="translate(403.16803,288.82005)"> + <path + d="m 0,0 v -7.675 h -34.756 v 51.656 h 8.19 V 0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"/> + </g> + </g> + </g> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf117920.svg b/svgio/qa/cppunit/data/tdf117920.svg new file mode 100644 index 0000000000..487e0f6cb9 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf117920.svg @@ -0,0 +1,7 @@ +<svg width="100%" height="100%" viewBox="0 0 100 100" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <switch transform="translate(-18,-6)"> + <rect width="13" height="13" x="18" y="6" /> + </switch> +</svg> diff --git a/svgio/qa/cppunit/data/tdf123926.svg b/svgio/qa/cppunit/data/tdf123926.svg new file mode 100644 index 0000000000..085b736b53 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf123926.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" class="highcharts-root" style="font-family:"DejaVu Sans"font-size:12px;" width="600" height="400" viewBox="0 0 600 400"> + <defs> + <clipPath id="highcharts-qkip48v-39"> + <rect x="0" y="0" width="505" height="283" fill="none"/> + </clipPath> + </defs> + <g class="highcharts-series-group" data-z-index="3"> + <g data-z-index="0.1" class="highcharts-series highcharts-series-0 highcharts-bubble-series highcharts-color-0 " transform="translate(85,61) scale(1 1)" clip-path="url(#highcharts-qkip48v-39)"> + <path fill="rgb(124,181,236)" fill-opacity="0.5" d="M 501 123.5 A 13.5 13.5 0 1 1 500.99999325000056 123.48650000225 Z" stroke="#7cb5ec" stroke-width="1" class="highcharts-point highcharts-color-0"/> + </g> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf129356.svg b/svgio/qa/cppunit/data/tdf129356.svg new file mode 100644 index 0000000000..46bd6935da --- /dev/null +++ b/svgio/qa/cppunit/data/tdf129356.svg @@ -0,0 +1,34 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 800 800"> + + <style> + g.g1 rect {fill:green;} + g#g3 rect {fill:green;} + g.g4 #r1 {fill:green;} + g#g3 .r5 {fill:green;} + </style> + + <g class="g4 g1"> + <g class="g2"> + <rect x="0" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="60" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g id="g3"> + <g id="g4"> + <rect x="120" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="180" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g class="g4 g1"> + <g> + <rect id="r1" x="240" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect id="r1" x="300" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g id="g3"> + <g id="g4"> + <rect class="r5" x="360" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect class="r5" x="420" y="0" height="50" width="50" fill="blue"></rect> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf145896.svg b/svgio/qa/cppunit/data/tdf145896.svg new file mode 100644 index 0000000000..d434a961b9 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf145896.svg @@ -0,0 +1,12 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 300 300"> + + <style id="style2"> + .st0{fill:yellow;}.st1{fill:green;} + </style> + <style type="text/some-unknown-styling-language"> + .st2{fill:red;} + </style> + <rect x="0" y="0" height="50" width="50" class="st0" fill="blue"></rect> + <rect x="60" y="0" height="50" width="50" class="st1" fill="blue"></rect> + <rect x="120" y="0" height="50" width="50" class="st2" fill="blue"></rect> +</svg> diff --git a/svgio/qa/cppunit/data/tdf149673.svg b/svgio/qa/cppunit/data/tdf149673.svg new file mode 100644 index 0000000000..f73b9959d3 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf149673.svg @@ -0,0 +1,7 @@ +<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> + <g id="g1" opacity=".1"> + <circle id="circle1" cx="100" cy="60" fill="#f00" r="40"/> + <circle id="circle2" cx="70" cy="100" fill="#0f0" r="40"/> + <circle id="circle3" cx="130" cy="100" fill="#00f" r="40"/> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf149880.svg b/svgio/qa/cppunit/data/tdf149880.svg new file mode 100644 index 0000000000..08ba748487 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf149880.svg @@ -0,0 +1,11 @@ +<?xml version="1.0" standalone="no"?> +<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1"> + <defs> + <pattern id="Pattern" x=".05" y=".05" width=".25" height=".25"> + <rect x="0" y="0" width="50" height="50" fill="skyblue"/> + </pattern> + + </defs> + + <rect fill='url("#Pattern")' stroke="black" x="0" y="0" width="200" height="200"/> +</svg> diff --git a/svgio/qa/cppunit/data/tdf149893.svg b/svgio/qa/cppunit/data/tdf149893.svg new file mode 100644 index 0000000000..b6b241566d --- /dev/null +++ b/svgio/qa/cppunit/data/tdf149893.svg @@ -0,0 +1,3 @@ +<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"> + <rect x="0" y="0" width="100%" height="100%" fill=" GREEN"></rect> +</svg> diff --git a/svgio/qa/cppunit/data/tdf150124.svg b/svgio/qa/cppunit/data/tdf150124.svg new file mode 100644 index 0000000000..29b2a1e3fd --- /dev/null +++ b/svgio/qa/cppunit/data/tdf150124.svg @@ -0,0 +1,12 @@ +<svg id="svg-root" width="100%" height="100%" + viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <invented> + <rect id='r1' x='0' y='0' width='50' height='50' fill='red'/> + <g> + <rect id='r2' x='60' y='0' width='50' height='50' fill='green'/> + </g> + <circle id="myCircle" cx="50" cy="50" r="40" stroke="blue" /> + </invented> + <use href="myCircle" x="20" fill="white" stroke="red" /> +</svg> diff --git a/svgio/qa/cppunit/data/tdf151103.svg b/svgio/qa/cppunit/data/tdf151103.svg new file mode 100644 index 0000000000..664253f8df --- /dev/null +++ b/svgio/qa/cppunit/data/tdf151103.svg @@ -0,0 +1,18 @@ +<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> + <text text-anchor="start" x="60" y="40">ABC</text> + <text text-anchor="middle" x="60" y="50">ABC</text> + <text text-anchor="end" x="60" y="60">ABC</text> + + <text><tspan text-anchor="start" x="60" y="40">ABC</tspan></text> + <text><tspan text-anchor="middle" x="60" y="50">ABC</tspan></text> + <text><tspan text-anchor="end" x="60" y="60">ABC</tspan></text> + + <text text-anchor="start" x="60" y="40"><tspan>ABC</tspan></text> + <text text-anchor="middle" x="60" y="50"><tspan>ABC</tspan></text> + <text text-anchor="end" x="60" y="60"><tspan>ABC</tspan></text> + + <text text-anchor="start" x="60" y="40">A<tspan>B</tspan>C</text> + <text text-anchor="middle" x="60" y="50">A<tspan>B</tspan>C</text> + <text text-anchor="end" x="60" y="60">A<tspan>B</tspan>C</text> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf155733.svg b/svgio/qa/cppunit/data/tdf155733.svg new file mode 100644 index 0000000000..db04ba9afd --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155733.svg @@ -0,0 +1,20 @@ +<svg + width="100%" + height="100%" + viewBox="0 0 150 500" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs> + <g id="circles"> + <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> + </g> + </defs> + + <filter id="myFilter"> + <feGaussianBlur in="SourceGraphic" stdDeviation="5"/> + </filter> + + <use href="#circles" transform="translate(0 50)" filter="url(#myFilter)" /> + <use href="#circles" transform="translate(0 100)"/> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf155814.svg b/svgio/qa/cppunit/data/tdf155814.svg new file mode 100644 index 0000000000..5ac2e82973 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155814.svg @@ -0,0 +1,25 @@ +<svg + width="100%" + height="100%" + viewBox="0 0 150 500" + preserveAspectRatio="xMidYMid meet" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <!-- ref --> + <defs> + <g id="circles"> + <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> + </g> + </defs> + <clipPath id="myClip"> + <!-- + Everything outside the circle will be + clipped and therefore invisible. + --> + <circle r="35" /> + </clipPath> + + <use xlink:href="#circles" transform="translate(0 50)" clip-path="url(#myClip)" /> + <use xlink:href="#circles" transform="translate(0 100)" /> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf155819.svg b/svgio/qa/cppunit/data/tdf155819.svg new file mode 100644 index 0000000000..30c2da4d1a --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155819.svg @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"> + <style> + path { + fill: none; + stroke-width: 4px; + marker: url(#diamond); + } + </style> + <path d="M 10,50 v -20 h 40 v -20" stroke="red"/> + <marker id="diamond" markerWidth="12" markerHeight="12" refX="6" refY="6" markerUnits="userSpaceOnUse"> + <circle cx="6" cy="6" r="3" + fill="white" stroke="context-stroke" stroke-width="2"/> + </marker> +</svg> diff --git a/svgio/qa/cppunit/data/tdf155833.svg b/svgio/qa/cppunit/data/tdf155833.svg new file mode 100644 index 0000000000..8cc908424a --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155833.svg @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="32.677876mm" + height="32.677876mm" + viewBox="0 0 32.677876 32.677876" + version="1.1" + id="svg1126" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <g + id="layer1" + transform="translate(-80.317197,-107.43993)"> + <g + id="g18033" + transform="matrix(0.35277777,0,0,-0.35277777,71.799819,211.06676)"> + <g + id="g18041" + transform="matrix(92.88,0,0,92.88,24.14375,201.11516)"> + <image + width="1" + height="1" + transform="matrix(1,0,0,-1,0,1)" + xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAACBCAYAAADnoNlQAAAABHNCSVQICAgIfAhkiAAAAUJJREFUeJzt3EENAkEQRcG3aMAjMpYzBgjqSDCyWJhbZ5IqBf/w0sc+6rzaxnN6wLpzesC62/QA5okAESACEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAiojvv12+at7aPP9IRlO211CRABIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAdVzvtnlr22t6wLrnd3rBOpcAESACEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBFR/ALUM7y9VYLsAAAAASUVORK5CYII=" + id="image18043" /> + </g> + </g> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf155932.svg b/svgio/qa/cppunit/data/tdf155932.svg new file mode 100644 index 0000000000..b533eda3cd --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155932.svg @@ -0,0 +1,22 @@ +<svg + width="100%" + height="100%" + viewBox="0 0 150 500" + preserveAspectRatio="xMidYMid meet" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <!-- ref --> + <defs> + <g id="circles"> + <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> + </g> + </defs> + <clipPath id="myClip"> + <circle r="35" /> + </clipPath> + + <g clip-path="url(#myClip)"> + <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> + </g> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf156018.svg b/svgio/qa/cppunit/data/tdf156018.svg new file mode 100644 index 0000000000..cff3f924a5 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156018.svg @@ -0,0 +1,11 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 300 300"> + + <style id="style2"> + g rect {fill:green;} + </style> + + <g> + <rect x="00" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="60" y="0" height="50" width="50" fill="blue"></rect> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156034.svg b/svgio/qa/cppunit/data/tdf156034.svg new file mode 100644 index 0000000000..1cd3a82b78 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156034.svg @@ -0,0 +1,34 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 800 800"> + + <style> + .g1 rect {fill:green;} + #g3 rect {fill:green;} + .g4 #r1 {fill:green;} + #g3 .r5 {fill:green;} + </style> + + <g class="g4 g1"> + <g class="g2"> + <rect x="0" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="60" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g id="g3"> + <g id="g4"> + <rect x="120" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="180" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g class="g4 g1"> + <g> + <rect id="r1" x="240" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect id="r1" x="300" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g id="g3"> + <g id="g4"> + <rect class="r5" x="360" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect class="r5" x="420" y="0" height="50" width="50" fill="blue"></rect> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156038.svg b/svgio/qa/cppunit/data/tdf156038.svg new file mode 100644 index 0000000000..9835453e7f --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156038.svg @@ -0,0 +1,34 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 800 800"> + + <style> + .g1 > rect {fill:green;} + #g3 > rect {fill:green;} + .g4 > #r1 {fill:green;} + #g3 > .r5 {fill:green;} + </style> + + <g class="g4 g1"> + <g class="g2"> + <rect x="0" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="60" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g id="g3"> + <g id="g4"> + <rect x="120" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect x="180" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g class="g4 g1"> + <g> + <rect id="r1" x="240" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect id="r1" x="300" y="0" height="50" width="50" fill="blue"></rect> + </g> + <g id="g3"> + <g id="g4"> + <rect class="r5" x="360" y="0" height="50" width="50" fill="blue"></rect> + </g> + <rect class="r5" x="420" y="0" height="50" width="50" fill="blue"></rect> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156167.svg b/svgio/qa/cppunit/data/tdf156167.svg new file mode 100644 index 0000000000..034f86563d --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156167.svg @@ -0,0 +1,18 @@ +<svg id="svg-root" width="100%" height="100%" + viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <g id="test-body-content" font-family="DejaVu Sans" font-size="18"> + + <g fill="orange"> + <circle id="a" FiLl="red" cx="140" cy="100" r="50"/> + </g> + <circle id="b" fill="red" style="FiLl: oRaNgE" cx="340" cy="100" r="50"/> + <circle id="c" fill="blue" cx="140" cy="220" r="50"/> + + <style type="text/css"> + #c {fill: red } + #c {FiLl: oRaNgE } + </style> + + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156168.svg b/svgio/qa/cppunit/data/tdf156168.svg new file mode 100644 index 0000000000..352de2be31 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156168.svg @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<svg version="1.2" baseProfile="tiny" + width="100%" height="100%" viewBox="0 0 200 500" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + style="font-family: 'DejaVu Serif'; + font-size:large" > +<title>stroke enabled</title> + + <style type="text/css"> + #MyRed { + fill: red; + } + #MyBlue { + fill: blue; + } + .MyLime { + stroke: lime; + stroke-width: 5; + } + </style> + +<g id="MyBlue"> +<rect x="10" y="0" height="50" width="50"></rect> +<rect x="10" y="60" height="50" width="50" class="MyLime"></rect> +<rect id="MyRed" x="10" y="120" height="50" width="50"></rect> +<rect id="MyRed" x="10" y="180" height="50" width="50" class="MyLime"></rect> +</g> +<rect x="10" y="240" height="50" width="50"></rect> +<rect x="10" y="300" height="50" width="50" class="MyLime"></rect> +<rect id="MyRed" x="10" y="360" height="50" width="50"></rect> +<rect id="MyRed" x="10" y="420" height="50" width="50" class="MyLime"></rect> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156201.svg b/svgio/qa/cppunit/data/tdf156201.svg new file mode 100644 index 0000000000..3000e17f45 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156201.svg @@ -0,0 +1,36 @@ +<svg style="width: 100%; height: 100%;" height="492pt" version="1.1" viewBox="0 0 500 492" width="500pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <g id="PathCollection_1"> + <defs> + <path d=" +M52.0418 -266.565 +L54.1695 -266.795 +L54.1955 -266.832 +L54.2469 -266.844 +L56.3492 -268.627 +L57.4099 -268.849 +L59.524 -270.389 +L60.4641 -271.625 +L62.5433 -273.716 +L62.8642 -275.66 +L63.198 -277.417 +L62.6856 -278.465 +L60.8035 -281.602 +L60.4975 -281.91 +L59.9992 -282.386 +L57.6251 -284.681 +L56.2525 -285.174 +L54.6591 -286.742 +L54.5155 -286.797 +L52.0418 -279.184 +L52.0418 -270.892" id="C0_0_32ce96eee2"></path> + </defs> + <g clip-path="url(#p65124e5d4c)"> + <use style="fill:#2f3ba1;" x="0.0" xlink:href="#C0_0_32ce96eee2" y="492.3555"></use> + </g> + </g> + <defs> + <clipPath id="p65124e5d4c"> + <rect height="446.4" width="446.4" x="38.27125" y="23.14175"></rect> + </clipPath> + </defs> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156236.svg b/svgio/qa/cppunit/data/tdf156236.svg new file mode 100644 index 0000000000..12268652c0 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156236.svg @@ -0,0 +1,7 @@ +<svg viewBox="0 0 500 200" xmlns="http://www.w3.org/2000/svg"> + <rect x="20" y="120" width="60" height="60" rx="0" ry="15" /> + <rect x="120" y="120" width="60" height="60" ry="15" /> + <rect x="220" y="120" width="60" height="60" rx="-150" ry="15" /> + <rect x="320" y="120" width="60" height="60" rx="150" ry="15" /> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf156251.svg b/svgio/qa/cppunit/data/tdf156251.svg new file mode 100644 index 0000000000..201a0aa69e --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156251.svg @@ -0,0 +1,17 @@ +<svg viewBox="0 0 240 70" xmlns="http://www.w3.org/2000/svg"> + <style> + tspan { + fill: red; + } + </style> + + <text x="10" y="30" class="small"> + You are + <tspan>not</tspan> + a banana! + </text> + <text x="10" y="60" class="small"> + You are<tspan> not </tspan>a banana! + </text> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf156269.svg b/svgio/qa/cppunit/data/tdf156269.svg new file mode 100644 index 0000000000..e840b351d1 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156269.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <!-- Some reference text --> + <text x="10%" y="50%" fill="grey">one</text> + + <!-- The same text with a shift --> + <text dx="50%" dy="50%" x="10%" y="50%">two</text> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf156271.svg b/svgio/qa/cppunit/data/tdf156271.svg new file mode 100644 index 0000000000..ff0267f35c --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156271.svg @@ -0,0 +1,6 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <text x="40 10" y="10">AB</text> + <text x="10 10" dx="30" y="20">AB</text> + <text x="0 0" dx="40 10" y="30">AB</text> + <text x="10" dx="30 0" y="40">AB</text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156283.svg b/svgio/qa/cppunit/data/tdf156283.svg new file mode 100644 index 0000000000..ee8c46ef5c --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156283.svg @@ -0,0 +1,4 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <text x="30 71" y="20">ABC</text> + <text x="0" dx="30 29" y="30">ABC</text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156569.svg b/svgio/qa/cppunit/data/tdf156569.svg new file mode 100644 index 0000000000..ea9b3f513a --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156569.svg @@ -0,0 +1,4 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <text x="0,40,80" y="20%">ABC</text> + <text x="0 40% 80%" y="30%">ABC</text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156577.svg b/svgio/qa/cppunit/data/tdf156577.svg new file mode 100644 index 0000000000..de12f36667 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156577.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <text x="30" y="20"> + <tspan x="30" y="20">ABC</tspan> + </text> + <text x="30" y="30"> + <tspan x="30" y="30" dx="0 10 20 30 40">ABC</tspan> + </text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156616.svg b/svgio/qa/cppunit/data/tdf156616.svg new file mode 100644 index 0000000000..6b3bb3c6c6 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156616.svg @@ -0,0 +1,29 @@ +<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"> + <text + style="text-anchor:start" + x="114" + y="103"><tspan + x="114" + y="103"><tspan>First </tspan>line </tspan><tspan + x="114" + y="122">Second line</tspan> + </text> + <text + style="text-anchor:middle" + x="114" + y="153"><tspan + x="114" + y="153"><tspan>First </tspan>line </tspan><tspan + x="114" + y="172">Second line</tspan> + </text> + <text + style="text-anchor:end" + x="114" + y="203"><tspan + x="114" + y="203"><tspan>First </tspan>line </tspan><tspan + x="114" + y="222">Second line</tspan> + </text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156777.svg b/svgio/qa/cppunit/data/tdf156777.svg new file mode 100644 index 0000000000..9ce1dd8cd3 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156777.svg @@ -0,0 +1,14 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <path + id="path1" + fill="none" + stroke="red" + d="M10,90 Q90,90 90,45 Q90,10 50,10 Q10,10 10,40 Q10,70 45,70 Q70,70 75,50" /> + + <text> + <textPath href="#path1" startOffset="40%" style="fill:green"> + Quick brown fox jumps over the lazy dog. + </textPath> + </text> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf156834.svg b/svgio/qa/cppunit/data/tdf156834.svg new file mode 100644 index 0000000000..74dc154818 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156834.svg @@ -0,0 +1,7 @@ +<svg viewBox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> + <path d="M20,20 L180,20 M20,50 L180,50 M20,80 L180,80" stroke="grey" /> + + <text dominant-baseline="auto" x="30" y="20" font-size="20">Auto</text> + <text dominant-baseline="middle" x="30" y="50" font-size="20">Middle</text> + <text dominant-baseline="Hanging" x="30" y="80" font-size="20">Hanging</text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf156837.svg b/svgio/qa/cppunit/data/tdf156837.svg new file mode 100644 index 0000000000..f04cb015d3 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156837.svg @@ -0,0 +1,13 @@ +<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"> + +<defs><style type="text/css"> +.super{ + font-size: 65%; +} +</style></defs> + + <text> + <tspan x="114" y="103">x </tspan> + <tspan class="super" baseline-shift="super">3</tspan> + </text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf45771.svg b/svgio/qa/cppunit/data/tdf45771.svg new file mode 100644 index 0000000000..f49e0f5691 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf45771.svg @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg height="600" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + +<text x="5" y="100" font-size="2em">Sample</text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf79163.svg b/svgio/qa/cppunit/data/tdf79163.svg new file mode 100644 index 0000000000..0153037236 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf79163.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <rect x="50" y="50" height="110" width="110"
+ style="fill: #ccccff" opacity="0.5"
+ >
+ </rect>
+</svg>
diff --git a/svgio/qa/cppunit/data/tdf85770.svg b/svgio/qa/cppunit/data/tdf85770.svg new file mode 100644 index 0000000000..b1cf9eb3c2 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf85770.svg @@ -0,0 +1,7 @@ +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + width="13cm" height="11cm"> +<text x="5" y="35" font-size="x-small">Start Middle End</text> +<text x="5" y="65" font-size="x-small">Start <tspan visibility="hidden">Middle</tspan> End</text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf86938.svg b/svgio/qa/cppunit/data/tdf86938.svg new file mode 100644 index 0000000000..40287a39de --- /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> diff --git a/svgio/qa/cppunit/data/tdf87309.svg b/svgio/qa/cppunit/data/tdf87309.svg new file mode 100644 index 0000000000..af8a7df254 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf87309.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <rect x="10" y="10" width="100" height="100" fill="currentColor"/> +</svg>
\ No newline at end of file diff --git a/svgio/qa/cppunit/data/tdf93583.svg b/svgio/qa/cppunit/data/tdf93583.svg new file mode 100644 index 0000000000..13e63e677f --- /dev/null +++ b/svgio/qa/cppunit/data/tdf93583.svg @@ -0,0 +1,7 @@ +<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"> + <text + style="text-anchor:end" + x="214" + y="303"><tspan>This is the<tspan style="font-size:200%"> first </tspan>line</tspan> + </text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf94765.svg b/svgio/qa/cppunit/data/tdf94765.svg new file mode 100644 index 0000000000..009bfc8ed1 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf94765.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="841.9px" height="595.3px" viewBox="0 0 841.9 595.3" style="enable-background:new 0 0 841.9 595.3;" xml:space="preserve"
+ >
+<style type="text/css">
+ .st1{fill:url(#SVGID_1_);stroke:#000000;stroke-miterlimit:10;}
+</style>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="432.1587" y1="340.3492" x2="770.254" y2="340.3492">
+ <stop offset="0" style="stop-color:#DBDBDB"/>
+ <stop offset="1" style="stop-color:#737373"/>
+</linearGradient>
+<rect x="70.3" y="48.3" fill="url(#SVGID_1_)" width="338.1" height="252.4"/>
+<rect x="432.2" y="214.2" class="st1" width="338.1" height="252.4"/>
+</svg>
diff --git a/svgio/qa/cppunit/data/tdf95400.svg b/svgio/qa/cppunit/data/tdf95400.svg new file mode 100644 index 0000000000..378100a212 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf95400.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 150 100" xmlns="http://www.w3.org/2000/svg"> + <text x="30" y="20" textLength="102" lengthAdjust="spacing"> + ABC + </text> + <text x="30" y="30" textLength="102" lengthAdjust="spacingAndGlyphs"> + ABC + </text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf97542_1.svg b/svgio/qa/cppunit/data/tdf97542_1.svg new file mode 100644 index 0000000000..7ade92dd94 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97542_1.svg @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<svg width="200" height="50" xmlns="http://www.w3.org/2000/svg"> + <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ --> + <defs> + <radialGradient id="svg_2" cx="0.5" cy="0.5" r="0.5"> + <stop offset="0" stop-color="#ff0000"/> + <stop offset="1" stop-color="#000000"/> + </radialGradient> + </defs> + <g fill="url(#svg_2)" > + <title>Layer 1</title> + <rect id="svg_1" height="50" width="200" y="0" x="0"/> + <text x="50" y="40" id="svg_12" font-size="48" font-family="DejaVu Serif" fill="#ffff00">Text</text> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf97542_2.svg b/svgio/qa/cppunit/data/tdf97542_2.svg new file mode 100644 index 0000000000..4a4c7e1276 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97542_2.svg @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<svg width="200" height="50" xmlns="http://www.w3.org/2000/svg"> + <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ --> + <defs> + <radialGradient id="svg_2" cx="1" cy="1" r="3"> + <stop offset="0" stop-color="#ff0000"/> + <stop offset="1" stop-color="#000000"/> + </radialGradient> + </defs> + <g fill="#ffff00"> + <title>Layer 1</title> + <rect id="svg_1" height="50" width="200" y="0" x="0" /> + <text x="50" y="40" id="svg_12" font-size="48" font-family="DejaVu Serif" fill="url(#svg_2)">Text</text> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/tdf97543.svg b/svgio/qa/cppunit/data/tdf97543.svg new file mode 100644 index 0000000000..fa30b22447 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97543.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect x="10" y="10" width="100" height="100" rx="10" ry="10" fill="#00cc00" visibility="inherit" />
+</svg>
diff --git a/svgio/qa/cppunit/data/tdf97710.svg b/svgio/qa/cppunit/data/tdf97710.svg new file mode 100644 index 0000000000..bbd9a91a9b --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97710.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> + <!-- Example of a polyline with the default fill --> + <polyline points="0,100 50,25 50,75 100,0" /> + + <!-- Example of the same polyline shape with stroke and no fill --> + <polyline points="100,100 150,25 150,75 200,0" fill="green" stroke="black" /> +</svg> + diff --git a/svgio/qa/cppunit/data/tdf97717.svg b/svgio/qa/cppunit/data/tdf97717.svg new file mode 100644 index 0000000000..c354e44168 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97717.svg @@ -0,0 +1,11 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 300 300"> + + <g opacity="0.5"> + <rect x="0" y="0" height="50" width="50" + style="fill: #ccccff"> + </rect> + </g> + <rect x="60" y="0" height="50" width="50" + style="fill: #ccccff" opacity="0.5"> + </rect> +</svg> diff --git a/svgio/qa/cppunit/data/tdf97936.svg b/svgio/qa/cppunit/data/tdf97936.svg new file mode 100644 index 0000000000..6c059ec5db --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97936.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> +<rect x="70" y="50" height="50" width="50" style="fill: #ccccff"></rect> +<rect x="10" y="50" height="50" width="50" style="fill: #ccccff"></rect> +</svg> diff --git a/svgio/qa/cppunit/data/tdf97941.svg b/svgio/qa/cppunit/data/tdf97941.svg new file mode 100644 index 0000000000..cfe1ca8c47 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97941.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg height="600" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + +<text x="5" y="100"> + <tspan font-size="3em">Sample</tspan></text> +</svg> diff --git a/svgio/qa/cppunit/data/tdf99115.svg b/svgio/qa/cppunit/data/tdf99115.svg new file mode 100644 index 0000000000..6d4b5e9c1b --- /dev/null +++ b/svgio/qa/cppunit/data/tdf99115.svg @@ -0,0 +1,40 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="200 px" height="100 px"> +<style type="text/css" id="style1"> +* {font-size:18px;} +#tspan6 {fill:blue} +.c1 {fill:green} +.c2 {fill:red} +#tspan8 {fill:green} +#text9 {fill:green} +</style> +<text id="text1" style="" x="1" y="20" > + <tspan id="tspan1" fill="red">red 1</tspan> +</text> +<text id="text2" style="fill:red" x="1" y="40" > + <tspan id="tspan2">red 2</tspan> +</text> +<text id="text3" style="" x="1" y="60" > + <tspan id="tspan3" style="fill:red">red 3</tspan> +</text> + +<text id="text4" style="fill:red" x="60" y="20" > + <tspan id="tspan4" fill="blue">blue 4</tspan> +</text> +<text id="text5" x="60" y="40" > + <tspan id="tspan5" style="fill:blue" fill="red">blue 5</tspan> +</text> +<text id="text6" style="fill:red" x="60" y="60" > + <tspan id="tspan6">blue 6</tspan> +</text> + +<text id="text7" x="130" y="20" > + <tspan id="tspan7" class="c1" fill="blue">green 7</tspan> +</text> +<text id="text8" x="130" y="40" > + <tspan id="tspan8" class="c2" fill="red">green 8</tspan> +</text> +<text id="text9" x="130" y="60" class="c2"> + <tspan id="tspan9">green 9</tspan> +</text> + +</svg> diff --git a/svgio/qa/cppunit/data/tdf99994.svg b/svgio/qa/cppunit/data/tdf99994.svg new file mode 100644 index 0000000000..b948338c14 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf99994.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<style type="text/css" id="style1"> +*{fill:blue;} +</style> +<text id="text1" style="font-family:DejaVu Sans;"> + <tspan id="tspan1">test</tspan> +</text> +</svg> diff --git a/svgio/qa/cppunit/data/textXmlSpace.svg b/svgio/qa/cppunit/data/textXmlSpace.svg new file mode 100644 index 0000000000..fe1bc8ceeb --- /dev/null +++ b/svgio/qa/cppunit/data/textXmlSpace.svg @@ -0,0 +1,16 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" + viewBox="0 0 250 250"> + <text y="10" xml:space="default"> a b </text> + <text y="30" xml:space="default">a b</text> + <text y="50" xml:space="default">a + b</text> + <text y="70" xml:space="default">a +b</text> + <text y="90" xml:space="preserve"> a b </text> + <text y="110" xml:space="preserve">a b</text> + <text y="130" xml:space="preserve">a + b</text> + <text y="150" xml:space="preserve">a +b</text> +</svg> + diff --git a/svgio/qa/cppunit/data/tspan-fill-opacity.svg b/svgio/qa/cppunit/data/tspan-fill-opacity.svg new file mode 100644 index 0000000000..0fe6a1cd8d --- /dev/null +++ b/svgio/qa/cppunit/data/tspan-fill-opacity.svg @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg version="1.2" width="210mm" height="297mm" viewBox="0 0 21000 29700" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xml:space="preserve"> + <g class="ClosedBezierShape"> + <rect stroke="none" fill="none" x="9737" y="6537" width="7527" height="3527"/> + <g style="opacity: 0.30"> + <path fill="none" stroke="rgb(255,0,0)" stroke-width="25" stroke-linejoin="round" d="M 9875,6550 C 9806,6550 9750,6606 9750,6675 L 9750,9925 C 9750,9994 9806,10050 9875,10050 L 17125,10050 C 17194,10050 17250,9994 17250,9925 L 17250,6675 C 17250,6606 17194,6550 17125,6550 L 17000,6550 9875,6550 Z"/> + </g> + </g> + <g class="TextShape"> + <rect stroke="none" fill="none" x="9825" y="6550" width="4076" height="955"/> + <text> + <tspan x="9825" y="7939" font-family="DejaVu Sans" font-size="800px" fill-opacity="0.30" fill="rgb(255,0,0)" stroke="none">hello</tspan> + </text> + </g> +</svg> |