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 #include #include +#include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include 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 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 xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference 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(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 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: