summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-01-23 15:05:21 +0100
committerLászló Németh <nemeth@numbertext.org>2019-01-24 08:17:27 +0100
commit6a54dd844d1821165642bbcc16bd12a01a23393d (patch)
tree634013af0a941375494d3df44f257aea18b845d6 /sw/qa
parentd97fc64a819f834302e384792668507df4cc412c (diff)
tdf#122901 track changes: keep paragraph top and bottom borders
applied in Show Changes mode, instead of losing them after saving the document or hiding the changes. The bug occurred in paragraphs with directly preceding tracked deletions. Change-Id: I25a84aec0159f809dd7b67d4e530e87b01070f44 Reviewed-on: https://gerrit.libreoffice.org/66800 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index c7d1ed25b446..8b05f26e6241 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -56,6 +56,7 @@ public:
void testUnfloatButtonReadOnlyMode();
void testUnfloating();
void testTdf122893();
+ void testTdf122901();
CPPUNIT_TEST_SUITE(SwUiWriterTest2);
CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -74,6 +75,7 @@ public:
CPPUNIT_TEST(testUnfloatButtonReadOnlyMode);
CPPUNIT_TEST(testUnfloating);
CPPUNIT_TEST(testTdf122893);
+ CPPUNIT_TEST(testTdf122901);
CPPUNIT_TEST_SUITE_END();
private:
@@ -738,6 +740,55 @@ void SwUiWriterTest2::testTdf122893()
sal_Int16(200), getProperty<style::LineSpacing>(getParagraph(1), "ParaLineSpacing").Height);
}
+void SwUiWriterTest2::testTdf122901()
+{
+ load(DATA_DIRECTORY, "tdf105413.fodt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ // all paragraphs with zero borders
+ for (int i = 1; i < 4; ++i)
+ {
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
+ getProperty<sal_Int32>(getParagraph(i), "ParaTopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
+ getProperty<sal_Int32>(getParagraph(i), "ParaBottomMargin"));
+ }
+
+ // turn on red-lining and show changes
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert
+ | RedlineFlags::ShowDelete);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE(
+ "redlines should be visible",
+ IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+ // Increase paragraph borders in the 3th paragraph, similar to the default icon of the UI
+ // "Increase Paragraph Spacing". Because of the tracked deleted region between them,
+ // this sets also the same formatting in the first paragraph automatically
+ // to keep the changed paragraph formatting at hiding tracked changes or saving the document
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->Down(/*bSelect=*/false);
+ pWrtShell->Down(/*bSelect=*/false);
+ pWrtShell->EndPara(/*bSelect=*/false);
+
+ lcl_dispatchCommand(mxComponent, ".uno:ParaspaceIncrease", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(101), getProperty<sal_Int32>(getParagraph(3), "ParaTopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(101),
+ getProperty<sal_Int32>(getParagraph(3), "ParaBottomMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(2), "ParaTopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(2), "ParaBottomMargin"));
+
+ // first paragraph is also center-aligned with double line spacing
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(101), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(101),
+ getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */