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
This commit is contained in:
Kohei Yoshida
2013-02-05 14:38:43 -05:00
parent a0dd5a8d6a
commit 7d3ddc2c6c
17 changed files with 34 additions and 25 deletions

View File

@@ -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());