dev/null |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 17 ++++------------- 2 files changed, 4 insertions(+), 13 deletions(-)
New commits: commit 2b7b272e28bf95c4ed85cb118eacf065fb6dca3c Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Mar 22 09:37:28 2023 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Mar 22 10:20:30 2023 +0000 sw floattable: limit the unfloat button to non-DOCX files CppunitTest_sw_uiwriter2's testUnfloatButton and testUnfloating failed in the SW_FORCE_FLY_SPLIT=1 case. The trouble was that it assumed that floating tables from DOCX are imported as tables in non-split flys, which is no longer the case. Fix the problem by limiting the test to ODT and DOC files. Once the DOC filter is there for SwFormatFlySplit, this can be restricted further to ODT files only (or perhaps it should be removed completely). Change-Id: Ie1db9a66c862c196aa3bf5326dfb20c67b9b493a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149291 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/unfloatable_floating_table.docx b/sw/qa/extras/uiwriter/data/unfloatable_floating_table.docx deleted file mode 100644 index cef1f7bf685d..000000000000 Binary files a/sw/qa/extras/uiwriter/data/unfloatable_floating_table.docx and /dev/null differ diff --git a/sw/qa/extras/uiwriter/data/unfloatable_small_floating_table.docx b/sw/qa/extras/uiwriter/data/unfloatable_small_floating_table.docx deleted file mode 100644 index d51056af1177..000000000000 Binary files a/sw/qa/extras/uiwriter/data/unfloatable_small_floating_table.docx and /dev/null differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 8cd8c9176742..c4e8abe62c8f 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2448,12 +2448,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonSmallTable) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton) { + SwModelTestBase::FlySplitGuard aGuard; // Different use cases where unfloat button should be visible const std::vector<OUString> aTestFiles = { "unfloatable_floating_table.odt", // Typical use case of multipage floating table - "unfloatable_floating_table.docx", // Need to test the DOCX import whether we detect the floating table correctly "unfloatable_floating_table.doc", // Also the DOC import - "unfloatable_small_floating_table.docx" // Atypical use case, when the table is small, but because of it's position is it broken to two pages }; for (const OUString& aTestFile : aTestFiles) @@ -2467,15 +2466,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton) CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell); const SwSortedObjs* pAnchored; - if (sTestFileName == "unfloatable_small_floating_table.docx") - pAnchored = pWrtShell->GetLayout() - ->GetLower() - ->GetLower() - ->GetLower() - ->GetNext() - ->GetDrawObjs(); - else - pAnchored = pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetDrawObjs(); + pAnchored = pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetDrawObjs(); CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pAnchored); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailureMessage.getStr(), static_cast<size_t>(1), pAnchored->size()); @@ -2521,10 +2512,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonReadOnlyMode) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating) { + SwModelTestBase::FlySplitGuard aGuard; // Test unfloating with tables imported from different file formats const std::vector<OUString> aTestFiles = { "unfloatable_floating_table.odt", - "unfloatable_floating_table.docx", "unfloatable_floating_table.doc", }; @@ -2534,7 +2525,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating) OString sFailureMessage = OString::Concat("Failure in the test file: ") + sTestFileName; // Test what happens when pushing the unfloat button - createSwDoc("unfloatable_floating_table.docx"); + createSwDoc(sTestFileName.getStr()); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell);