diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-16 15:41:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-11 14:23:20 +0000 |
commit | d3584878aee1bee36e9cc18e58a75dbc95b3e283 (patch) | |
tree | 001cb65688ed9fb35aa16655bf1c16d34c5be317 /sw/qa/extras | |
parent | 1673606de9a520e615e1a32da94f28d55ebaea20 (diff) |
tdf#96536 sw Hide Whitespace: shrink oversized page frames on para delete
The body frame did get a request to shrink, but because it had fixed
size, nothing happened. Trigger a recalc that does the right thing wrt.
hidden whitespace.
(cherry picked from commits 72f0067258fd7738217abd43452abe282e05c11b and
af47b54d49355a003deda722b5d0112a7b746485)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: I446978da8b33372c2ab30200b45b1bcec1dea7a0
Reviewed-on: https://gerrit.libreoffice.org/21084
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index a31dc51a8a2c..eea54dfe8fb4 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -174,6 +174,7 @@ public: void testTdf92648(); void testTdf96515(); void testTdf96479(); + void testTdf96536(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -256,6 +257,7 @@ public: CPPUNIT_TEST(testTdf92648); CPPUNIT_TEST(testTdf96515); CPPUNIT_TEST(testTdf96479); + CPPUNIT_TEST(testTdf96536); CPPUNIT_TEST_SUITE_END(); private: @@ -3001,6 +3003,30 @@ void SwUiWriterTest::testTdf96479() } } +void SwUiWriterTest::testTdf96536() +{ + // Enable hide whitespace mode. + SwDoc* pDoc = createDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); + aViewOptions.SetHideWhitespaceMode(true); + pWrtShell->ApplyViewOptions(aViewOptions); + + // Insert a new paragraph at the end of the document, and then delete it. + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XParagraphAppend> xParagraphAppend(xTextDocument->getText(), uno::UNO_QUERY); + xParagraphAppend->finishParagraph(uno::Sequence<beans::PropertyValue>()); + calcLayout(); + uno::Reference<lang::XComponent> xParagraph(getParagraph(2), uno::UNO_QUERY); + xParagraph->dispose(); + calcLayout(); + + // This was 552, page did not shrink after deleting the second paragraph. + // Expected 276, which is 12pt font size + default line spacing (15%), but + // tolerate some difference to that. + CPPUNIT_ASSERT(parseDump("/root/infos/bounds", "height").toInt32() <= 276); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |