sw/qa/extras/uiwriter/uiwriter3.cxx |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

New commits:
commit 837bb7370b702399562a3b0b4e444237c66879a8
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Nov 16 16:39:26 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Nov 16 19:40:51 2021 +0100

    tdf#139922: sw_uiwriter3: Add unittest
    
    Change-Id: I4401ba7d00dae654a6e3c897719e5f1a112a9abb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125318
    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 b90e5d18ee56..b2d65f2f7233 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -837,6 +837,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139922)
+{
+    SwDoc* const pDoc = createSwDoc();
+    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
+    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(SwUiWriterTest3, testTdf125261)
 {
     createSwDoc(DATA_DIRECTORY, "tdf125261.odt");

Reply via email to