Initialize the font list before querying it

And the vcl_fontmetric test must depend on more_fonts. This way
there should never be a missing font, so just assert on it.

Change-Id: If3b71d7c3e52f1beeda73197c56f5efc6a83dbb4
Reviewed-on: https://gerrit.libreoffice.org/74717
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
Jan-Marek Glogowski 2019-06-24 08:47:57 +02:00
parent 6583b2fb94
commit 2ec032e01f
3 changed files with 4 additions and 4 deletions

View file

@ -50,4 +50,6 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_fontmetric,\
harfbuzz \
))
$(eval $(call gb_CppunitTest_use_more_fonts,vcl_fontmetric))
# vim: set noet sw=4 ts=4:

View file

@ -35,16 +35,13 @@ public:
void FontFeatureTest::testGetFontFeatures()
{
// "Linux Libertine G" is a font bundled with LO, but sometimes the
// bundled fonts aren't available so we need to disable test in that case
#if HAVE_MORE_FONTS
ScopedVclPtrInstance<VirtualDevice> aVDev(*Application::GetDefaultDevice(),
DeviceFormat::DEFAULT, DeviceFormat::DEFAULT);
aVDev->SetOutputSizePixel(Size(10, 10));
OUString aFontName("Linux Libertine G");
if (aVDev->IsFontAvailable(aFontName))
return; // Can't test this because the font is not available, so exit
CPPUNIT_ASSERT(aVDev->IsFontAvailable(aFontName));
vcl::Font aFont = aVDev->GetFont();
aFont.SetFamilyName(aFontName);

View file

@ -90,6 +90,7 @@ int OutputDevice::GetDevFontCount() const
bool OutputDevice::IsFontAvailable( const OUString& rFontName ) const
{
ImplInitFontList();
PhysicalFontFamily* pFound = mxFontCollection->FindFontFamily( rFontName );
return (pFound != nullptr);
}