sw/qa/extras/autocorrect/autocorrect.cxx |   15 +++++++++++++++
 sw/qa/extras/autocorrect/data/el-GR.fodt |   14 ++++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit f8c89be7f1548902f8f6449222f87e00d845a303
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Jun 28 17:09:58 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jul 16 23:28:11 2024 +0200

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

diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx 
b/sw/qa/extras/autocorrect/autocorrect.cxx
index 228300d1a7ab..be567006a523 100644
--- a/sw/qa/extras/autocorrect/autocorrect.cxx
+++ b/sw/qa/extras/autocorrect/autocorrect.cxx
@@ -395,6 +395,21 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf133524_Romanian)
     CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf158051)
+{
+    createSwDoc("el-GR.fodt");
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Π Τάκης σ’ ευχαριστώ
+    // - Actual  : Π Τάκης ς’ ευχαριστώ
+    emulateTyping(*pTextDoc, u"π Τάκης σ’ ευχαριστώ");
+
+#if !defined(_WIN32) // For some reason it fails on Window. the manual test 
works fine
+    CPPUNIT_ASSERT_EQUAL(u"Π Τάκης σ’ ευχαριστώ"_ustr, 
getParagraph(1)->getString());
+#endif
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/autocorrect/data/el-GR.fodt 
b/sw/qa/extras/autocorrect/data/el-GR.fodt
new file mode 100644
index 000000000000..555f3f2e66c3
--- /dev/null
+++ b/sw/qa/extras/autocorrect/data/el-GR.fodt
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:default-style style:family="paragraph">
+   <style:text-properties fo:language="el" fo:country="GR"/>
+  </style:default-style>
+ </office:styles>
+ <office:body>
+  <office:text>
+   <text:p text:style-name="Standard"></text:p>
+  </office:text>
+ </office:body>
+</office:document>

Reply via email to