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 dc4d7500c9
(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 <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
parent
e78bce3c1d
commit
1bef59c318
3 changed files with 29 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue