LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/unotest/source/cpp - macros_test.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 19 100.0 %
Date: 2013-07-09 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "unotest/macros_test.hxx"
      11             : 
      12             : #include <com/sun/star/frame/XComponentLoader.hpp>
      13             : #include <com/sun/star/document/MacroExecMode.hpp>
      14             : 
      15             : #include "cppunit/TestAssert.h"
      16             : #include <rtl/ustrbuf.hxx>
      17             : 
      18             : using namespace com::sun::star;
      19             : 
      20             : namespace unotest {
      21             : 
      22         446 : uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const OUString& rURL, const char* pDocService)
      23             : {
      24         446 :     uno::Reference< com::sun::star::frame::XComponentLoader> xLoader = uno::Reference< com::sun::star::frame::XComponentLoader >( mxDesktop, uno::UNO_QUERY );
      25         892 :     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > args(1);
      26         446 :     args[0].Name = "MacroExecutionMode";
      27         446 :     args[0].Handle = -1;
      28         446 :     args[0].Value <<=
      29         446 :         com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
      30         446 :     args[0].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
      31             : 
      32         446 :     if (pDocService)
      33             :     {
      34         439 :         args.realloc(2);
      35         439 :         args[1].Name = "DocumentService";
      36         439 :         args[1].Handle = -1;
      37         439 :         args[1].Value <<= OUString::createFromAscii(pDocService);
      38         439 :         args[1].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
      39             :     }
      40             : 
      41         446 :     uno::Reference< com::sun::star::lang::XComponent> xComponent= xLoader->loadComponentFromURL(rURL, OUString("_default"), 0, args);
      42         892 :     OUString sMessage = OUString( "loading failed: " ) + rURL;
      43         446 :     CPPUNIT_ASSERT_MESSAGE(OUStringToOString( sMessage, RTL_TEXTENCODING_UTF8 ).getStr( ), xComponent.is());
      44         892 :     return xComponent;
      45             : }
      46             : 
      47         192 : }
      48             : 
      49             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10