summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2023-08-15 14:56:53 +0200
committerHossein <hossein@libreoffice.org>2023-08-21 14:26:51 +0200
commit40ed8dd3a5a16f21f2e98440c62efa0fa6ec60ff (patch)
treece7605ffe666cfaf53bebb039d3dad2a1e13bebe /sw/qa
parent8ec43f37a7a5babe9227a5ca1ea84720fc2e15e5 (diff)
tdf#155470 DOCX export: fix RTL numbers changed to LTR
When using numerals in "context" mode in "Tools > Options", in "Language Settings > Complext Text Layout > General Options > Numerals", the actual display of the numbers is dependant on the direction and the language of those numbers. Previously, when exporting the DOCX in LO the RTL direction was lost, and because of that, the numerals were shown incorrectly after saving in LibreOffice, and loading again. This patch adds <w:rtl/> where <w:lang> contains an RTL language. For example, before <w:lang w:bidi="fa-IR"/> inside <w:rPr>, it always adds <w:rtl/>. It is worth noting that this is not always the case, as there are situations that <w:rtl/> is not present in <w:rPr> with an RTL language like <w:lang w:bidi="fa-IR"/> and <w:rtl/> should not be in the output. This patch does not handle that case, because currently loading such a text is not done correctly in LO, and the LTR numbers inside RTL environment are shown just like RTL numbers. To fix it, first loading and displaying of that should be fixed. A test is added to check the export of the sample file, which can be invoked with: make CppunitTest_sw_ooxmlexport CPPUNIT_TEST_NAME=testTdf155470 Change-Id: I8fc54916fcd3295010c5c81ccb632bc6082ffaa2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155721 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/numbers-rtl.docxbin0 -> 12059 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport3.cxx2
3 files changed, 10 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/numbers-rtl.docx b/sw/qa/extras/ooxmlexport/data/numbers-rtl.docx
new file mode 100755
index 000000000000..2142967a3619
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/numbers-rtl.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cbca150319b7..60e097925829 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1106,6 +1106,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115094v3)
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", "1064");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf155470)
+{
+ loadAndSave("numbers-rtl.docx");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+ // Make sure that <w:rtl/> is preserved
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:rtl");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index db2abe3513a7..9458051ea6d3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -174,7 +174,7 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleInheritance)
// We output exactly 2 properties in rPrDefault, nothing else was
// introduced as an additional default
- assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/*", 2);
+ assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/*", 3);
// Check that we output real content of rPrDefault
assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "ascii", "Times New Roman");
assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:lang", "bidi", "ar-SA");