sw/qa/extras/uiwriter/uiwriter3.cxx | 31 +++++++++++++++++++++++++++++++ sw/qa/uitest/writer_tests7/tdf46561.py | 13 ------------- 2 files changed, 31 insertions(+), 13 deletions(-)
New commits: commit 4ade38b97f8c22061b612bac81f5dcd3cfb83547 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue May 4 16:32:41 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue May 4 18:33:43 2021 +0200 tdf#141613: sw_uiwriter3: fix unittest The original test added in sw/qa/uitest/writer_tests7/tdf46561.py doesn't fail without the fix in place. While at it, move the UItest to CppUnittest Change-Id: I254c4ed042b14adee8c702d4c047572e69040887 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115103 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index ba2132e0d8ed..8be4a2b208c6 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1836,6 +1836,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130629) CPPUNIT_ASSERT_EQUAL(1, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613) +{ + 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"); + + dispatchCommand(mxComponent, + ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true", + {}); + + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn")); + CPPUNIT_ASSERT_EQUAL(OUString("Test"), getParagraph(1)->getString()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xPageStyle, "HeaderIsOn")); + CPPUNIT_ASSERT_EQUAL(OUString("Test"), getParagraph(1)->getString()); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133358) { mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py index 7d43ed8505eb..1c90dc3c404a 100644 --- a/sw/qa/uitest/writer_tests7/tdf46561.py +++ b/sw/qa/uitest/writer_tests7/tdf46561.py @@ -97,17 +97,4 @@ class tdf46561(UITestCase): self.ui_test.close_doc() - # Check that former crash has been fixed - def test_tdf141613(self): - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - xArgs = mkPropertyValues({"Text": "something"}) - self.xUITest.executeCommandWithParameters(".uno:InsertText", xArgs) - self.xUITest.executeCommand(".uno:InsertPageHeader") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - # vim: set shiftwidth=4 softtabstop=4 expandtab: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits