[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - desktop/qa vcl/source

Henry Castro hcastro at collabora.com
Wed May 25 23:41:18 UTC 2016


 desktop/qa/desktop_lib/test_desktop_lib.cxx |    5 ++++-
 vcl/source/outdev/font.cxx                  |   10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 260f3ff257d7839119c8221397d18a516afd8799
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue May 24 17:24:16 2016 -0400

    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

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 13382ac..98fa666 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -274,7 +274,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);
@@ -289,6 +290,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()
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index bce8651..4eb02f9 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -92,9 +92,19 @@ int OutputDevice::GetDevFontCount() const
     if( !mpGetDevFontList )
     {
         if (!mpFontCollection)
+        {
             return 0;
+        }
 
         mpGetDevFontList = mpFontCollection->GetDevFontList();
+
+        if (!mpGetDevFontList->Count())
+        {
+            delete mpGetDevFontList;
+            mpGetDevFontList = nullptr;
+
+            return 0;
+        }
     }
     return mpGetDevFontList->Count();
 }


More information about the Libreoffice-commits mailing list