diff options
author | Henry Castro <hcastro@collabora.com> | 2016-11-20 19:37:25 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2016-11-22 00:56:46 +0000 |
commit | 3aac26671d9a14681dd505d86b58cd6e157434a4 (patch) | |
tree | 6b49942f2e7d41d84d3dd0bcfeefa341a039427e /desktop/qa | |
parent | f1034343b4a8fe5b540d07029cd97bba7208c9b5 (diff) |
lok: add command values .uno:FontSubset
Conflicts:
desktop/Library_sofficeapp.mk
Change-Id: Id36a98c32f0eb5e88e4e9a714e260a71d7465c05
Reviewed-on: https://gerrit.libreoffice.org/31033
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 11c8db46ebc5..72009670eb03 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/text/TextContentAnchorType.hpp> #include <boost/property_tree/json_parser.hpp> #include <comphelper/processfactory.hxx> +#include <rtl/uri.hxx> #include <sfx2/objsh.hxx> #include <sfx2/lokhelper.hxx> #include <test/unoapi_test.hxx> @@ -103,6 +104,7 @@ public: void testRedlineCalc(); void testPaintPartTile(); void testWriterCommentInsertCursor(); + void testGetFontSubset(); CPPUNIT_TEST_SUITE(DesktopLOKTest); CPPUNIT_TEST(testGetStyles); @@ -135,6 +137,7 @@ public: CPPUNIT_TEST(testRedlineCalc); CPPUNIT_TEST(testPaintPartTile); CPPUNIT_TEST(testWriterCommentInsertCursor); + CPPUNIT_TEST(testGetFontSubset); CPPUNIT_TEST_SUITE_END(); uno::Reference<lang::XComponent> mxComponent; @@ -1623,6 +1626,30 @@ void DesktopLOKTest::testWriterCommentInsertCursor() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testGetFontSubset() +{ + comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + OUString aFontName = rtl::Uri::encode( + OUString("Liberation Sans"), + rtl_UriCharClassRelSegment, + rtl_UriEncodeKeepEscapes, + RTL_TEXTENCODING_UTF8 + ); + OUString aUnoFontSubset(".uno:FontSubset&name="); + OString aCommand = OUStringToOString(aUnoFontSubset + aFontName, RTL_TEXTENCODING_UTF8); + boost::property_tree::ptree aTree; + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aCommand.getStr()); + 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:FontSubset" ); + boost::property_tree::ptree aValues = aTree.get_child("commandValues"); + CPPUNIT_ASSERT( aValues.size() > 0 ); + free(pJSON); + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); CPPUNIT_PLUGIN_IMPLEMENT(); |