diff options
-rw-r--r-- | drawinglayer/Library_drawinglayer.mk | 1 | ||||
-rw-r--r-- | drawinglayer/source/tools/primitive2dxmldump.cxx (renamed from test/source/primitive2dxmldump.cxx) | 116 | ||||
-rw-r--r-- | emfio/qa/cppunit/emf/EmfImportTest.cxx | 10 | ||||
-rw-r--r-- | include/drawinglayer/tools/primitive2dxmldump.hxx | 52 | ||||
-rw-r--r-- | include/test/primitive2dxmldump.hxx | 43 | ||||
-rw-r--r-- | include/tools/XmlWriter.hxx | 1 | ||||
-rw-r--r-- | solenv/clang-format/blacklist | 4 | ||||
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 134 | ||||
-rw-r--r-- | test/Library_test.mk | 1 | ||||
-rw-r--r-- | tools/source/xml/XmlWriter.cxx | 5 |
10 files changed, 223 insertions, 144 deletions
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 26b6a9c37ba4..e6ffa9c7af00 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -173,6 +173,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/tools/emfpstringformat \ drawinglayer/source/tools/emfpcustomlinecap \ drawinglayer/source/tools/wmfemfhelper \ + drawinglayer/source/tools/primitive2dxmldump \ drawinglayer/source/drawinglayeruno/drawinglayeruno \ drawinglayer/source/drawinglayeruno/xprimitive2drenderer \ drawinglayer/source/texture/texture \ diff --git a/test/source/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index ee1f34eda697..c5d66771343f 100644 --- a/test/source/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -7,13 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <test/primitive2dxmldump.hxx> -#include <test/xmltesttools.hxx> -#include <tools/XmlWriter.hxx> +#include <drawinglayer/tools/primitive2dxmldump.hxx> #include <vcl/metaact.hxx> #include <rtl/string.hxx> #include <rtl/strbuf.hxx> +#include <tools/stream.hxx> +#include <tools/XmlWriter.hxx> #include <memory> @@ -37,6 +37,9 @@ using namespace drawinglayer::primitive2d; +namespace drawinglayer::tools +{ + namespace { @@ -48,28 +51,79 @@ OUString convertColorToString(const basegfx::BColor& rColor) return "#" + aRGBString; } -} // anonymous namespace +void writePolyPolygon(::tools::XmlWriter& rWriter, const basegfx::B2DPolyPolygon& rB2DPolyPolygon) +{ + rWriter.startElement("polypolygon"); + const basegfx::B2DRange aB2DRange(rB2DPolyPolygon.getB2DRange()); + rWriter.attributeDouble("height", aB2DRange.getHeight()); + rWriter.attributeDouble("width", aB2DRange.getWidth()); + rWriter.attributeDouble("minx", aB2DRange.getMinX()); + rWriter.attributeDouble("miny", aB2DRange.getMinY()); + rWriter.attributeDouble("maxx", aB2DRange.getMaxX()); + rWriter.attributeDouble("maxy", aB2DRange.getMaxY()); + rWriter.attribute("path", basegfx::utils::exportToSvgD(rB2DPolyPolygon, true, true, false)); + + for (basegfx::B2DPolygon const & rPolygon : rB2DPolyPolygon) + { + rWriter.startElement("polygon"); + for (sal_uInt32 i = 0; i <rPolygon.count(); ++i) + { + basegfx::B2DPoint const & rPoint = rPolygon.getB2DPoint(i); + + rWriter.startElement("point"); + rWriter.attribute("x", OUString::number(rPoint.getX())); + rWriter.attribute("y", OUString::number(rPoint.getY())); + rWriter.endElement(); + } + rWriter.endElement(); + } + + rWriter.endElement(); +} + +} // end anonymous namespace Primitive2dXmlDump::Primitive2dXmlDump() : maFilter(constMaxActionType, false) {} -Primitive2dXmlDump::~Primitive2dXmlDump() -{} +Primitive2dXmlDump::~Primitive2dXmlDump() = default; + +void Primitive2dXmlDump::dump( + const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, + const OUString& rStreamName) +{ + std::unique_ptr<SvStream> pStream; + + if (rStreamName.isEmpty()) + pStream.reset(new SvMemoryStream()); + else + pStream.reset(new SvFileStream(rStreamName, StreamMode::STD_READWRITE | StreamMode::TRUNC)); + + ::tools::XmlWriter aWriter(pStream.get()); + aWriter.startDocument(); + aWriter.startElement("primitive2D"); + + decomposeAndWrite(rPrimitive2DSequence, aWriter); + aWriter.endElement(); + aWriter.endDocument(); + + pStream->Seek(STREAM_SEEK_TO_BEGIN); +} xmlDocPtr Primitive2dXmlDump::dumpAndParse( const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, - const OUString& rTempStreamName) + const OUString& rStreamName) { std::unique_ptr<SvStream> pStream; - if (rTempStreamName.isEmpty()) + if (rStreamName.isEmpty()) pStream.reset(new SvMemoryStream()); else - pStream.reset(new SvFileStream(rTempStreamName, StreamMode::STD_READWRITE | StreamMode::TRUNC)); + pStream.reset(new SvFileStream(rStreamName, StreamMode::STD_READWRITE | StreamMode::TRUNC)); - tools::XmlWriter aWriter(pStream.get()); + ::tools::XmlWriter aWriter(pStream.get()); aWriter.startDocument(); aWriter.startElement("primitive2D"); @@ -80,14 +134,19 @@ xmlDocPtr Primitive2dXmlDump::dumpAndParse( pStream->Seek(STREAM_SEEK_TO_BEGIN); - xmlDocPtr pDoc = XmlTestTools::parseXmlStream(pStream.get()); + std::size_t nSize = pStream->remainingSize(); + std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); + pStream->ReadBytes(pBuffer.get(), nSize); + pBuffer[nSize] = 0; + + xmlDocPtr pDoc = xmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get())); return pDoc; } void Primitive2dXmlDump::decomposeAndWrite( const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, - tools::XmlWriter& rWriter) + ::tools::XmlWriter& rWriter) { for (size_t i = 0; i < rPrimitive2DSequence.size(); i++) { @@ -116,6 +175,18 @@ void Primitive2dXmlDump::decomposeAndWrite( { const TransformPrimitive2D& rTransformPrimitive2D = dynamic_cast<const TransformPrimitive2D&>(*pBasePrimitive); rWriter.startElement("transform"); + + basegfx::B2DHomMatrix const & rMatrix = rTransformPrimitive2D.getTransformation(); + rWriter.attributeDouble("xy11", rMatrix.get(0,0)); + rWriter.attributeDouble("xy12", rMatrix.get(0,1)); + rWriter.attributeDouble("xy13", rMatrix.get(0,2)); + rWriter.attributeDouble("xy21", rMatrix.get(1,0)); + rWriter.attributeDouble("xy22", rMatrix.get(1,1)); + rWriter.attributeDouble("xy23", rMatrix.get(1,2)); + rWriter.attributeDouble("xy31", rMatrix.get(2,0)); + rWriter.attributeDouble("xy32", rMatrix.get(2,1)); + rWriter.attributeDouble("xy33", rMatrix.get(2,2)); + decomposeAndWrite(rTransformPrimitive2D.getChildren(), rWriter); rWriter.endElement(); } @@ -127,17 +198,10 @@ void Primitive2dXmlDump::decomposeAndWrite( rWriter.startElement("polypolygoncolor"); rWriter.attribute("color", convertColorToString(rPolyPolygonColorPrimitive2D.getBColor())); + const basegfx::B2DPolyPolygon& aB2DPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon()); - const basegfx::B2DRange aB2DRange(aB2DPolyPolygon.getB2DRange()); - rWriter.attribute("height", aB2DRange.getHeight()); - rWriter.attribute("width", aB2DRange.getWidth()); - rWriter.attribute("minx", aB2DRange.getMinX()); - rWriter.attribute("miny", aB2DRange.getMinY()); - rWriter.attribute("maxx", aB2DRange.getMaxX()); - rWriter.attribute("maxy", aB2DRange.getMaxY()); - rWriter.startElement("polypolygon"); - rWriter.content(basegfx::utils::exportToSvgD(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon(), true, true, false)); - rWriter.endElement(); + writePolyPolygon(rWriter, aB2DPolyPolygon); + rWriter.endElement(); } break; @@ -157,9 +221,7 @@ void Primitive2dXmlDump::decomposeAndWrite( //getStrokeAttribute() - rWriter.startElement("polypolygon"); - rWriter.content(basegfx::utils::exportToSvgD(rPolyPolygonStrokePrimitive2D.getB2DPolyPolygon(), true, true, false)); - rWriter.endElement(); + writePolyPolygon(rWriter, rPolyPolygonStrokePrimitive2D.getB2DPolyPolygon()); rWriter.endElement(); } @@ -207,7 +269,7 @@ void Primitive2dXmlDump::decomposeAndWrite( { const MaskPrimitive2D& rMaskPrimitive2D = dynamic_cast<const MaskPrimitive2D&>(*pBasePrimitive); rWriter.startElement("mask"); - + writePolyPolygon(rWriter, rMaskPrimitive2D.getMask()); decomposeAndWrite(rMaskPrimitive2D.getChildren(), rWriter); rWriter.endElement(); } @@ -271,4 +333,6 @@ void Primitive2dXmlDump::decomposeAndWrite( } } +} // end namespace drawinglayer::tools + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 88cd0ea65925..30add1aec73f 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -10,7 +10,6 @@ #include <sal/config.h> #include <test/bootstrapfixture.hxx> -#include <test/primitive2dxmldump.hxx> #include <test/xmltesttools.hxx> #include <comphelper/seqstream.hxx> @@ -21,6 +20,7 @@ #include <com/sun/star/graphic/XPrimitive2D.hpp> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/tools/primitive2dxmldump.hxx> #include <memory> @@ -75,7 +75,7 @@ Primitive2DSequence Test::parseEmf(const OUString& aSource) void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) { - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); CPPUNIT_ASSERT (pDocument); @@ -101,7 +101,7 @@ void Test::TestDrawString() // first, get the sequence of primitives and dump it Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawString.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); @@ -121,7 +121,7 @@ void Test::TestDrawStringTransparent() // first, get the sequence of primitives and dump it Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); @@ -143,7 +143,7 @@ void Test::TestDrawLine() // first, get the sequence of primitives and dump it Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawLine.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); diff --git a/include/drawinglayer/tools/primitive2dxmldump.hxx b/include/drawinglayer/tools/primitive2dxmldump.hxx new file mode 100644 index 000000000000..3158f537262e --- /dev/null +++ b/include/drawinglayer/tools/primitive2dxmldump.hxx @@ -0,0 +1,52 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_DRAWINGLAYER_TOOLS_PRIMITIVE2DXMLDUMP_HXX +#define INCLUDED_DRAWINGLAYER_TOOLS_PRIMITIVE2DXMLDUMP_HXX + +#include <sal/config.h> +#include <drawinglayer/drawinglayerdllapi.h> +#include <libxml/tree.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <vector> + +namespace tools { class XmlWriter; } + +namespace drawinglayer::tools +{ + +class DRAWINGLAYER_DLLPUBLIC Primitive2dXmlDump final +{ +private: + std::vector<bool> maFilter; + void decomposeAndWrite(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, ::tools::XmlWriter& rWriter); + +public: + Primitive2dXmlDump(); + ~Primitive2dXmlDump(); + + /** Dumps the input primitive sequence to xml into a file or memory stream and parses the xml for testing. + * + * if rStreamName is set, then the xml content will be dumped into a file, + * otherwise if the rStreamName is empty, then the content will be dumped + * into a memory stream. + * + */ + xmlDocPtr dumpAndParse(const drawinglayer::primitive2d::Primitive2DContainer& aPrimitive2DSequence, const OUString& rStreamName = OUString()); + + /** Dumps the input primitive sequence to xml into a file. */ + void dump(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, const OUString& rStreamName); + +}; + +} + +#endif // INCLUDED_DRAWINGLAYER_TOOLS_PRIMITIVE2DXMLDUMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/primitive2dxmldump.hxx b/include/test/primitive2dxmldump.hxx deleted file mode 100644 index 5acf69999ecd..000000000000 --- a/include/test/primitive2dxmldump.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_TEST_PRIMITIVE2DXMLDUMP_HXX -#define INCLUDED_TEST_PRIMITIVE2DXMLDUMP_HXX - -#include <sal/config.h> -#include <test/testdllapi.hxx> -#include <libxml/tree.h> -#include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <vector> - -namespace tools { class XmlWriter; } - -class OOO_DLLPUBLIC_TEST Primitive2dXmlDump final -{ -private: - std::vector<bool> maFilter; - void decomposeAndWrite(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, tools::XmlWriter& rWriter); - -public: - Primitive2dXmlDump(); - ~Primitive2dXmlDump(); - - /** The actual result that will be used for testing. - - This function normally uses a SvMemoryStream for its operation; but - can use a physical file when a filename is specified in - pTempStreamName - this is useful when creating the test, to dump the - file for examination. - */ - xmlDocPtr dumpAndParse(const drawinglayer::primitive2d::Primitive2DContainer& aPrimitive2DSequence, const OUString& rTempStreamName = OUString()); -}; - -#endif // INCLUDED_TEST_PRIMITIVE2DXMLDUMP_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/tools/XmlWriter.hxx b/include/tools/XmlWriter.hxx index 150bcffe0bf3..da056c68a596 100644 --- a/include/tools/XmlWriter.hxx +++ b/include/tools/XmlWriter.hxx @@ -50,6 +50,7 @@ public: void attribute(const OString& sTagName, const OString& aValue); void attribute(const OString& sTagName, const OUString& aValue); void attribute(const OString& sTagName, sal_Int32 aNumber); + void attributeDouble(const OString& sTagName, double aNumber); void attributeBase64(const OString& sTagName, std::vector<sal_uInt8> const& rValueInBytes); void attributeBase64(const OString& sTagName, std::vector<char> const& rValueInBytes); diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 82e649e0341f..075874d37c0f 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -3983,6 +3983,7 @@ drawinglayer/source/tools/emfpregion.hxx drawinglayer/source/tools/emfpstringformat.cxx drawinglayer/source/tools/emfpstringformat.hxx drawinglayer/source/tools/wmfemfhelper.cxx +drawinglayer/source/tools/primitive2dxmldump.cxx dtrans/source/cnttype/mcnttfactory.cxx dtrans/source/cnttype/mcnttfactory.hxx dtrans/source/cnttype/mcnttype.cxx @@ -6279,6 +6280,7 @@ include/drawinglayer/processor3d/shadow3dextractor.hxx include/drawinglayer/processor3d/zbufferprocessor3d.hxx include/drawinglayer/texture/texture.hxx include/drawinglayer/texture/texture3d.hxx +include/drawinglayer/tools/primitive2dxmldump.hxx include/editeng/AccessibleComponentBase.hxx include/editeng/AccessibleContextBase.hxx include/editeng/AccessibleEditableTextPara.hxx @@ -7576,7 +7578,6 @@ include/test/container/xnamecontainer.hxx include/test/container/xnamed.hxx include/test/container/xnamereplace.hxx include/test/htmltesttools.hxx -include/test/primitive2dxmldump.hxx include/test/screenshot_test.hxx include/test/setupvcl.hxx include/test/sheet/cellarealink.hxx @@ -16558,7 +16559,6 @@ test/source/container/xnamereplace.cxx test/source/diff/diff.cxx test/source/htmltesttools.cxx test/source/isheadless.hxx -test/source/primitive2dxmldump.cxx test/source/screenshot_test.cxx test/source/setupvcl.cxx test/source/sheet/cellarealink.cxx diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 8174c068d045..b3ef8abdd4d4 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -10,7 +10,6 @@ #include <sal/config.h> #include <test/bootstrapfixture.hxx> -#include <test/primitive2dxmldump.hxx> #include <test/xmltesttools.hxx> #include <comphelper/seqstream.hxx> @@ -21,6 +20,7 @@ #include <com/sun/star/graphic/XPrimitive2D.hpp> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/tools/primitive2dxmldump.hxx> #include <memory> @@ -118,18 +118,18 @@ Primitive2DSequence Test::parseSvg(const OUString& aSource) void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) { - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00"); // rect background color - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "height", "100"); // rect background height - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "width", "100"); // rect background width - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "minx", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "miny", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxx", "110"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxy", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100"); // rect background height + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100"); // rect background width + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110"); assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#ff0000"); // rect stroke color assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "3"); // rect stroke width @@ -182,18 +182,18 @@ void Test::testTdf87309() Primitive2DSequence aSequenceTdf87309 = parseSvg("/svgio/qa/cppunit/data/tdf87309.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf87309)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#000000"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "height", "100"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "width", "100"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "minx", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "miny", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxx", "110"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxy", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110"); } void Test::testFontsizeKeywords() @@ -201,7 +201,7 @@ void Test::testFontsizeKeywords() Primitive2DSequence aSequenceFontsizeKeywords = parseSvg("/svgio/qa/cppunit/data/FontsizeKeywords.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeKeywords.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeKeywords)); CPPUNIT_ASSERT (pDocument); @@ -264,7 +264,7 @@ void Test::testFontsizePercentage() Primitive2DSequence aSequenceFontsizePercentage = parseSvg("/svgio/qa/cppunit/data/FontsizePercentage.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizePercentage.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizePercentage)); CPPUNIT_ASSERT (pDocument); @@ -281,7 +281,7 @@ void Test::testFontsizeRelative() Primitive2DSequence aSequenceFontsizeRelative = parseSvg("/svgio/qa/cppunit/data/FontsizeRelative.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeRelative.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeRelative)); CPPUNIT_ASSERT (pDocument); @@ -303,7 +303,7 @@ void Test::testTdf45771() Primitive2DSequence aSequenceTdf45771 = parseSvg("/svgio/qa/cppunit/data/tdf45771.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf45771.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf45771)); CPPUNIT_ASSERT (pDocument); @@ -320,7 +320,7 @@ void Test::testTdf97941() Primitive2DSequence aSequenceTdf97941 = parseSvg("/svgio/qa/cppunit/data/tdf97941.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97941)); CPPUNIT_ASSERT (pDocument); @@ -336,7 +336,7 @@ void Test::testTdf85770() Primitive2DSequence aSequenceTdf85770 = parseSvg("/svgio/qa/cppunit/data/tdf85770.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf85770.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf85770)); CPPUNIT_ASSERT (pDocument); @@ -362,7 +362,7 @@ void Test::testTdf79163() Primitive2DSequence aSequenceTdf79163 = parseSvg("/svgio/qa/cppunit/data/tdf79163.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf79163.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf79163)); CPPUNIT_ASSERT (pDocument); @@ -375,7 +375,7 @@ void Test::testTdf97542_1() Primitive2DSequence aSequenceTdf97542_1 = parseSvg("/svgio/qa/cppunit/data/tdf97542_1.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_1.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_1)); CPPUNIT_ASSERT (pDocument); @@ -391,7 +391,7 @@ void Test::testTdf97542_2() Primitive2DSequence aSequenceTdf97542_2 = parseSvg("/svgio/qa/cppunit/data/tdf97542_2.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_2.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_2)); CPPUNIT_ASSERT (pDocument); @@ -407,18 +407,18 @@ void Test::testTdf97543() Primitive2DSequence aSequenceTdf97543 = parseSvg("/svgio/qa/cppunit/data/tdf97543.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97543.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97543)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "height", "100"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "width", "100"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "minx", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "miny", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxx", "110"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxy", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110"); } void Test::testRGBColor() @@ -426,18 +426,18 @@ void Test::testRGBColor() Primitive2DSequence aSequenceRGBColor = parseSvg("/svgio/qa/cppunit/data/RGBColor.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBColor.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBColor)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#646464"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "height", "100"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "width", "100"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "minx", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "miny", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxx", "110"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxy", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110"); } void Test::testRGBAColor() @@ -445,7 +445,7 @@ void Test::testRGBAColor() Primitive2DSequence aSequenceRGBAColor = parseSvg("/svgio/qa/cppunit/data/RGBAColor.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor)); CPPUNIT_ASSERT (pDocument); @@ -459,25 +459,25 @@ void Test::testTdf97936() Primitive2DSequence aSequenceTdf97936 = parseSvg("/svgio/qa/cppunit/data/tdf97936.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97936.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97936)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "height", "50"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "width", "50"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "minx", "70"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "miny", "50"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "maxx", "120"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "maxy", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "height", "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "width", "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "minx", "70"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "miny", "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "maxx", "120"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "maxy", "100"); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "height", "50"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "width", "50"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "minx", "10"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "miny", "50"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "maxx", "60"); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "maxy", "100"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "height", "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "width", "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "minx", "10"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "miny", "50"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxx", "60"); + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxy", "100"); } void Test::testClipPathAndParentStyle() @@ -487,7 +487,7 @@ void Test::testClipPathAndParentStyle() Primitive2DSequence aSequenceClipPathAndParentStyle = parseSvg("/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndParentStyle.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndParentStyle)); CPPUNIT_ASSERT (pDocument); @@ -505,7 +505,7 @@ void Test::testClipPathAndStyle() Primitive2DSequence aSequenceClipPathAndStyle = parseSvg("/svgio/qa/cppunit/data/ClipPathAndStyle.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndStyle)); CPPUNIT_ASSERT (pDocument); @@ -522,18 +522,18 @@ void Test::testi125329() Primitive2DSequence aSequencei125329 = parseSvg("/svgio/qa/cppunit/data/i125329.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequencei125329.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequencei125329)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", "#c0c0c0"); // rect background color - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "height", "30"); // rect background height - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "width", "50"); // rect background width - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "minx", "15"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "miny", "15"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "maxx", "65"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "maxy", "45"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "height", "30"); // rect background height + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "width", "50"); // rect background width + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "minx", "15"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "miny", "15"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "maxx", "65"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "maxy", "45"); assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "color", "#008000"); // rect stroke color assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "width", "1"); // rect stroke width } @@ -545,7 +545,7 @@ void Test::testMaskingPath07b() Primitive2DSequence aSequenceMaskingPath07b = parseSvg("/svgio/qa/cppunit/data/masking-path-07-b.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskingPath07b.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskingPath07b)); CPPUNIT_ASSERT (pDocument); @@ -558,7 +558,7 @@ void Test::test47446() Primitive2DSequence aSequence47446 = parseSvg("/svgio/qa/cppunit/data/47446.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446)); CPPUNIT_ASSERT (pDocument); @@ -573,7 +573,7 @@ void Test::test47446b() Primitive2DSequence aSequence47446b = parseSvg("/svgio/qa/cppunit/data/47446b.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446b.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446b)); CPPUNIT_ASSERT (pDocument); @@ -588,7 +588,7 @@ void Test::testMaskText() Primitive2DSequence aSequenceMaskText = parseSvg("/svgio/qa/cppunit/data/maskText.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskText)); CPPUNIT_ASSERT (pDocument); @@ -606,7 +606,7 @@ void Test::testTdf99994() Primitive2DSequence aSequenceTdf99994 = parseSvg("/svgio/qa/cppunit/data/tdf99994.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99994.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99994)); CPPUNIT_ASSERT (pDocument); @@ -624,7 +624,7 @@ void Test::testTdf101237() Primitive2DSequence aSequenceTdf101237 = parseSvg("/svgio/qa/cppunit/data/tdf101237.svg"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf101237.getLength())); - Primitive2dXmlDump dumper; + drawinglayer::tools::Primitive2dXmlDump dumper; xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf101237)); CPPUNIT_ASSERT (pDocument); diff --git a/test/Library_test.mk b/test/Library_test.mk index d7b3641ef6f3..3d55e1116d71 100644 --- a/test/Library_test.mk +++ b/test/Library_test.mk @@ -49,7 +49,6 @@ $(eval $(call gb_Library_add_exception_objects,test,\ test/source/callgrind \ test/source/xmltesttools \ test/source/htmltesttools \ - test/source/primitive2dxmldump \ test/source/screenshot_test \ test/source/unoapi_property_testers \ test/source/helper/form \ diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 7780bbb35fb5..3400a6e9d94b 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -136,6 +136,11 @@ void XmlWriter::attribute(const OString& name, const sal_Int32 aNumber) attribute(name, OUString::number(aNumber)); } +void XmlWriter::attributeDouble(const OString& name, const double aNumber) +{ + attribute(name, OUString::number(aNumber)); +} + void XmlWriter::content(const OString& sValue) { xmlChar* xmlValue = xmlCharStrdup(sValue.getStr()); |