diff options
author | László Németh <nemeth@numbertext.org> | 2020-05-29 16:46:44 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-05-31 23:13:59 +0200 |
commit | a0c90f1bccd9b5a349d3199746facab549f27dba (patch) | |
tree | bfbcd83d624c46a5d54317d20f450c896c51b2ce /sw | |
parent | 57f07b1d7378d218648667c5b1315cc8ad905875 (diff) |
tdf#128860 AutoCorrect: fix apostrophe in Czech, German,
Icelandic, Slovak and Slovene 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: Ie6d367639cb80ec9f11e4d824b87f537e5285182
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95213
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf128860.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/tdf128860.fodt b/sw/qa/extras/uiwriter/data/tdf128860.fodt new file mode 100644 index 000000000000..5e93b60f667b --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf128860.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="de" fo:country="DE"/> + </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 9ba5cb946328..1cdc40cc43a6 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -369,6 +369,7 @@ public: void testTdf38394(); void testTdf59666(); void testTdf133524(); + void testTdf128860(); void testInconsistentBookmark(); #if HAVE_FEATURE_PDFIUM void testInsertPdf(); @@ -584,6 +585,7 @@ public: CPPUNIT_TEST(testTdf38394); CPPUNIT_TEST(testTdf59666); CPPUNIT_TEST(testTdf133524); + CPPUNIT_TEST(testTdf128860); #if HAVE_FEATURE_PDFIUM CPPUNIT_TEST(testInsertPdf); #endif @@ -7240,6 +7242,31 @@ void SwUiWriterTest::testTdf133524() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } +void SwUiWriterTest::testTdf128860() +{ + SwDoc* pDoc = createDoc("tdf128860.fodt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + // Second level ending quote: ‚word' -> ,word‘ + SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); + pWrtShell->Insert(u"‚word"); + pWrtShell->AutoCorrect(corr, '\''); + sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + OUString sReplaced(u"‚word‘"); + CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); + // Us apostrophe without preceding starting quote: word' -> word’ + pWrtShell->Insert(u" word"); + pWrtShell->AutoCorrect(corr, '\''); + nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + sReplaced += u" word’"; + CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); + // But only after letters: word.' -> word.‘ + pWrtShell->Insert(u" word."); + pWrtShell->AutoCorrect(corr, '\''); + nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + sReplaced += u" word.‘"; + CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); +} + #if HAVE_FEATURE_PDFIUM void SwUiWriterTest::testInsertPdf() { |