[Libreoffice-commits] core.git: filter/source sw/qa

Vasily Melenchuk Vasily.Melenchuk at cib.de
Tue Aug 29 10:44:36 UTC 2017


 filter/source/svg/svgwriter.cxx           |    2 -
 sw/qa/extras/odfexport/data/tdf100492.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx      |   34 ++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit d3f1fa3cf190b83d585ec3d1b1a8e5b0896c8ea1
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date:   Tue Jul 25 18:08:13 2017 +0300

    tdf#100492 Skip empty shapes in SVG export
    
    Some shapes do not contain polyline and meanwhile contain start/end
    arrows. This is causing unexpected line endings appear in export.
    
    TODO: Unittest is disabled, since XML parsing returns only root node
    without children. So XPATH assert fails.
    
    Change-Id: Ibc28f12b0f3838065978a674f0debe8e1b8103e9
    Reviewed-on: https://gerrit.libreoffice.org/40422
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 069309f540c1..2bf4b1c0ad2d 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3283,7 +3283,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                         }
                     }
 
-                    if(mapCurShape.get() &&(aStartArrow.Count() || aEndArrow.Count()))
+                    if(mapCurShape.get() && mapCurShape->maShapePolyPoly.Count() && (aStartArrow.Count() || aEndArrow.Count()))
                     {
                         ImplWriteShape( *mapCurShape );
 
diff --git a/sw/qa/extras/odfexport/data/tdf100492.odt b/sw/qa/extras/odfexport/data/tdf100492.odt
new file mode 100644
index 000000000000..e17bd67c5096
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf100492.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index bbebd6b24afc..cc096f406733 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -19,6 +19,8 @@
 #include <com/sun/star/container/XIndexReplace.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/GraphicExportFilter.hpp>
+#include <com/sun/star/drawing/XGraphicExportFilter.hpp>
 #include <com/sun/star/table/ShadowFormat.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
@@ -32,6 +34,8 @@
 #include <com/sun/star/text/XTextField.hpp>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/fileformat.h>
+#include <comphelper/propertysequence.hxx>
+#include <unotools/streamwrap.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -1654,6 +1658,36 @@ DECLARE_ODFEXPORT_TEST(testImageMimetype, "image-mimetype.odt")
     }
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf100492, "tdf100492.odt")
+{
+    uno::Reference<drawing::XShape> xShape = getShape(1);
+    CPPUNIT_ASSERT(xShape.is());
+
+    // Save the first shape to a SVG
+    uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter = drawing::GraphicExportFilter::create(comphelper::getProcessComponentContext());
+    uno::Reference<lang::XComponent> xSourceDoc(xShape, uno::UNO_QUERY);
+    xGraphicExporter->setSourceDocument(xSourceDoc);
+
+    SvMemoryStream aStream;
+    uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+    uno::Sequence<beans::PropertyValue> aDescriptor( comphelper::InitPropertySequence({
+            { "OutputStream", uno::Any(xOutputStream) },
+            { "FilterName", uno::Any(OUString("SVG")) }
+        }));
+    xGraphicExporter->filter(aDescriptor);
+    aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+    // TODO: Disabled. Parsing of SVG gives just root node without any children.
+    // Reason of such behavior unclear. So XPATH assert fails.
+
+    // Parse resulting SVG as XML file.
+    // xmlDocPtr pXmlDoc = parseXmlStream(&aStream);
+
+    // Check amount of paths required to draw an arrow.
+    // Since there are still some emty paths in output test can fail later. There are just two
+    // really used and visible paths.
+    //assertXPath(pXmlDoc, "/svg/path", 4);
+}
 
 #endif
 


More information about the Libreoffice-commits mailing list