summaryrefslogtreecommitdiffstats
path: root/sw/qa/core
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/core')
-rw-r--r--sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx11
-rw-r--r--sw/qa/core/accessibilitycheck/data/Tabs-in-TOC.odtbin0 -> 15284 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-header.docxbin0 -> 31604 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-in-section.docxbin14024 -> 16073 bytes
-rw-r--r--sw/qa/core/layout/layact.cxx22
-rw-r--r--sw/qa/core/layout/tabfrm.cxx21
6 files changed, 54 insertions, 0 deletions
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 117b48d016..bfe2e08d85 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -251,6 +251,17 @@ scanAccessibilityIssuesOnNodes(SwDoc* pDocument)
return aIssues;
}
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsinTOC)
+{
+ createSwDoc("Tabs-in-TOC.odt");
+ SwDoc* pDoc = getSwDoc();
+ CPPUNIT_ASSERT(pDoc);
+ sw::AccessibilityCheck aCheck(pDoc);
+ aCheck.check();
+ auto& aIssues = aCheck.getIssueCollection().getIssues();
+ CPPUNIT_ASSERT_EQUAL(size_t(0), aIssues.size());
+}
+
void checkIssuePosition(std::shared_ptr<sfx::AccessibilityIssue> const& pIssue, int nLine,
sal_Int32 nStart, sal_Int32 nEnd, SwNodeOffset nIndex)
{
diff --git a/sw/qa/core/accessibilitycheck/data/Tabs-in-TOC.odt b/sw/qa/core/accessibilitycheck/data/Tabs-in-TOC.odt
new file mode 100644
index 0000000000..2b3ce54cc5
--- /dev/null
+++ b/sw/qa/core/accessibilitycheck/data/Tabs-in-TOC.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-header.docx b/sw/qa/core/layout/data/floattable-header.docx
new file mode 100644
index 0000000000..baddd365ce
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-header.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-in-section.docx b/sw/qa/core/layout/data/floattable-in-section.docx
index a0e9090bcc..9aab264867 100644
--- a/sw/qa/core/layout/data/floattable-in-section.docx
+++ b/sw/qa/core/layout/data/floattable-in-section.docx
Binary files differ
diff --git a/sw/qa/core/layout/layact.cxx b/sw/qa/core/layout/layact.cxx
index d432ae52b7..8923d6b0e8 100644
--- a/sw/qa/core/layout/layact.cxx
+++ b/sw/qa/core/layout/layact.cxx
@@ -86,6 +86,28 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157096)
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInSection)
+{
+ // Given a document with multiple sections, the 2nd section on page 1 has a one-page floating
+ // table:
+ createSwDoc("floattable-in-section.docx");
+
+ // When laying out that document:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+ // Then make sure the table is on page 1, not on page 2:
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ // Without the fix in place, it would have failed, the table was on page 2, not on page 1.
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(!pPage2->GetSortedObjs());
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
index e0d099c771..9bfbd1b82e 100644
--- a/sw/qa/core/layout/tabfrm.cxx
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -17,6 +17,8 @@
#include <anchoredobject.hxx>
#include <flyfrm.hxx>
#include <flyfrms.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
namespace
{
@@ -235,6 +237,25 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrappedByTableNested)
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pDoc->GetTableFrameFormats()->GetFormatCount());
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDoc->GetSpzFrameFormats()->GetFormatCount());
}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyHeader)
+{
+ // Given a document with 8 pages: a first page ending in a manual page break, then a multi-page
+ // floating table on pages 2..8:
+ createSwDoc("floattable-header.docx");
+ CPPUNIT_ASSERT_EQUAL(8, getPages());
+
+ // When creating a new paragraph at doc start:
+ SwDocShell* pDocShell = getSwDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ pWrtShell->SttEndDoc(/*bStt=*/true);
+ pWrtShell->SplitNode();
+ // Without the accompanying fix in place, this test would have crashed here.
+ pWrtShell->CalcLayout();
+
+ // Then make sure we get one more page, since the first page is now 2 pages:
+ CPPUNIT_ASSERT_EQUAL(9, getPages());
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */