summaryrefslogtreecommitdiff
path: root/unotest
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-02-05 14:38:43 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-02-05 14:40:58 -0500
commit7d3ddc2c6cc39fdd671f08059528464675cd6ecc (patch)
treeb5e941937065d769dc9bdaa0ce144d1f91585360 /unotest
parenta0dd5a8d6a9213ad40d738f8639e1500a1b59caa (diff)
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
Diffstat (limited to 'unotest')
-rw-r--r--unotest/inc/unotest/macros_test.hxx2
-rw-r--r--unotest/source/cpp/macros_test.cxx15
2 files changed, 13 insertions, 4 deletions
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());