diff options
author | László Németh <nemeth@numbertext.org> | 2020-06-25 10:54:41 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-06-26 09:03:19 +0200 |
commit | 8d4b6e5858935c4a32f89b9e09c5f1084d34a04c (patch) | |
tree | 5e5aa0586a6cf9c0d7e89da37e0070952e5b3e35 /sw | |
parent | 70ee8666edb0851222550029e445ef61434a0376 (diff) |
tdf#123786 AutoCorrect: fix apostrophe in Russian
and Ukrainian at "Single quotes" replacement
outside of second level quotations.
For example:
„quote' -> „quote‘
but now
apostrophe' -> apostrophe’
instead of the bad
apostrophe' -> apostrophe“
Change-Id: Iad69b7f88ab9677f25ee0f806d035e16cdebe29b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97096
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf123786.fodt | 14 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 27 |
2 files changed, 41 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf123786.fodt b/sw/qa/extras/uiwriter/data/tdf123786.fodt new file mode 100644 index 000000000000..8eb85164bb5e --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf123786.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="ru" fo:country="RU"/> + </style:default-style> + </office:styles> + <office:body> + <office:text> + <text:p text:style-name="Standard"></text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 774bfbab8092..68ad3415a08a 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -370,6 +370,7 @@ public: void testTdf59666(); void testTdf133524(); void testTdf128860(); + void testTdf123786(); void testTdf133589(); void testInconsistentBookmark(); void testInsertLongDateFormat(); @@ -588,6 +589,7 @@ public: CPPUNIT_TEST(testTdf59666); CPPUNIT_TEST(testTdf133524); CPPUNIT_TEST(testTdf128860); + CPPUNIT_TEST(testTdf123786); CPPUNIT_TEST(testTdf133589); CPPUNIT_TEST(testInsertLongDateFormat); #if HAVE_FEATURE_PDFIUM @@ -7275,6 +7277,31 @@ void SwUiWriterTest::testTdf128860() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } +void SwUiWriterTest::testTdf123786() +{ + SwDoc* pDoc = createDoc("tdf123786.fodt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + // Second level ending quote: „word' -> „word“ + SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); + pWrtShell->Insert(u"„слово"); + pWrtShell->AutoCorrect(corr, '\''); + sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + OUString sReplaced(u"„слово“"); + CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); + // Us apostrophe without preceding starting quote: word' -> word’ + pWrtShell->Insert(u" слово"); + pWrtShell->AutoCorrect(corr, '\''); + nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + sReplaced += u" слово’"; + CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); + // But only after letters: word.' -> word.“ + pWrtShell->Insert(u" слово."); + pWrtShell->AutoCorrect(corr, '\''); + nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + sReplaced += u" слово.“"; + CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); +} + void SwUiWriterTest::testTdf133589() { // Hungarian test document with right-to-left paragraph setting |