summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-05-13 21:41:40 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-14 09:12:51 +0200
commitc4589dd7141f931513827367b457f481d960b774 (patch)
tree811b10a1b1b4fa0ba4f2b3ae1084c0237c735583 /sw/qa/extras
parent642389768e634b739a1d8354259b16bfcc695d17 (diff)
tdf#118719 sw Hide Whitespace: fix height of last-but-one page
Regression from commit 49b67cdc36b599f865d4a6de214d901861f27196 (tdf#96961 sw Hide Whitespace: still show whitespace on the last page, 2016-01-08), the problem was that in case a page used to be the last one but no longer is, then its height was kept unchanged. Fix this by invalidating the size of the old last page after the insertion of the new last page, this way SwPageFrame::MakeAll() will be called later to resize the page. Change-Id: I672a70a77af5d306b1f8bd0b5ad6c2e375497124 Reviewed-on: https://gerrit.libreoffice.org/72256 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/layout/layout.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index af45e6ba8db4..e06bfd84b3a3 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -40,7 +40,10 @@ protected:
SwDoc* SwLayoutWriter::createDoc(const char* pName)
{
- load(DATA_DIRECTORY, pName);
+ if (!pName)
+ loadURL("private:factory/swriter", nullptr);
+ else
+ load(DATA_DIRECTORY, pName);
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
@@ -2973,6 +2976,28 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116501)
createDoc("tdf116501.odt");
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118719)
+{
+ // Insert a page break.
+ SwDoc* pDoc = createDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+ // Enable hide whitespace mode.
+ SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
+ aViewOptions.SetHideWhitespaceMode(true);
+ pWrtShell->ApplyViewOptions(aViewOptions);
+
+ pWrtShell->Insert("first");
+ pWrtShell->InsertPageBreak();
+ pWrtShell->Insert("second");
+
+ // Without the accompanying fix in place, this test would have failed, as the height of the
+ // first page was 15840 twips, instead of the much smaller 276.
+ sal_Int32 nOther = parseDump("/root/page[1]/infos/bounds", "height").toInt32();
+ sal_Int32 nLast = parseDump("/root/page[2]/infos/bounds", "height").toInt32();
+ CPPUNIT_ASSERT_GREATER(nOther, nLast);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */