sw/qa/extras/ooxmlexport/data/tdf149551_mongolianVert.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx                 |   25 +++++++++++++
 2 files changed, 25 insertions(+)

New commits:
commit 7d06665b7f5e7a7d1e9ac608c3bb827003fa3cb4
Author:     Regina Henschel <rb.hensc...@t-online.de>
AuthorDate: Wed Sep 14 23:41:52 2022 +0200
Commit:     Regina Henschel <rb.hensc...@t-online.de>
CommitDate: Thu Sep 15 11:17:07 2022 +0200

    tdf#149551 unit test mongolianVert in shape in Writer
    
    Commit c70ee4a6b9071468255e5d4fdb893e9c9bdf4fad has among other things
    enabled, that a shape with vert='mongolianVert' in a docx file is
    imported to a shape where the attached frame has WritingMode =
    text::WritingMode2::TB_LR and that it is then exported to a shape with
    vert='mongolianVert'.
    The unit test here tests this behavior.
    
    Change-Id: I18ef6fdcb9cbad4fdd18061aca536f95c9ea83af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139957
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.hensc...@t-online.de>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf149551_mongolianVert.docx 
b/sw/qa/extras/ooxmlexport/data/tdf149551_mongolianVert.docx
new file mode 100644
index 000000000000..2f562757a033
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf149551_mongolianVert.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index c3b38758505e..6c4eaa09fa34 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -14,6 +14,7 @@
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/text/XFootnotesSupplier.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
@@ -79,6 +80,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf147646, 
"tdf147646_mergedCellNumbering.docx")
     
CPPUNIT_ASSERT_EQUAL(OUString("2."),parseDump("/root/page/body/tab/row[4]/cell/txt/Special[@nType='PortionType::Number']","rText"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf149551_mongolianVert)
+{
+    // Given a docx document with a shape with vert="mongolianVert".
+    load(DATA_DIRECTORY, "tdf149551_mongolianVert.docx");
+
+    // The shape is imported as custom shape with attached frame.
+    // Without fix the shape itself had WritingMode = 0 = LR_TB,
+    // the frame in it had WritingMode = 2 = TB_RL.
+    // It should be WritingMode = 3 = TB_LR in both cases.
+    const sal_Int16 eExpected(text::WritingMode2::TB_LR);
+    CPPUNIT_ASSERT_EQUAL(eExpected, getProperty<sal_Int16>(getShape(1), 
"WritingMode"));
+    uno::Reference<beans::XPropertySet> xShapeProps(getShape(1), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> 
xFrameProps(xShapeProps->getPropertyValue("TextBoxContent"),
+                                                    uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(eExpected, getProperty<sal_Int16>(xFrameProps, 
"WritingMode"));
+
+    // Such shape must have vert="mongolianVert" again after saving.
+    // Without fix the orientation was vert="vert".
+    save("Office Open XML Text", maTempFile);
+    mbExported = true;
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPath(pXmlDoc, "//wps:bodyPr", "vert", "mongolianVert");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to