summaryrefslogtreecommitdiff
path: root/sw/qa/core/layout/layout.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/core/layout/layout.cxx')
-rw-r--r--sw/qa/core/layout/layout.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 7f8d885301d7..73e6114ff924 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -11,6 +11,8 @@
#include <vcl/gdimtf.hxx>
+#include <wrtsh.hxx>
+
static char const DATA_DIRECTORY[] = "/sw/qa/core/layout/data/";
/// Covers sw/source/core/layout/ fixes.
@@ -92,6 +94,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlapSpacing)
CPPUNIT_ASSERT_LESS(nFlyBottom, nTableTop);
}
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards)
+{
+ // Load a document with 1 pages: empty content on first page, then 21 tables on the second page.
+ load(DATA_DIRECTORY, "tables-move-backwards.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pDocShell = pTextDoc->GetDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+
+ // Delete the content on the first page.
+ pWrtShell->SttEndDoc(/*bStart=*/true);
+ pWrtShell->EndPg(/*bSelect=*/true);
+ pWrtShell->DelLeft();
+
+ // Calc the layout and check the number of pages.
+ pWrtShell->CalcLayout();
+ xmlDocPtr pLayout = parseLayoutDump();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 2
+ // i.e. there was an unexpected 2nd page, as only 20 out of 21 tables were moved to the first
+ // page.
+ assertXPath(pLayout, "//page", 1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */