lok: reset the font list when there are no items

In the pre-init stage the devices were initialized with no
font list, but later the font list is updated. So those devices
were not updated.

Change-Id: I157d4c7079f9b1252916eb92b512aadb8e77329f
Reviewed-on: https://gerrit.libreoffice.org/25419
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Henry Castro 2016-05-24 17:24:16 -04:00 committed by Ashod Nakashian
parent 61b43a02cc
commit b2f994469f
2 changed files with 14 additions and 1 deletions

View File

@ -270,7 +270,8 @@ void DesktopLOKTest::testGetStyles()
void DesktopLOKTest::testGetFonts()
{
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_presentation.odp");
boost::property_tree::ptree aTree;
char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CharFontName");
std::stringstream aStream(pJSON);
@ -285,6 +286,8 @@ void DesktopLOKTest::testGetFonts()
// check that we have font sizes available for each font
CPPUNIT_ASSERT( rPair.second.size() > 0);
}
free(pJSON);
comphelper::LibreOfficeKit::setActive(false);
}
void DesktopLOKTest::testCreateView()

View File

@ -74,9 +74,19 @@ int OutputDevice::GetDevFontCount() const
if( !mpDeviceFontList )
{
if (!mpFontCollection)
{
return 0;
}
mpDeviceFontList = mpFontCollection->GetDeviceFontList();
if (!mpDeviceFontList->Count())
{
delete mpDeviceFontList;
mpDeviceFontList = nullptr;
return 0;
}
}
return mpDeviceFontList->Count();
}