[Libreoffice-commits] core.git: emfio/qa filter/qa include/test include/vcl solenv/clang-format sw/qa test/Library_test.mk test/source vcl/Library_vcl.mk vcl/qa vcl/README vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 3 14:08:29 UTC 2019


 emfio/qa/cppunit/wmf/wmfimporttest.cxx   |   17 ++++++++---------
 filter/qa/cppunit/filters-pict-test.cxx  |    3 +--
 include/test/xmltesttools.hxx            |    3 +++
 include/vcl/mtfxmldump.hxx               |   16 +++++-----------
 solenv/clang-format/blacklist            |    4 ++--
 sw/qa/extras/layout/layout.cxx           |   17 ++++++++---------
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |    3 +--
 sw/qa/extras/uiwriter/uiwriter.cxx       |    3 +--
 test/Library_test.mk                     |    1 -
 test/source/xmltesttools.cxx             |   10 ++++++++++
 vcl/Library_vcl.mk                       |    1 +
 vcl/README                               |    6 +-----
 vcl/qa/cppunit/svm/svmtest.cxx           |    7 +++----
 vcl/source/gdi/mtfxmldump.cxx            |   23 +++++------------------
 14 files changed, 49 insertions(+), 65 deletions(-)

New commits:
commit 66b919c8674066871a06e7cdf5595dc6951524e0
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jan 3 11:41:53 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 3 15:08:06 2019 +0100

    svm xml dumper: move this from test to vcl
    
    This is very useful functionality, this way it can be invoked from the
    debugger and/or nested into an outer xml dump (sw/sd doc model dump)
    more easily.
    
    Change-Id: If6c83b11d0f3e65fcce71e8d820c6bc354f64d68
    Reviewed-on: https://gerrit.libreoffice.org/65834
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 318f6a70826a..5f9de170c595 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <test/xmltesttools.hxx>
-#include <test/mtfxmldump.hxx>
 #include <test/setupvcl.hxx>
 #include <test/bootstrapfixture.hxx>
 #include <vcl/wmf.hxx>
@@ -74,7 +73,7 @@ void WmfTest::testNonPlaceableWmf()
     MetafileXmlDump dumper;
     dumper.filterAllActionTypes();
     dumper.filterActionType(MetaActionType::POLYLINE, false);
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
@@ -103,7 +102,7 @@ void WmfTest::testSine()
     MetafileXmlDump dumper;
     dumper.filterAllActionTypes();
     dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false);
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
@@ -119,7 +118,7 @@ void WmfTest::testEmfProblem()
     MetafileXmlDump dumper;
     dumper.filterAllActionTypes();
     dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false);
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
@@ -139,7 +138,7 @@ void WmfTest::testEmfLineStyles()
     dumper.filterAllActionTypes();
     dumper.filterActionType(MetaActionType::LINE, false);
     dumper.filterActionType(MetaActionType::LINECOLOR, false);
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
@@ -198,7 +197,7 @@ void WmfTest::testWorldTransformFontSize()
     MetafileXmlDump dumper;
     dumper.filterAllActionTypes();
     dumper.filterActionType(MetaActionType::FONT, false);
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
@@ -226,7 +225,7 @@ void WmfTest::testTdf93750()
     ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
     MetafileXmlDump dumper;
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
@@ -265,7 +264,7 @@ void WmfTest::testTdf39894()
         ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
         MetafileXmlDump dumper;
-        xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+        xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
         CPPUNIT_ASSERT(pDoc);
 
@@ -286,7 +285,7 @@ void WmfTest::testETO_PDY()
         ReadWindowMetafile(aFileStream, aGDIMetaFile);
 
         MetafileXmlDump dumper;
-        xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+        xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
         CPPUNIT_ASSERT(pDoc);
 
diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/filter/qa/cppunit/filters-pict-test.cxx
index 9ca3ba5a7e15..4605cf6983f8 100644
--- a/filter/qa/cppunit/filters-pict-test.cxx
+++ b/filter/qa/cppunit/filters-pict-test.cxx
@@ -10,7 +10,6 @@
 #include <unotest/filters-test.hxx>
 #include <test/bootstrapfixture.hxx>
 #include <vcl/FilterConfigItem.hxx>
-#include <test/mtfxmldump.hxx>
 #include <test/xmltesttools.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
@@ -86,7 +85,7 @@ void PictFilterTest::testDontClipTooMuch()
     MetafileXmlDump dumper;
     dumper.filterAllActionTypes();
     dumper.filterActionType(MetaActionType::CLIPREGION, false);
-    xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile);
+    xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
 
     CPPUNIT_ASSERT (pDoc);
 
diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx
index 231a3e448fd6..4f725f5948c5 100644
--- a/include/test/xmltesttools.hxx
+++ b/include/test/xmltesttools.hxx
@@ -22,6 +22,7 @@
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
 #include <unotools/tempfile.hxx>
+#include <vcl/mtfxmldump.hxx>
 
 #include <cppunit/TestAssert.h>
 
@@ -33,6 +34,8 @@ public:
     /// Return xmlDocPtr representation of the XML stream read from pStream.
     static xmlDocPtr parseXmlStream(SvStream* pStream);
 
+    static xmlDocPtr dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile);
+
 protected:
     XmlTestTools();
     virtual ~XmlTestTools();
diff --git a/include/test/mtfxmldump.hxx b/include/vcl/mtfxmldump.hxx
similarity index 64%
rename from include/test/mtfxmldump.hxx
rename to include/vcl/mtfxmldump.hxx
index b55de95258db..797430d0cc6b 100644
--- a/include/test/mtfxmldump.hxx
+++ b/include/vcl/mtfxmldump.hxx
@@ -7,12 +7,11 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_TEST_MTFXMLDUMP_HXX
-#define INCLUDED_TEST_MTFXMLDUMP_HXX
+#ifndef INCLUDED_VCL_MTFXMLDUMP_HXX
+#define INCLUDED_VCL_MTFXMLDUMP_HXX
 
 #include <sal/config.h>
-#include <test/testdllapi.hxx>
-#include <libxml/tree.h>
+#include <vcl/dllapi.h>
 #include <vcl/gdimtf.hxx>
 #include <vcl/metaactiontypes.hxx>
 #include <o3tl/enumarray.hxx>
@@ -21,7 +20,7 @@ namespace tools { class XmlWriter; }
 
 enum class MetaActionType;
 
-class OOO_DLLPUBLIC_TEST MetafileXmlDump final
+class VCL_DLLPUBLIC MetafileXmlDump final
 {
     o3tl::enumarray<MetaActionType, bool> maFilter;
 
@@ -35,13 +34,8 @@ public:
     void filterAllActionTypes();
 
     /** 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 GDIMetaFile& rMetaFile, const OUString& rTempStreamName = OUString());
+    void dump(const GDIMetaFile& rMetaFile, SvStream& rStream);
 };
 
 #endif
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 9891f07f2f3c..cb825b74afef 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -7578,7 +7578,6 @@ include/test/container/xnamecontainer.hxx
 include/test/container/xnamed.hxx
 include/test/container/xnamereplace.hxx
 include/test/htmltesttools.hxx
-include/test/mtfxmldump.hxx
 include/test/primitive2dxmldump.hxx
 include/test/screenshot_test.hxx
 include/test/setupvcl.hxx
@@ -7984,6 +7983,7 @@ include/vcl/metric.hxx
 include/vcl/mnemonic.hxx
 include/vcl/mnemonicengine.hxx
 include/vcl/msgbox.hxx
+include/vcl/mtfxmldump.hxx
 include/vcl/notebookbar.hxx
 include/vcl/oldprintadaptor.hxx
 include/vcl/opengl/GLMHelper.hxx
@@ -16571,7 +16571,6 @@ test/source/container/xnamereplace.cxx
 test/source/diff/diff.cxx
 test/source/htmltesttools.cxx
 test/source/isheadless.hxx
-test/source/mtfxmldump.cxx
 test/source/primitive2dxmldump.cxx
 test/source/screenshot_test.cxx
 test/source/setupvcl.cxx
@@ -18080,6 +18079,7 @@ vcl/source/gdi/jobset.cxx
 vcl/source/gdi/lineinfo.cxx
 vcl/source/gdi/mapmod.cxx
 vcl/source/gdi/metaact.cxx
+vcl/source/gdi/mtfxmldump.cxx
 vcl/source/gdi/octree.cxx
 vcl/source/gdi/oldprintadaptor.cxx
 vcl/source/gdi/pdfextoutdevdata.cxx
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index e2b3006c1b4e..b4b27ccaf337 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -9,7 +9,6 @@
 
 #include <swmodeltestbase.hxx>
 #include <comphelper/propertysequence.hxx>
-#include <test/mtfxmldump.hxx>
 #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
 #include <com/sun/star/frame/DispatchHelper.hpp>
 #include <officecfg/Office/Common.hxx>
@@ -2290,7 +2289,7 @@ void SwLayoutWriter::testTdf116830()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
 
     // Assert that the yellow rectangle (cell background) is painted after the
@@ -2317,7 +2316,7 @@ void SwLayoutWriter::testTdf114163()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
 
     assertXPathContent(
@@ -2335,7 +2334,7 @@ void SwLayoutWriter::testTdf108021()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
 
     assertXPath(
@@ -2353,7 +2352,7 @@ void SwLayoutWriter::testTdf116925()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
 
     assertXPathContent(pXmlDoc,
@@ -2373,7 +2372,7 @@ void SwLayoutWriter::testTdf117028()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
 
     // The only polypolygon in the rendering result was the white background we
@@ -2395,7 +2394,7 @@ void SwLayoutWriter::testTdf106390()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
     sal_Int32 nBottom = getXPath(pXmlDoc, "//sectrectclipregion", "bottom").toInt32();
 
@@ -2413,7 +2412,7 @@ void SwLayoutWriter::testTableExtrusion1()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
     sal_Int32 nRight = getXPath(pXmlDoc, "//sectrectclipregion", "right").toInt32();
     sal_Int32 nLeft = static_cast<sal_Int32>(nRight * 0.95);
@@ -2433,7 +2432,7 @@ void SwLayoutWriter::testTableExtrusion2()
     // Dump the rendering of the first page as an XML file.
     std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
     CPPUNIT_ASSERT(pXmlDoc);
     // End point position of the outer table.
     sal_Int32 nX = getXPath(pXmlDoc, "(//polyline[1]/point)[2]", "x").toInt32();
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 982e02f57c87..095d938fc37f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -63,7 +63,6 @@
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <com/sun/star/awt/CharSet.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
-#include <test/mtfxmldump.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -1288,7 +1287,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf100072, "tdf100072.docx")
     ReadGraphic(aStream, aGraphic);
     const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(rMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, rMetaFile);
 
     // Get first polyline rightside x coordinate
     sal_Int32 nFirstEnd = getXPath(pXmlDoc, "(//polyline)[1]/point[2]", "x").toInt32();
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 269e6b92d088..bc05aeaa0445 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -35,7 +35,6 @@
 #include <charatr.hxx>
 #include <editeng/acorrcfg.hxx>
 #include <unotools/streamwrap.hxx>
-#include <test/mtfxmldump.hxx>
 #include <unocrsr.hxx>
 #include <unocrsrhelper.hxx>
 #include <unotbl.hxx>
@@ -1704,7 +1703,7 @@ void SwUiWriterTest::testFdo87448()
     ReadGraphic(aStream, aGraphic);
     const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile();
     MetafileXmlDump dumper;
-    xmlDocPtr pXmlDoc = dumper.dumpAndParse(rMetaFile);
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, rMetaFile);
 
     // The first polyline in the document has a number of points to draw arcs,
     // the last one jumps back to the start, so we call "end" the last but one.
diff --git a/test/Library_test.mk b/test/Library_test.mk
index 1e4a013e1e4b..d7b3641ef6f3 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/mtfxmldump \
     test/source/primitive2dxmldump \
     test/source/screenshot_test \
     test/source/unoapi_property_testers \
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index dd3179cb1e1f..00d156c40ecf 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -11,6 +11,8 @@
 
 #include <memory>
 
+#include <vcl/mtfxmldump.hxx>
+
 namespace {
 
 OUString convert(xmlChar const * string) {
@@ -49,6 +51,14 @@ xmlDocPtr XmlTestTools::parseXmlStream(SvStream* pStream)
     return xmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()));
 }
 
+xmlDocPtr XmlTestTools::dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile)
+{
+    SvMemoryStream aStream;
+    rDumper.dump(rGDIMetaFile, aStream);
+    aStream.Seek(STREAM_SEEK_TO_BEGIN);
+    return XmlTestTools::parseXmlStream(&aStream);
+}
+
 xmlXPathObjectPtr XmlTestTools::getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath)
 {
     xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index da9bc387ca2f..31e677b9e37d 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -260,6 +260,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/gdi/embeddedfontshelper \
     vcl/source/gdi/extoutdevdata \
     vcl/source/gdi/gdimtf \
+    vcl/source/gdi/mtfxmldump \
     vcl/source/gdi/gdimetafiletools \
     vcl/source/gdi/gfxlink \
     vcl/source/gdi/gradient \
diff --git a/vcl/README b/vcl/README
index 9219c30b5b46..d8da537939b3 100644
--- a/vcl/README
+++ b/vcl/README
@@ -88,14 +88,10 @@ GDIMetafile is a vector drawing representation that corresponds directly
 to the SVM (StarView Metafile) format; it is extremely important as
 an intermediate format in all sorts of drawing and printing operations.
 
-There is a class MetafileXmlDump in include/test/mtfxmldump.hxx that
+There is a class MetafileXmlDump in include/vcl/mtfxmldump.hxx that
 can store a GDIMetafile as XML, which makes debugging much easier
 since you can just use "diff" to see changes.
 
-To use it you need to link against "test" library and then (because
-"test" is not part of the installation) run with:
-LD_LIBRARY_PATH=workdir/LinkTarget/Library:workdir/UnpackedTarball/cppunit/src/cppunit/.libs instdir/program/soffice
-
 == EMF+ ==
 
 emf+ is vector file format used by MSO and is successor of wmf and
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 116bf0ab6758..163522634781 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -10,7 +10,6 @@
 
 #include <test/bootstrapfixture.hxx>
 #include <test/xmltesttools.hxx>
-#include <test/mtfxmldump.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/bitmapaccess.hxx>
@@ -27,7 +26,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
         return m_directories.getURLFromSrc(maDataUrl) + sFileName;
     }*/
 
-    xmlDocPtr dumpMeta(const GDIMetaFile& rMetaFile, const OUString& rFileUrl = OUString());
+    xmlDocPtr dumpMeta(const GDIMetaFile& rMetaFile);
 
     void checkVirtualDevice(xmlDocPtr pDoc);
     void checkErase(xmlDocPtr pDoc);
@@ -188,10 +187,10 @@ static GDIMetaFile writeAndRead(GDIMetaFile& rMetaFile, const OUString& sUrl)
     }
 }
 
-xmlDocPtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile, const OUString& rFileUrl)
+xmlDocPtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile)
 {
     MetafileXmlDump dumper;
-    xmlDocPtr pDoc = dumper.dumpAndParse(rMetaFile, rFileUrl);
+    xmlDocPtr pDoc = dumpAndParse(dumper, rMetaFile);
     CPPUNIT_ASSERT (pDoc);
 
     checkVirtualDevice(pDoc);
diff --git a/test/source/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
similarity index 98%
rename from test/source/mtfxmldump.cxx
rename to vcl/source/gdi/mtfxmldump.cxx
index 593123054329..2666ddd55d78 100644
--- a/test/source/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -7,10 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <test/mtfxmldump.hxx>
-#include <test/xmltesttools.hxx>
+#include <vcl/mtfxmldump.hxx>
 #include <tools/XmlWriter.hxx>
-#include<tools/fract.hxx>
+#include <tools/fract.hxx>
 
 #include <vcl/metaact.hxx>
 #include <vcl/outdev.hxx>
@@ -19,6 +18,7 @@
 
 #include <memory>
 #include <numeric>
+#include <sstream>
 
 namespace
 {
@@ -449,16 +449,9 @@ void MetafileXmlDump::filterAllActionTypes()
     maFilter.fill(true);
 }
 
-xmlDocPtr MetafileXmlDump::dumpAndParse(const GDIMetaFile& rMetaFile, const OUString& rTempStreamName)
+void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, SvStream& rStream)
 {
-    std::unique_ptr<SvStream> pStream;
-
-    if (rTempStreamName.isEmpty())
-        pStream.reset(new SvMemoryStream());
-    else
-        pStream.reset(new SvFileStream(rTempStreamName, StreamMode::STD_READWRITE | StreamMode::TRUNC));
-
-    tools::XmlWriter aWriter(pStream.get());
+    tools::XmlWriter aWriter(&rStream);
     aWriter.startDocument();
     aWriter.startElement("metafile");
 
@@ -466,12 +459,6 @@ xmlDocPtr MetafileXmlDump::dumpAndParse(const GDIMetaFile& rMetaFile, const OUSt
 
     aWriter.endElement();
     aWriter.endDocument();
-
-    pStream->Seek(STREAM_SEEK_TO_BEGIN);
-
-    xmlDocPtr pDoc = XmlTestTools::parseXmlStream(pStream.get());
-
-    return pDoc;
 }
 
 void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& rWriter)


More information about the Libreoffice-commits mailing list