summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-09-29 13:20:21 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-10-28 08:18:50 +0100
commita780fd334a3a6d9a5a300f1b0ba0e067b500dcad (patch)
tree5b414f0d494caff4887d02f8aba9d2ba1e7c13be
parent49307ae2cef2d2d43fee92f99809d2bf192343de (diff)
tdf#133358: sw_uiwriter: Add unittest
Change-Id: I148052d7038824b43ec0c473d4bcbcb64e2f92b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103608 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 416cb76758719b88a4cdefe8c9d16131c35cfdf5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104747 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 43abc73da811..d287894f94db 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -7557,6 +7557,38 @@ void SwUiWriterTest::testTdf59666()
CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf133358)
+{
+ mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ SwWrtShell* pWrtSh = pTextDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtSh);
+
+ pWrtSh->Insert("Test");
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Test"), getParagraph(1)->getString());
+
+ uno::Reference<beans::XPropertyState> xParagraph(getParagraph(1), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
+
+ lcl_dispatchCommand(mxComponent, ".uno:IncrementIndent", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1251), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
+
+ // Without the fix in place, this test would have crashed here
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1251), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();