summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-03-20 12:14:53 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-03-20 12:30:47 +0000
commit48818dd359fbf0f37e1b318de89ab2ea7d735f58 (patch)
tree1c8e3b9d0daa02f42708c2aa3cc66f5f5b25226d /sw/qa/extras
parent564d0fa5b38bdd90d15b8e4b630e3d6ac6d10769 (diff)
sw floattable: fix handling of nested non-floating tables at cell start
CppunitTest_sw_ooxmlexport8's testN779642 failed in the SW_FORCE_FLY_SPLIT=1 case. The bugdoc has a floating table, then an inner, non-floating table. The conversion to floating tables was disabled by the c1eebcdac9f2b289fd363399130c485ca5ff444c (tdf#79329 DOCX import: fix missing outer table with floattable at cell start, 2016-11-08). Given that SwFormatFlySplit doesn't need the delayed text frame conversion, we can get rid of this workaround. Fix a similar problem on the export side as well, where the positioning properties of the outer table leaked into the inner table. Once both the import and export are fixed, the test passes. Change-Id: I884ad38cbc247c885991b0faf0d37221b70a6ba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149154 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport8.cxx61
1 files changed, 34 insertions, 27 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 8cd6d4961f38..dbcd48aca0b6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -720,34 +720,41 @@ DECLARE_OOXMLEXPORT_TEST(testN793998, "n793998.docx")
CPPUNIT_ASSERT(nTextPortion + nTabPortion > nParagraph - nRightMargin);
}
-DECLARE_OOXMLEXPORT_TEST(testN779642, "n779642.docx")
+CPPUNIT_TEST_FIXTURE(Test, testN779642)
{
- uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
-
- // First problem: check that we have 2 tables, nesting caused the
- // creation of outer one to fail
- uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables->getCount());
-
- // Second problem: check that the outer table is in a frame, at the bottom of the page
- uno::Reference<text::XTextTable> xTextTable(xTextTablesSupplier->getTextTables()->getByName("Table2"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xAnchor(xTextTable->getAnchor(), uno::UNO_QUERY);
- uno::Any aFrame = xAnchor->getPropertyValue("TextFrame");
- uno::Reference<beans::XPropertySet> xFrame;
- aFrame >>= xFrame;
- sal_Int16 nValue;
- xFrame->getPropertyValue("VertOrient") >>= nValue;
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::BOTTOM, nValue);
- xFrame->getPropertyValue("VertOrientRelation") >>= nValue;
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", text::RelOrientation::PAGE_PRINT_AREA, nValue);
-
- // tdf#106572 - perhaps not the best test to hijack since this file
- // produces an error in Word, but it nicely matches danger points,
- // and has a different first footer, so nice visual confirmation.
- discardDumpedLayout();
- xmlDocUniquePtr pXmlDoc = parseLayoutDump();
- // There is no footer text on the first page.
- assertXPath(pXmlDoc, "/root/page[1]/footer/txt", 0);
+ SwModelTestBase::FlySplitGuard aGuard;
+ auto verify = [this]() {
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+
+ // First problem: check that we have 2 tables, nesting caused the
+ // creation of outer one to fail
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables->getCount());
+
+ // Second problem: check that the outer table is in a frame, at the bottom of the page
+ uno::Reference<text::XTextTable> xTextTable(xTextTablesSupplier->getTextTables()->getByName("Table2"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xAnchor(xTextTable->getAnchor(), uno::UNO_QUERY);
+ uno::Any aFrame = xAnchor->getPropertyValue("TextFrame");
+ uno::Reference<beans::XPropertySet> xFrame;
+ aFrame >>= xFrame;
+ sal_Int16 nValue;
+ xFrame->getPropertyValue("VertOrient") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::BOTTOM, nValue);
+ xFrame->getPropertyValue("VertOrientRelation") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", text::RelOrientation::PAGE_PRINT_AREA, nValue);
+
+ // tdf#106572 - perhaps not the best test to hijack since this file
+ // produces an error in Word, but it nicely matches danger points,
+ // and has a different first footer, so nice visual confirmation.
+ discardDumpedLayout();
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ // There is no footer text on the first page.
+ assertXPath(pXmlDoc, "/root/page[1]/footer/txt", 0);
+ };
+ createSwDoc("n779642.docx");
+ verify();
+ reload(mpFilter, "n779642.docx");
+ verify();
}
DECLARE_OOXMLEXPORT_TEST(testTbLrHeight, "tblr-height.docx")