summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-11-16 16:39:26 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-12-21 23:52:10 +0100
commitf0407db318de4ab5cc3d54f2955744b0e50f9dc4 (patch)
tree93b8dacda02389333bbcf878aa611c2aa7c9204e
parenttdf#139922 sw autocorr: don't return GetPrevPara if isEmpty (diff)
downloadcore-f0407db318de4ab5cc3d54f2955744b0e50f9dc4.tar.gz
core-f0407db318de4ab5cc3d54f2955744b0e50f9dc4.zip
tdf#139922: sw_uiwriter3: Add unittest
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125318 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 837bb7370b702399562a3b0b4e444237c66879a8) Change-Id: I4401ba7d00dae654a6e3c897719e5f1a112a9abb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127157 Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx27
1 files changed, 27 insertions, 0 deletions
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");