sw/CppunitTest_sw_uibase_wrtsh.mk |    4 ++++
 sw/CppunitTest_sw_unowriter.mk    |    4 ++++
 sw/qa/uibase/wrtsh/wrtsh.cxx      |   22 +++++++++++++++++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 1bef59c318827666a2aa279ba4d1f59e53890a2b
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jan 11 08:19:36 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jan 11 17:41:48 2024 +0100

    CppunitTest_sw_unowriter: turn on 
gb_CppunitTest_set_non_application_font_use
    
    And the same for CppunitTest_sw_uibase_wrtsh, which found two places
    where font fallback happens for the checkmark glyph from the Liberation
    Serif font, so explicitly set the font name in those cases to avoid the
    font fallback at a glyph level.
    
    Similar to commit dc4d7500c9d283e26d1553ce11366a217cf1f69d (Fix
    CppunitTest_sd_import_tests-smartart non_application_font_use,
    2023-10-23).
    
    Change-Id: If72e94a61ef38f2f52e677ac989f60ccdae27cd0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161911
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/CppunitTest_sw_uibase_wrtsh.mk 
b/sw/CppunitTest_sw_uibase_wrtsh.mk
index 02f54617dc22..88623b5c03fb 100644
--- a/sw/CppunitTest_sw_uibase_wrtsh.mk
+++ b/sw/CppunitTest_sw_uibase_wrtsh.mk
@@ -73,4 +73,8 @@ $(eval $(call gb_CppunitTest_use_uiconfigs,sw_uibase_wrtsh, \
 
 $(eval $(call gb_CppunitTest_use_more_fonts,sw_uibase_wrtsh))
 
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(eval $(call 
gb_CppunitTest_set_non_application_font_use,sw_uibase_wrtsh,abort))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/sw/CppunitTest_sw_unowriter.mk b/sw/CppunitTest_sw_unowriter.mk
index 9f1c586a0991..2babe32e19b1 100644
--- a/sw/CppunitTest_sw_unowriter.mk
+++ b/sw/CppunitTest_sw_unowriter.mk
@@ -76,4 +76,8 @@ $(call gb_CppunitTest_get_target,sw_unowriter): \
 
 $(eval $(call gb_CppunitTest_use_more_fonts,sw_unowriter))
 
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(eval $(call gb_CppunitTest_set_non_application_font_use,sw_unowriter,abort))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index 125a80584026..00b2d3a30ab1 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -18,6 +18,7 @@
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
 #include <comphelper/propertyvalue.hxx>
+#include <editeng/fontitem.hxx>
 
 #include <swmodeltestbase.hxx>
 #include <doc.hxx>
@@ -26,6 +27,7 @@
 #include <ndtxt.hxx>
 #include <textcontentcontrol.hxx>
 #include <fmtanchr.hxx>
+#include <view.hxx>
 
 namespace
 {
@@ -100,6 +102,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl)
     // Given a document with a checkbox (checked) content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+    // The default Liberation Serif doesn't have a checkmark glyph, avoid font 
fallback.
+    SwView& rView = pWrtShell->GetView();
+    SfxItemSetFixed<RES_CHRATR_BEGIN, RES_CHRATR_END> aSet(rView.GetPool());
+    SvxFontItem aFont(FAMILY_DONTKNOW, "DejaVu Sans", OUString(), 
PITCH_DONTKNOW,
+                      RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT);
+    aSet.Put(aFont);
+    pWrtShell->SetAttrSet(aSet);
+
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<text::XText> xText = xTextDocument->getText();
@@ -117,7 +129,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl)
     xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
 
     // When clicking on that content control:
-    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
     SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -158,6 +169,15 @@ CPPUNIT_TEST_FIXTURE(Test, 
testInsertCheckboxContentControl)
 
     // When inserting a content control:
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+    // The default Liberation Serif doesn't have a checkmark glyph, avoid font 
fallback.
+    SwView& rView = pWrtShell->GetView();
+    SfxItemSetFixed<RES_CHRATR_BEGIN, RES_CHRATR_END> aSet(rView.GetPool());
+    SvxFontItem aFont(FAMILY_DONTKNOW, "DejaVu Sans", OUString(), 
PITCH_DONTKNOW,
+                      RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT);
+    aSet.Put(aFont);
+    pWrtShell->SetAttrSet(aSet);
+
     pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
 
     // Then make sure that the matching text attribute is added to the 
document model:

Reply via email to