sw/CppunitTest_sw_cjk.mk                   |   77 ++++++++++++++++++
 sw/Module_sw.mk                            |    1 
 sw/qa/extras/cjk/cjk.cxx                   |  121 +++++++++++++++++++++++++++++
 sw/qa/extras/odfimport/odfimport.cxx       |   25 -----
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   26 ------
 sw/qa/extras/ww8export/ww8export.cxx       |   31 -------
 sw/qa/extras/ww8export/ww8export4.cxx      |    8 -
 7 files changed, 199 insertions(+), 90 deletions(-)

New commits:
commit 63ee5211a4902b7a3629737cdc0baf4fc739627e
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Dec 12 11:52:10 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sun Dec 14 21:20:05 2025 +0100

    move writer tests using CJK fonts to new target
    
    where adding a new cjk font to the bundled fonts triggers
    an abort from:
    gb_CppunitTest_set_non_application_font_use,...,abort
    
    because the docs require glyph fallback to render, but without a CJK
    font in the application fonts glyph fallback doesn't actually happen.
    But once one is added, then the fallback is detected and the check
    fires.
    
    Change-Id: If02a2c1eefd6f5b6e4a19ca46f359cce466662f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195597
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/CppunitTest_sw_cjk.mk b/sw/CppunitTest_sw_cjk.mk
new file mode 100644
index 000000000000..2324d58ffc10
--- /dev/null
+++ b/sw/CppunitTest_sw_cjk.mk
@@ -0,0 +1,77 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_cjk))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_cjk))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_cjk, \
+    sw/qa/extras/cjk/cjk \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_cjk, \
+    comphelper \
+    editeng \
+    cppu \
+    cppuhelper \
+    sal \
+    svt \
+    sfx \
+    subsequenttest \
+    svl \
+    sw \
+    swqahelper \
+    test \
+    unotest \
+    vcl \
+    tl \
+    utl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_cjk,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_cjk,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/source/uibase/inc \
+    -I$(SRCDIR)/sw/qa/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_system_win32_libs,sw_cjk,\
+    ole32 \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_cjk,\
+    udkapi \
+    offapi \
+    oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_cjk))
+$(eval $(call gb_CppunitTest_use_vcl,sw_cjk))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_cjk,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_cjk))
+
+$(eval $(call gb_CppunitTest_add_arguments,sw_cjk, \
+    
-env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}"
 \
+))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_cjk,\
+    officecfg/registry \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 2d0aa1bdd497..583d9fccee87 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -62,6 +62,7 @@ $(eval $(call gb_Module_add_check_targets,sw,\
 $(eval $(call gb_Module_add_slowcheck_targets,sw,\
        $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
                CppunitTest_sw_uwriter) \
+    CppunitTest_sw_cjk \
     CppunitTest_sw_rtfexport \
     CppunitTest_sw_rtfexport2 \
     CppunitTest_sw_rtfexport3 \
diff --git a/sw/qa/extras/cjk/cjk.cxx b/sw/qa/extras/cjk/cjk.cxx
new file mode 100644
index 000000000000..21f99af3d570
--- /dev/null
+++ b/sw/qa/extras/cjk/cjk.cxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <config_features.h>
+
+namespace
+{
+class Test : public SwModelTestBase
+{
+public:
+    Test()
+        : SwModelTestBase(u"/sw/qa/extras/cjk/data/"_ustr)
+    {
+    }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf101729)
+{
+    createSwDoc("tdf101729.odt");
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    sal_Int32 l
+        = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/infos/bounds", 
"left").toInt32();
+    sal_Int32 w
+        = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/infos/bounds", 
"width").toInt32();
+    sal_Int32 x
+        = getXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[1]/txt/infos/bounds", "left").toInt32();
+    // Make sure the text does not go outside and verify it is centered roughly
+    CPPUNIT_ASSERT(l + w / 4 < x);
+    CPPUNIT_ASSERT(x < l + 3 * w / 4);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf115079)
+{
+    createSwDoc("tdf115079.odt");
+    // This document caused segfault when layouting
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testMsWordUlTrailSpace)
+{
+    createSwDoc("UnderlineTrailingSpace.docx");
+    {
+        uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
+        uno::Reference<beans::XPropertySet> xSettings(
+            xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
+        CPPUNIT_ASSERT_EQUAL(uno::Any(true),
+                             
xSettings->getPropertyValue(u"MsWordUlTrailSpace"_ustr));
+    }
+
+    // Test also after save-and-reload:
+    saveAndReload(TestFilter::DOCX);
+    {
+        uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
+        uno::Reference<beans::XPropertySet> xSettings(
+            xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
+        CPPUNIT_ASSERT_EQUAL(uno::Any(true),
+                             
xSettings->getPropertyValue(u"MsWordUlTrailSpace"_ustr));
+    }
+
+    // Check that the compat setting is exported in OOXML
+    xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
+    assertXPath(pXmlSettings, "/w:settings/w:compat/w:ulTrailSpace");
+}
+
+DECLARE_WW8EXPORT_TEST(testWw8Cjklist30, "cjklist30.doc")
+{
+    sal_Int16 numFormat = getNumberingTypeOfParagraph(1);
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::TIAN_GAN_ZH, numFormat);
+}
+
+DECLARE_WW8EXPORT_TEST(testWw8Cjklist31, "cjklist31.doc")
+{
+    sal_Int16 numFormat = getNumberingTypeOfParagraph(1);
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::DI_ZI_ZH, numFormat);
+}
+
+DECLARE_WW8EXPORT_TEST(testWw8Cjklist34, "cjklist34.doc")
+{
+    sal_Int16 numFormat = getNumberingTypeOfParagraph(1);
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat);
+}
+
+DECLARE_WW8EXPORT_TEST(testWw8Cjklist35, "cjklist35.doc")
+{
+    sal_Int16 numFormat = getNumberingTypeOfParagraph(1);
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf118564, "tdf118564.doc")
+{
+    sal_Int16 numFormat = getNumberingTypeOfParagraph(3);
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf77964)
+{
+    createSwDoc("tdf77964.doc");
+    saveAndReload(TestFilter::DOC);
+    // both images were loading as AT_PARA instead of AS_CHAR. Image2 visually 
had text wrapping.
+    CPPUNIT_ASSERT_EQUAL(
+        text::TextContentAnchorType_AS_CHARACTER,
+        getProperty<text::TextContentAnchorType>(getShapeByName(u"Image2"), 
u"AnchorType"_ustr));
+}
+
+CPPUNIT_TEST_FIXTURE(Test, tdf167455)
+{
+    // crashes at import time on macOS
+    createSwDoc("tdf167455.odt");
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
+} // end of anonymous namespace
+CPPUNIT_PLUGIN_IMPLEMENT();
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/UnderlineTrailingSpace.docx 
b/sw/qa/extras/cjk/data/UnderlineTrailingSpace.docx
similarity index 100%
rename from sw/qa/extras/ooxmlexport/data/UnderlineTrailingSpace.docx
rename to sw/qa/extras/cjk/data/UnderlineTrailingSpace.docx
diff --git a/sw/qa/extras/ww8export/data/cjklist30.doc 
b/sw/qa/extras/cjk/data/cjklist30.doc
similarity index 100%
rename from sw/qa/extras/ww8export/data/cjklist30.doc
rename to sw/qa/extras/cjk/data/cjklist30.doc
diff --git a/sw/qa/extras/ww8export/data/cjklist31.doc 
b/sw/qa/extras/cjk/data/cjklist31.doc
similarity index 100%
rename from sw/qa/extras/ww8export/data/cjklist31.doc
rename to sw/qa/extras/cjk/data/cjklist31.doc
diff --git a/sw/qa/extras/ww8export/data/cjklist34.doc 
b/sw/qa/extras/cjk/data/cjklist34.doc
similarity index 100%
rename from sw/qa/extras/ww8export/data/cjklist34.doc
rename to sw/qa/extras/cjk/data/cjklist34.doc
diff --git a/sw/qa/extras/ww8export/data/cjklist35.doc 
b/sw/qa/extras/cjk/data/cjklist35.doc
similarity index 100%
rename from sw/qa/extras/ww8export/data/cjklist35.doc
rename to sw/qa/extras/cjk/data/cjklist35.doc
diff --git a/sw/qa/extras/odfimport/data/tdf101729.odt 
b/sw/qa/extras/cjk/data/tdf101729.odt
similarity index 100%
rename from sw/qa/extras/odfimport/data/tdf101729.odt
rename to sw/qa/extras/cjk/data/tdf101729.odt
diff --git a/sw/qa/extras/odfimport/data/tdf115079.odt 
b/sw/qa/extras/cjk/data/tdf115079.odt
similarity index 100%
rename from sw/qa/extras/odfimport/data/tdf115079.odt
rename to sw/qa/extras/cjk/data/tdf115079.odt
diff --git a/sw/qa/extras/ww8export/data/tdf118564.doc 
b/sw/qa/extras/cjk/data/tdf118564.doc
similarity index 100%
rename from sw/qa/extras/ww8export/data/tdf118564.doc
rename to sw/qa/extras/cjk/data/tdf118564.doc
diff --git a/sw/qa/extras/odfimport/data/tdf167455.odt 
b/sw/qa/extras/cjk/data/tdf167455.odt
similarity index 100%
rename from sw/qa/extras/odfimport/data/tdf167455.odt
rename to sw/qa/extras/cjk/data/tdf167455.odt
diff --git a/sw/qa/extras/ww8export/data/tdf77964.doc 
b/sw/qa/extras/cjk/data/tdf77964.doc
similarity index 100%
rename from sw/qa/extras/ww8export/data/tdf77964.doc
rename to sw/qa/extras/cjk/data/tdf77964.doc
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index c3fe3e0242bc..05992ca09f55 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -621,13 +621,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128737)
     CPPUNIT_ASSERT_EQUAL(8, getShapes());
 }
 
-CPPUNIT_TEST_FIXTURE(Test, tdf167455)
-{
-    // crashes at import time on macOS
-    createSwDoc("tdf167455.odt");
-    CPPUNIT_ASSERT_EQUAL(1, getPages());
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testCalcFootnoteContent)
 {
     createSwDoc("ooo32780-1.odt");
@@ -966,18 +959,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf75221)
     CPPUNIT_ASSERT(top.toInt32() > 0);
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf101729)
-{
-    createSwDoc("tdf101729.odt");
-    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-    sal_Int32 l = getXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[1]/infos/bounds", "left").toInt32();
-    sal_Int32 w = getXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[1]/infos/bounds", "width").toInt32();
-    sal_Int32 x = getXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[1]/txt/infos/bounds", "left").toInt32();
-    // Make sure the text does not go outside and verify it is centered roughly
-    CPPUNIT_ASSERT( l + w / 4 < x  );
-    CPPUNIT_ASSERT( x < l + 3 * w / 4);
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testTdf107392)
 {
     createSwDoc("tdf107392.odt");
@@ -1091,12 +1072,6 @@ CPPUNIT_TEST_FIXTURE(Test, testBlankBeforeFirstPage)
     );
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf115079)
-{
-    createSwDoc("tdf115079.odt");
-    // This document caused segfault when layouting
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testTdf108482)
 {
     createSwDoc("tdf108482.odt");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 1c0f9240d9da..681e32251952 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -1342,32 +1342,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf164176, "tdf164176.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), sPresentation.indexOf("_x000a_"));
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testMsWordUlTrailSpace)
-{
-    createSwDoc("UnderlineTrailingSpace.docx");
-    {
-        uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
-        uno::Reference<beans::XPropertySet> xSettings(
-            xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
-        CPPUNIT_ASSERT_EQUAL(uno::Any(true),
-                             
xSettings->getPropertyValue(u"MsWordUlTrailSpace"_ustr));
-    }
-
-    // Test also after save-and-reload:
-    saveAndReload(TestFilter::DOCX);
-    {
-        uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
-        uno::Reference<beans::XPropertySet> xSettings(
-            xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
-        CPPUNIT_ASSERT_EQUAL(uno::Any(true),
-                             
xSettings->getPropertyValue(u"MsWordUlTrailSpace"_ustr));
-    }
-
-    // Check that the compat setting is exported in OOXML
-    xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
-    assertXPath(pXmlSettings, "/w:settings/w:compat/w:ulTrailSpace");
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testTdf165059_moveFromTo)
 {
     createSwDoc("tdf165059_broken.docx");
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 0eea4f3ec8da..691f64f8eeac 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -1273,37 +1273,6 @@ DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc")
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), 
xParameters->getByName(u"MaxLength"_ustr).get<sal_uInt16>());
 }
 
-
-DECLARE_WW8EXPORT_TEST(testWw8Cjklist30, "cjklist30.doc")
-{
-    sal_Int16   numFormat = getNumberingTypeOfParagraph(1);
-    CPPUNIT_ASSERT_EQUAL(style::NumberingType::TIAN_GAN_ZH, numFormat);
-}
-
-DECLARE_WW8EXPORT_TEST(testWw8Cjklist31, "cjklist31.doc")
-{
-    sal_Int16   numFormat = getNumberingTypeOfParagraph(1);
-    CPPUNIT_ASSERT_EQUAL(style::NumberingType::DI_ZI_ZH, numFormat);
-}
-
-DECLARE_WW8EXPORT_TEST(testWw8Cjklist34, "cjklist34.doc")
-{
-    sal_Int16   numFormat = getNumberingTypeOfParagraph(1);
-    CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat);
-}
-
-DECLARE_WW8EXPORT_TEST(testWw8Cjklist35, "cjklist35.doc")
-{
-    sal_Int16   numFormat = getNumberingTypeOfParagraph(1);
-    CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
-}
-
-DECLARE_WW8EXPORT_TEST(testTdf118564, "tdf118564.doc")
-{
-    sal_Int16   numFormat = getNumberingTypeOfParagraph(3);
-    CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
-}
-
 DECLARE_WW8EXPORT_TEST(testTdf92281, "tdf92281.doc")
 {
         uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), 
uno::UNO_QUERY);
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 5db68c88b8a2..44e1d5301113 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -51,14 +51,6 @@ public:
     }
 };
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf77964)
-{
-    createSwDoc("tdf77964.doc");
-    saveAndReload(TestFilter::DOC);
-    // both images were loading as AT_PARA instead of AS_CHAR. Image2 visually 
had text wrapping.
-    CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, 
getProperty<text::TextContentAnchorType>(getShapeByName(u"Image2"), 
u"AnchorType"_ustr));
-}
-
 DECLARE_WW8EXPORT_TEST(testTdf72511_editengLRSpace, 
"tdf72511_editengLRSpace.doc")
 {
     // given a default paragraph style with a left indent of 2 inches,

Reply via email to