summaryrefslogtreecommitdiff
path: root/desktop/qa
diff options
context:
space:
mode:
authorMihai Varga <mihai.varga@collabora.com>2015-09-10 11:31:48 +0300
committerMihai Varga <mihai.mv13@gmail.com>2015-09-10 11:34:32 +0300
commit1806882317af1162edce5c2389c9c5eeb18455ac (patch)
tree4711e91a2ea9ab67ace8c6af311cf207479ec328 /desktop/qa
parent39975c477a38be613e9e162acb6de241999f0ae1 (diff)
LOK: getFonts method
Returns a json mapping of the available fonts to their possible font sizes Change-Id: I80c0bdd79e3ef2d814f64b8d38143d6c2b9ca720
Diffstat (limited to 'desktop/qa')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 842d209f8fb3..a08961403aac 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -49,6 +49,7 @@ public:
void runAllTests();
void testGetStyles();
+ void testGetFonts();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
CPPUNIT_TEST(runAllTests);
@@ -81,6 +82,7 @@ void DesktopLOKTest::closeDoc()
void DesktopLOKTest::runAllTests()
{
testGetStyles();
+ testGetFonts();
}
void DesktopLOKTest::testGetStyles()
@@ -112,6 +114,26 @@ void DesktopLOKTest::testGetStyles()
closeDoc();
}
+void DesktopLOKTest::testGetFonts()
+{
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+ boost::property_tree::ptree aTree;
+ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CharFontName");
+ std::stringstream aStream(pJSON);
+ boost::property_tree::read_json(aStream, aTree);
+ CPPUNIT_ASSERT( aTree.size() > 0 );
+ CPPUNIT_ASSERT( aTree.get_child("commandName").get_value<std::string>() == ".uno:CharFontName" );
+
+ boost::property_tree::ptree aValues = aTree.get_child("commandValues");
+ CPPUNIT_ASSERT( aValues.size() > 0 );
+ for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aValues)
+ {
+ // check that we have font sizes available for each font
+ CPPUNIT_ASSERT( rPair.second.size() > 0);
+ }
+ closeDoc();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
CPPUNIT_PLUGIN_IMPLEMENT();