summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-04-25 09:25:34 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-04-25 11:46:41 +0200
commite6e5a68f52f4e06b73f0ece3a3886f3bfc30f56d (patch)
tree24882d976c5df888cd392cb913996e6f6003306a /sw
parentd496eab538cb967c62308f4235f090849ed82957 (diff)
tdf#107104 DOCX drawingML import: fix invisible arrow shape
This is the drawingML equivalent of commit 3d9ebded1358395ed81db7a63629b046aec2aeac (Misc improvements for docx VML import, 2010-10-06), which made sure that shapes are never invisible just because they have zero height or width. For this particular bugdoc the Word-produced WW8 equivalent width is 20 twips, but let's be consistent with the VML import and just round up to 1 mm100. Also fix two existing tests that wanted to test something else, but implicitly asserted that some shapes indeed have zero width/height. Change-Id: I9600424520d0a3deecc711b44622eccc041a59da Reviewed-on: https://gerrit.libreoffice.org/36927 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf107104.docxbin0 -> 15648 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport6.cxx4
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx7
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx4
4 files changed, 12 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf107104.docx b/sw/qa/extras/ooxmlexport/data/tdf107104.docx
new file mode 100644
index 000000000000..2f8c87d8d3d5
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf107104.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 80f28f09875a..2891b3ff162f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -909,7 +909,9 @@ DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent","cx","0");
+ sal_Int32 nX = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent", "cx").toInt32();
+ // This was negative.
+ CPPUNIT_ASSERT(nX >= 0);
}
// part of tdf#93676, word gives the frame in the exported .docx a huge height,
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 3311f1b68184..15e1f05e629e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -457,6 +457,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106492, "tdf106492.docx")
assertXPath(pXmlDoc, "//w:sectPr", 3);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf107104, "tdf107104.docx")
+{
+ CPPUNIT_ASSERT(getShape(1)->getSize().Width > 0);
+ // This failed: the second arrow was invisible because it had zero height.
+ CPPUNIT_ASSERT(getShape(2)->getSize().Width > 0);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 185ec428edff..741ee50fa336 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1199,8 +1199,8 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx")
uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xShape.is());
awt::Size aActualSize(xShape->getSize());
- // This was 3493: the vertical line was horizontal.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aActualSize.Width);
+ // Width was 3493: the vertical line was horizontal.
+ CPPUNIT_ASSERT(aActualSize.Width < aActualSize.Height);
CPPUNIT_ASSERT(aActualSize.Height > 0);
}