summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-10-17 08:28:10 +0200
committerMiklos Vajna <vmiklos@collabora.com>2023-10-17 10:00:32 +0200
commit40b8b9ee5fb6de66ee455f8ffd64750e59f0587a (patch)
tree93882f05e5dec68214f10e0c39e61b3db1266209
parent0e14912af0c449396f10c2ae4be3c7f2a3a98bc2 (diff)
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. Change-Id: I09661be726e3db6be51d0cbb44cb5c504510e5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158069 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/CppunitTest_sw_core_layout.mk1
-rw-r--r--sw/qa/core/layout/data/floattable-nomargins.docxbin0 -> 12737 bytes
-rw-r--r--sw/qa/core/layout/flycnt.cxx1
-rw-r--r--sw/qa/core/layout/frmtool.cxx40
4 files changed, 41 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-nomargins.docx
Binary files differ
diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx
index 16cd9cda4a57..6c508a5f87e7 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: */