From 7d3ddc2c6cc39fdd671f08059528464675cd6ecc Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 5 Feb 2013 14:38:43 -0500 Subject: Pass DocumentService to the loader during macro tests. And disable user interaction during type detection, since that would cause the test to fail. With this change, 'make check' works once again. Change-Id: I2f45a2e962e45ee64f7984e794cff814fbfe6dab --- unotest/inc/unotest/macros_test.hxx | 2 +- unotest/source/cpp/macros_test.cxx | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'unotest') diff --git a/unotest/inc/unotest/macros_test.hxx b/unotest/inc/unotest/macros_test.hxx index 1a82b83fc48f..c3eb7ff5629c 100644 --- a/unotest/inc/unotest/macros_test.hxx +++ b/unotest/inc/unotest/macros_test.hxx @@ -46,7 +46,7 @@ namespace unotest { class OOO_DLLPUBLIC_UNOTEST MacrosTest { public: - com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const rtl::OUString& rURL); + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const OUString& rURL, const char* pDocService = NULL); protected: com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2> mxDesktop; diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 4d08d0488f65..be13798dd7d0 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -38,16 +38,25 @@ using namespace com::sun::star; namespace unotest { -uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const rtl::OUString& rURL) +uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const OUString& rURL, const char* pDocService) { uno::Reference< com::sun::star::frame::XComponentLoader> xLoader = uno::Reference< com::sun::star::frame::XComponentLoader >( mxDesktop, uno::UNO_QUERY ); com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > args(1); - args[0].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")); + args[0].Name = "MacroExecutionMode"; args[0].Handle = -1; args[0].Value <<= com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN; args[0].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; + + if (pDocService) + { + args.realloc(2); + args[1].Name = "DocumentService"; + args[1].Handle = -1; + args[1].Value <<= OUString::createFromAscii(pDocService); + args[1].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; + } + uno::Reference< com::sun::star::lang::XComponent> xComponent= xLoader->loadComponentFromURL(rURL, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), 0, args); rtl::OUString sMessage = rtl::OUString( "loading failed: " ) + rURL; CPPUNIT_ASSERT_MESSAGE(rtl::OUStringToOString( sMessage, RTL_TEXTENCODING_UTF8 ).getStr( ), xComponent.is()); -- cgit