sw/qa/extras/uiwriter/uiwriter2.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
New commits: commit f0407db318de4ab5cc3d54f2955744b0e50f9dc4 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Nov 16 16:39:26 2021 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Dec 21 23:52:10 2021 +0100 tdf#139922: sw_uiwriter3: Add unittest Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125318 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 837bb7370b702399562a3b0b4e444237c66879a8) Change-Id: I4401ba7d00dae654a6e3c897719e5f1a112a9abb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127157 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index f125356b575b..034d5aae56aa 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -517,6 +517,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245) CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, set.GetItemState(RES_BOX, false)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139922) +{ + SwDoc* const pDoc = createDoc(); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN); + Scheduler::ProcessEventsToIdle(); + + SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtSh); + + pWrtSh->Insert("this _is_ a SEntence. this _is_ a SEntence."); + + CPPUNIT_ASSERT_EQUAL(OUString("this _is_ a SEntence. this _is_ a SEntence."), + getParagraph(2)->getString()); + + //apply autocorrect StartAutoCorrect + lcl_dispatchCommand(mxComponent, ".uno:AutoFormatApply", {}); + Scheduler::ProcessEventsToIdle(); + + // Without the fix in place, this test would have failed with + // - Expected: This is a Sentence. This is a Sentence. + // - Actual : this is a Sentence. This is a Sentence. + CPPUNIT_ASSERT_EQUAL(OUString("This is a Sentence. This is a Sentence."), + getParagraph(2)->getString()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236) { load(DATA_DIRECTORY, "tdf132236.odt");