diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-05-02 08:15:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-05-02 16:35:52 +0200 |
commit | 1c99616f86f7d5b83b91edc225fc95fec227d710 (patch) | |
tree | 5c002e845bf6325bc51506db34aa8fbc791973a7 /sw | |
parent | 46e40f2f7c742ffe01833551bb2843d156716be0 (diff) |
sw floattable, crashtesting: fix PDF export of forum-mso-en3-26783.docx
Converting the bugdoc to PDF crashed Writer layout since commit
ce3308a926f036b87515b8cd97d2b197063dc77a (tdf#61594 sw floattable:
import floating tables as split flys by default, 2023-04-12).
Inspecting what the layout does, the trouble was that the bugdoc has a
floating table, immediately followed by a non-floating table. This
breaks the invariant that floating tables are anchored in the next, text
node. In practice we anchored the floating table in the first cell of
the next table, which is not the same as a floating table followed by a
normal table. (For comparison, the DOC import simply lost the floating
table in this case.)
Fix the problem by making sure there is a text node after a floating
table, in case it's directly followed by a table (no text node
in-between).
Changed tests:
- testFloatingTablesAnchor: this still asserts that the flys are all
anchored in the body text
- testTdf95755: the problematic table is still not as wide as it used to
be in the bad case
Change-Id: I30b9ae423914b0b2cb1ebc7c1dce7efcd4cc3cf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151251
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 5a886f6907ee..5ad22de67e62 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -432,17 +432,17 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69656, "Table_cell_auto_width_fdo69656.docx") DECLARE_OOXMLEXPORT_TEST(testFloatingTablesAnchor, "floating-tables-anchor.docx") { + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XText> xBodyText = xTextDocument->getText(); // Problem was one of the two text frames was anchored to the other text frame - // Both frames should be anchored to the paragraph with the text "Anchor point" + // Both frames should be anchored to the body text uno::Reference<text::XTextContent> xTextContent(getShape(1), uno::UNO_QUERY); uno::Reference<text::XTextRange> xRange = xTextContent->getAnchor(); - uno::Reference<text::XText> xText = xRange->getText(); - CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); + CPPUNIT_ASSERT_EQUAL(xBodyText, xRange->getText()); xTextContent.set(getShape(2), uno::UNO_QUERY); xRange = xTextContent->getAnchor(); - xText = xRange->getText(); - CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); + CPPUNIT_ASSERT_EQUAL(xBodyText, xRange->getText()); // tdf#149292 pre-emptive test - ensure "First Page" page style CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(getParagraph(1), "PageDescName")); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 73ac05f6311e..95e526f9c3a6 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1416,7 +1416,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf95755) uno::Any aValue = xTableProperties->getPropertyValue("Width"); sal_Int32 nWidth; aValue >>= nWidth; - CPPUNIT_ASSERT_EQUAL(sal_Int32(10659), nWidth); + CPPUNIT_ASSERT_EQUAL(sal_Int32(10592), nWidth); } CPPUNIT_TEST_FIXTURE(Test, testTdf60351) |