summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-06-14 09:22:35 +0200
committerLászló Németh <nemeth@numbertext.org>2021-07-03 17:25:44 +0200
commitf5ff7a967b09a715c56630aff92cfb636e7c232b (patch)
treea1ce6be8aa7037ecad6cc3599240285ca9d8e3af /sw/qa
parent35dd9c4f38dd2019e18f97d8a08ce5bb9b69a4fb (diff)
tdf#143176 Old Hungarian transliteration: fix AutoCorrect->Apply
and "Apply and Edit Changes". Transliteration worked only during typing, because AutoCorrect->Apply and "Apply and Edit Changes" remove right-to-left text direction silently, which resulted missing transliteration of text (with Default Paragraph Style and right-to-left direction) to Old Hungarian. Change-Id: I1481d958494828b6dce66f2eeecb44b327c70db4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118346 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/data/tdf143176.fodt20
-rw-r--r--sw/qa/extras/uiwriter/uiwriter4.cxx20
2 files changed, 40 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf143176.fodt b/sw/qa/extras/uiwriter/data/tdf143176.fodt
new file mode 100644
index 000000000000..fdd89c38da3c
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf143176.fodt
@@ -0,0 +1,20 @@
+<?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="hu" fo:country="HU" style:writing-mode="rl-tb"/>
+ </style:default-style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" style:writing-mode="rl-tb"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:body>
+ <office:text>
+ <text:p text:style-name="P1">Lorem ipsum dolor sit amet,</text:p>
+ <text:p text:style-name="P1">consectetur adipiscing elit.</text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 1c8e3ad1fbaf..d93447d71dc2 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -271,6 +271,7 @@ public:
void testTdf128860();
void testTdf123786();
void testTdf133589();
+ void testTdf143176();
void testInconsistentBookmark();
void testInsertLongDateFormat();
void testSpellOnlineParameter();
@@ -386,6 +387,7 @@ public:
CPPUNIT_TEST(testTdf128860);
CPPUNIT_TEST(testTdf123786);
CPPUNIT_TEST(testTdf133589);
+ CPPUNIT_TEST(testTdf143176);
CPPUNIT_TEST(testInsertLongDateFormat);
CPPUNIT_TEST(testSpellOnlineParameter);
CPPUNIT_TEST(testRedlineAutoCorrect);
@@ -3570,6 +3572,24 @@ void SwUiWriterTest4::testTdf133589()
CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
}
+void SwUiWriterTest4::testTdf143176()
+{
+ // Hungarian test document with right-to-left paragraph setting
+ createSwDoc(DATA_DIRECTORY, "tdf143176.fodt");
+
+ // transliterate the document to Old Hungarian (note: it only works
+ // with right-to-left text direction and Default Paragraph Style)
+ dispatchCommand(mxComponent, ".uno:AutoFormatApply", {});
+
+ // This was the original "Lorem ipsum..."
+ CPPUNIT_ASSERT_EQUAL(OUString(u"𐲖𐳛𐳢𐳉𐳘 𐳐𐳠𐳤𐳪𐳘 𐳇𐳛𐳖𐳛𐳢 "
+ u"𐳤𐳐𐳦 𐳀𐳘𐳉𐳦⹁"),
+ getParagraph(1)->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString(u"𐳄𐳛𐳙𐳤𐳉𐳄𐳦𐳉𐳦𐳪𐳢 "
+ u"𐳀𐳇𐳐𐳠𐳐𐳤𐳄𐳐𐳙𐳍 𐳉𐳖𐳐𐳦."),
+ getParagraph(2)->getString());
+}
+
void SwUiWriterTest4::testInsertLongDateFormat()
{
// only for Hungarian, yet