[Libreoffice-commits] core.git: editeng/source sw/qa

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 31 11:52:36 UTC 2019


 editeng/source/misc/svxacorr.cxx   |    4 ++++
 sw/qa/extras/uiwriter/uiwriter.cxx |   16 ++++++++++++++++
 2 files changed, 20 insertions(+)

New commits:
commit 04ef45a6dd7692c6ee08769c4ac4a0e92a0b64b8
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Sun Dec 29 17:46:56 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Dec 31 12:52:04 2019 +0100

    tdf#59666 AutoCorrect: don't capitalize single Greek letters
    
    in automatic sentence capitalization (except in Greek texts),
    to keep the requested lower case scientific and mathematical symbols.
    
    Change-Id: I0c658bb69fb90e7159665939f85f1fd99477c730
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85955
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index b023c34ade72..f1a682b6d5fd 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -890,6 +890,10 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
         lcl_IsInAsciiArr( ".-)>", *pDelim ) )
         return;
 
+    // tdf#59666 don't capitalize single Greek letters (except in Greek texts)
+    if ( 1 == pDelim - pWordStt && 0x03B1 <= *pWordStt && *pWordStt <= 0x03C9 && eLang != LANGUAGE_GREEK )
+        return;
+
     if( !bAtStart ) // Still no beginning of a paragraph?
     {
         if (NonFieldWordDelim(*pStr))
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 32fa64f16d45..db26e92aca24 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -363,6 +363,7 @@ public:
     void testTdf106164();
     void testTdf54409();
     void testTdf38394();
+    void testTdf59666();
     void testInconsistentBookmark();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
@@ -569,6 +570,7 @@ public:
     CPPUNIT_TEST(testTdf106164);
     CPPUNIT_TEST(testTdf54409);
     CPPUNIT_TEST(testTdf38394);
+    CPPUNIT_TEST(testTdf59666);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -7083,6 +7085,20 @@ void SwUiWriterTest::testTdf38394()
     CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
 }
 
+void SwUiWriterTest::testTdf59666()
+{
+    SwDoc* pDoc = createDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    // testing missing autocorrect of single Greek letters
+    SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
+    pWrtShell->Insert(u"\u03C0");
+    const sal_Unicode cChar = ' ';
+    pWrtShell->AutoCorrect(corr, cChar);
+    sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+    OUString sReplaced(u"\u03C0 ");
+    CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


More information about the Libreoffice-commits mailing list