summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorPatrick Jaap <patrick.jaap@tu-dresden.de>2019-02-13 14:58:29 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-25 09:45:28 +0100
commit167d4a9920b5858c3fc8cfb2a34b4f6dc5d5676a (patch)
tree9b27dccfdda77df0030e2576344b519a89638cad /sw/qa
parentf7643f5ada35ed205516a583f583bde7865ddf10 (diff)
Fix: Use correct relative table width in docx export
It removes the HACK where the doc model was changed. We introduce a pointer to a surrounding frame: an indicator telling us that the table was placed in a frame to make it floating. During export, remove the frame and use the relative width of the surrounding frame. Change-Id: I43b45d9a9e67ee755782c9f18df22ae1d4014689 Reviewed-on: https://gerrit.libreoffice.org/67775 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx9
-rw-r--r--sw/qa/extras/uiwriter/data2/frame_size_export.docxbin0 -> 13929 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx19
3 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 4d0d6fa70501..d52f546790c9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -138,6 +138,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(24188), frameRect.Width);
}
+DECLARE_OOXMLEXPORT_TEST(testFrameSizeExport, "floating-tables-anchor.docx")
+{
+ // Make sure the table width is 4000
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tblPr/w:tblW", "w", "4000");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/uiwriter/data2/frame_size_export.docx b/sw/qa/extras/uiwriter/data2/frame_size_export.docx
new file mode 100644
index 000000000000..86147f311038
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/frame_size_export.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 33b8ac9b53ed..2f248a996b7c 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -61,6 +61,7 @@ public:
void testTdf122942();
void testTdf52391();
void testTdf101873();
+ void testTableWidth();
CPPUNIT_TEST_SUITE(SwUiWriterTest2);
CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -83,6 +84,7 @@ public:
CPPUNIT_TEST(testTdf122942);
CPPUNIT_TEST(testTdf52391);
CPPUNIT_TEST(testTdf101873);
+ CPPUNIT_TEST(testTableWidth);
CPPUNIT_TEST_SUITE_END();
private:
@@ -914,6 +916,23 @@ void SwUiWriterTest2::testTdf101873()
CPPUNIT_ASSERT_EQUAL(OUString("something"), pShellCursor->GetText());
}
+void SwUiWriterTest2::testTableWidth()
+{
+ load(DATA_DIRECTORY, "frame_size_export.docx");
+
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString("Office Open XML Text");
+ xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+
+ // after exporting: table width was overwritten in the doc model
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(100),
+ getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */