LCOV - code coverage report
Current view: top level - unotest/source/cpp - macros_test.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 21 0.0 %
Date: 2014-04-14 Functions: 0 3 0.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           0 : uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const OUString& rURL, const OUString& rDocService)
      23             : {
      24           0 :     CPPUNIT_ASSERT_MESSAGE("no desktop", mxDesktop.is());
      25           0 :     uno::Reference< com::sun::star::frame::XComponentLoader> xLoader = uno::Reference< com::sun::star::frame::XComponentLoader >( mxDesktop, uno::UNO_QUERY );
      26           0 :     CPPUNIT_ASSERT_MESSAGE("no loader", xLoader.is());
      27           0 :     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > args(1);
      28           0 :     args[0].Name = "MacroExecutionMode";
      29           0 :     args[0].Handle = -1;
      30           0 :     args[0].Value <<=
      31           0 :         com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
      32           0 :     args[0].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
      33             : 
      34           0 :     if (!rDocService.isEmpty())
      35             :     {
      36           0 :         args.realloc(2);
      37           0 :         args[1].Name = "DocumentService";
      38           0 :         args[1].Handle = -1;
      39           0 :         args[1].Value <<= rDocService;
      40           0 :         args[1].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
      41             :     }
      42             : 
      43           0 :     uno::Reference< com::sun::star::lang::XComponent> xComponent= xLoader->loadComponentFromURL(rURL, OUString("_default"), 0, args);
      44           0 :     OUString sMessage = "loading failed: " + rURL;
      45           0 :     CPPUNIT_ASSERT_MESSAGE(OUStringToOString( sMessage, RTL_TEXTENCODING_UTF8 ).getStr( ), xComponent.is());
      46           0 :     return xComponent;
      47             : }
      48             : 
      49           0 : }
      50             : 
      51             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10