sw/qa/extras/autocorrect/autocorrect.cxx |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit 27e8099a740562bd46d716ccc65c8fb42424a557
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Jul 16 12:44:50 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jul 16 23:39:04 2024 +0200

    tdf#42893: sw_autocorrect: Add unittest
    
    Change-Id: I9a01eafea95e121f98153f43691bdb87fbb19e69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170573
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx 
b/sw/qa/extras/autocorrect/autocorrect.cxx
index be567006a523..ef238451aee0 100644
--- a/sw/qa/extras/autocorrect/autocorrect.cxx
+++ b/sw/qa/extras/autocorrect/autocorrect.cxx
@@ -280,6 +280,23 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf57640)
     CPPUNIT_ASSERT_EQUAL(u"Dž  "_ustr, getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf62923)
+{
+    createSwDoc(); // Default lang is en-US
+    SwXTextDocument& rTextDoc = dynamic_cast<SwXTextDocument&>(*mxComponent);
+
+    OUString sReplaced(u"1–2 "_ustr);
+    // Without the fix in place, this test would have failed with
+    // - Expected: 1—2
+    // - Actual  : 1–2
+    emulateTyping(rTextDoc, u"1--2 ");
+    CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+
+    sReplaced += u"a—b "_ustr;
+    emulateTyping(rTextDoc, u"a--b ");
+    CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf42893)
 {
     createSwDoc(); // Default lang is en-US

Reply via email to