From 5f191abb7bebe46ef0c139076857d7b982763ce4 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 11 Jun 2024 12:48:22 +0200 Subject: [PATCH] sw: fix hyphenation dependencies of CppunitTests testTdf123898 fails locally but passes on Jenkins, because in Jenkins builds the hyphenation data doesn't exist yet (as verified by a CPPUNIT_ASSERT(xHyphenator->hasLocale(lang::Locale("de", "DE", OUString()))) in first revision of this patch. Add makefile dependencies to all sw tests that call hasLocale(). The test still needs to check though in case --without-myspell-dicts is used. Failure looks ignorable, adapt the test: Test name: (anonymous namespace)::testTdf123898::TestBody equality assertion failed - Expected: PortionType::Para - Actual : PortionType::Text Change-Id: Iaa94e248b01f7bab7f8451f6b0ff08a7d0a8e9b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168669 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/CppunitTest_sw_odfexport2.mk | 8 ++++++++ sw/layoutwriter_setup.mk | 8 ++++++++ sw/ooxmlexport_setup.mk | 8 ++++++++ sw/qa/extras/layout/layout3.cxx | 6 +++++- sw/uiwriter_setup.mk | 8 ++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/sw/CppunitTest_sw_odfexport2.mk b/sw/CppunitTest_sw_odfexport2.mk index 9d5dc86145a4..fb8e5adaf14d 100644 --- a/sw/CppunitTest_sw_odfexport2.mk +++ b/sw/CppunitTest_sw_odfexport2.mk @@ -72,6 +72,14 @@ $(eval $(call gb_CppunitTest_use_uiconfigs,sw_odfexport2, \ $(eval $(call gb_CppunitTest_use_more_fonts,sw_odfexport2)) +ifneq ($(filter DICTIONARIES,$(BUILD_TYPE)),) +$(eval $(call gb_CppunitTest_use_packages,sw_odfexport2,\ + $(call gb_Dictionary_get_packagename,dict-de) \ + $(call gb_Dictionary_get_packagename,dict-en) \ + $(call gb_Dictionary_get_packagename,dict-hu) \ +)) +endif + $(eval $(call gb_CppunitTest_add_arguments,sw_odfexport2, \ -env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \ )) diff --git a/sw/layoutwriter_setup.mk b/sw/layoutwriter_setup.mk index be4902a83274..09c67e02ce9e 100644 --- a/sw/layoutwriter_setup.mk +++ b/sw/layoutwriter_setup.mk @@ -89,6 +89,14 @@ $(eval $(call gb_CppunitTest_set_non_application_font_use,sw_layoutwriter$(1),ab $(eval $(call gb_CppunitTest_use_more_fonts,sw_layoutwriter$(1))) +$(eval $(call gb_CppunitTest_use_packages,sw_layoutwriter$(1),\ + $(if $(filter DICTIONARIES,$(BUILD_TYPE)), + $(call gb_Dictionary_get_packagename,dict-de) \ + $(call gb_Dictionary_get_packagename,dict-en) \ + $(call gb_Dictionary_get_packagename,dict-hu) \ + ) \ +)) + endef # vim: set noet sw=4 ts=4: diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk index ef1cbb3bffe9..6ead5e7f1481 100644 --- a/sw/ooxmlexport_setup.mk +++ b/sw/ooxmlexport_setup.mk @@ -86,6 +86,14 @@ $(call gb_CppunitTest_get_target,sw_ooxmlexport$(1)) : $(call gb_Library_get_tar $(eval $(call gb_CppunitTest_use_more_fonts,sw_ooxmlexport$(1))) +$(eval $(call gb_CppunitTest_use_packages,sw_ooxmlexport$(1),\ + $(if $(filter DICTIONARIES,$(BUILD_TYPE)), + $(call gb_Dictionary_get_packagename,dict-de) \ + $(call gb_Dictionary_get_packagename,dict-en) \ + $(call gb_Dictionary_get_packagename,dict-hu) \ + ) \ +)) + ifeq ($(OS),WNT) # gpgme-w32spawn.exe is needed in workdir/LinkTarget/Executable $(eval $(call gb_CppunitTest_use_packages,sw_ooxmlexport$(1),\ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 852a213fbc03..22e13a117433 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1246,13 +1246,17 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf123898) // Make sure spellchecker has done its job already Scheduler::ProcessEventsToIdle(); + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("de", "DE", OUString()))) + return; + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Make sure that the arrow on the left is not there (the first portion's type is // PortionType::Arrow if it's there) assertXPath( pXmlDoc, "/root/page/body/txt/anchored/fly/txt/SwParaPortion/SwLineLayout[1]/child::*[1]"_ostr, - "type"_ostr, u"PortionType::Para"_ustr); + "type"_ostr, u"PortionType::Text"_ustr); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf123651) diff --git a/sw/uiwriter_setup.mk b/sw/uiwriter_setup.mk index d4956ecbc468..1854b04e6900 100644 --- a/sw/uiwriter_setup.mk +++ b/sw/uiwriter_setup.mk @@ -96,6 +96,14 @@ $(call gb_CppunitTest_get_target,sw_uiwriter$(1)) : $(call gb_Library_get_target $(eval $(call gb_CppunitTest_use_more_fonts,sw_uiwriter$(1))) +$(eval $(call gb_CppunitTest_use_packages,sw_uiwriter$(1),\ + $(if $(filter DICTIONARIES,$(BUILD_TYPE)), + $(call gb_Dictionary_get_packagename,dict-de) \ + $(call gb_Dictionary_get_packagename,dict-en) \ + $(call gb_Dictionary_get_packagename,dict-hu) \ + ) \ +)) + $(eval $(call gb_CppunitTest_add_arguments,sw_uiwriter$(1), \ -env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \ ))