diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-29 13:20:21 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-29 17:27:56 +0200 |
commit | 416cb76758719b88a4cdefe8c9d16131c35cfdf5 (patch) | |
tree | 2ce00c41185419dba08467d646aa5954f81e4245 /sw | |
parent | da8a6139cc338b682cd4d87bdb9202882093c94c (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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index b3eda5512555..6ce22aa051df 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1161,6 +1161,38 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132744) CPPUNIT_ASSERT_EQUAL(1, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, 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")); + + dispatchCommand(mxComponent, ".uno:IncrementIndent", {}); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1251), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); + + 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 + dispatchCommand(mxComponent, ".uno:Redo", {}); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1251), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf80663) { mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); |