summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ww8export
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2019-08-07 00:22:12 +1000
committerMiklos Vajna <vmiklos@collabora.com>2019-08-07 16:43:21 +0200
commit6369cab9b1e16275c8700692bb717aec3c42d346 (patch)
tree86d3edc226c7bd4d5f92270d2f6e5df0349a725f /sw/qa/extras/ww8export
parent75903a0298218f89a199a5ac151ee0166f4469d7 (diff)
tdf#126708 Fix EMF image size in CLI .doc export
Implement EMF image size detection, to fix this bug where an EMF image gets zero size when exported to .doc format from the command line. Change-Id: If980c5d65d4880150815fd1df9704d9c1b3b93c9 Reviewed-on: https://gerrit.libreoffice.org/77031 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/ww8export')
-rw-r--r--sw/qa/extras/ww8export/data/tdf126708_containsemf.odtbin0 -> 13315 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx18
2 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt
new file mode 100644
index 000000000000..31b0fab8d02d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index dfb20c81fc67..a38424cc3ce1 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -13,6 +13,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/text/XFormField.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
@@ -276,6 +277,23 @@ DECLARE_WW8EXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.doc")
getProperty<OUString>(getRun(xPara, 5), "TextPortionType"));
}
+DECLARE_WW8EXPORT_TEST(testTdf126708emf, "tdf126708_containsemf.odt")
+{
+ auto xShape = getShape(1);
+ // First check the size of the EMF graphic contained in the shape.
+ auto xGraphic = getProperty< uno::Reference<graphic::XGraphic> >(
+ xShape, "Graphic");
+ auto xSize = getProperty<awt::Size>(xGraphic, "Size100thMM");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(8501), xSize.Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(18939), xSize.Width);
+
+ // Now check that the shape itself has a decent size.
+ // This size varies slightly when round tripping through doc format.
+ xSize = getProperty<awt::Size>(xShape, "Size");
+ CPPUNIT_ASSERT(abs(xSize.Height - 7629) <= 6);
+ CPPUNIT_ASSERT(abs(xSize.Width - 17000) <= 6);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */