sw/CppunitTest_sw_core_layout.mk | 1 sw/qa/core/layout/data/floattable-nomargins.docx |binary sw/qa/core/layout/flycnt.cxx | 1 sw/qa/core/layout/frmtool.cxx | 40 +++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-)
New commits: commit 6195ba32f864cb9256b57c8bcbad2976798e125e Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Oct 17 08:28:10 2023 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Oct 19 09:33:55 2023 +0200 n#775899 sw: add testcase for the FloattableNomargins compat flag This was added in commit 50a1df360c907d8419ce49f098b6bc87a37a9956 (n#775899 sw: add FloattableNomargins compat flag, 2012-08-23), without a testcase, so it was hard to make later changes without breaking the old behavior. Later commit 0898871b7b9492ada947ebc7b8429c5cb56db23c (n#775899 testcase, 2012-08-27) did add a testcase for the bug, it was a different sub-task there, so the test document had no margins, while this compat flag is about some special handling around non-zero paragraph margins and floating tables. So add a new test that fails without the DocumentSettingId::FLOATTABLE_NOMARGINS block in SwBorderAttrs::CalcLeft() to make sure that this keeps working after I fix tdf#157573, which is a related problem. (cherry picked from commit 40b8b9ee5fb6de66ee455f8ffd64750e59f0587a) Change-Id: I09661be726e3db6be51d0cbb44cb5c504510e5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158108 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/CppunitTest_sw_core_layout.mk b/sw/CppunitTest_sw_core_layout.mk index 8cc670abf64d..a499f537acc2 100644 --- a/sw/CppunitTest_sw_core_layout.mk +++ b/sw/CppunitTest_sw_core_layout.mk @@ -15,6 +15,7 @@ $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_layout)) $(eval $(call gb_CppunitTest_add_exception_objects,sw_core_layout, \ sw/qa/core/layout/flycnt \ + sw/qa/core/layout/frmtool \ sw/qa/core/layout/ftnfrm \ sw/qa/core/layout/layact \ sw/qa/core/layout/layout \ diff --git a/sw/qa/core/layout/data/floattable-nomargins.docx b/sw/qa/core/layout/data/floattable-nomargins.docx new file mode 100644 index 000000000000..642010e0f356 Binary files /dev/null and b/sw/qa/core/layout/data/floattable-nomargins.docx differ diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx index 279ec5ba3e78..557d94eee63c 100644 --- a/sw/qa/core/layout/flycnt.cxx +++ b/sw/qa/core/layout/flycnt.cxx @@ -1199,7 +1199,6 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrapOnAllPages) // Then make sure that the anchor text is also split between page 1 and page 2: SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); - pLayout->dumpAsXml(); auto pPage1 = pLayout->Lower()->DynCastPageFrame(); CPPUNIT_ASSERT(pPage1); auto pPage1Anchor = pPage1->FindLastBodyContent()->DynCastTextFrame(); diff --git a/sw/qa/core/layout/frmtool.cxx b/sw/qa/core/layout/frmtool.cxx new file mode 100644 index 000000000000..2ee4c3a07d8c --- /dev/null +++ b/sw/qa/core/layout/frmtool.cxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <IDocumentLayoutAccess.hxx> +#include <pagefrm.hxx> +#include <rootfrm.hxx> + +namespace +{ +/// Covers sw/source/core/layout/frmtool.cxx fixes. +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/core/layout/data/") + { + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testFloattableNoMargins) +{ + createSwDoc("floattable-nomargins.docx"); + + SwDoc* pDoc = getSwDoc(); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + auto pPage1 = pLayout->Lower()->DynCastPageFrame(); + CPPUNIT_ASSERT(pPage1); + CPPUNIT_ASSERT(!pPage1->GetNext()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */