summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-04-05 23:07:18 +0200
committerDavid Ostrovsky <David.Ostrovsky@gmx.de>2013-04-09 05:52:49 +0000
commitebeae438dbaa3e9f1cda33a17c4a6530feac80d9 (patch)
tree8506c0fc72da662187c11a00950ac17a240623eb /test
parent0e68bac85293e2d60fa6db3e46de8b74ab5d502b (diff)
move Python tests in-process
This is nice to make them more easily debuggable. A series of crude hacks are employed to bootstrap enough services from python so the current tests run. This is only tested with system python3 on Fedora. Change-Id: I5e06741e55ead7fddec41ff776ff8ca5d2399469 Reviewed-on: https://gerrit.libreoffice.org/3215 Reviewed-by: David Ostrovsky <David.Ostrovsky@gmx.de> Tested-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/inc/test/bootstrapfixture.hxx3
-rw-r--r--test/source/bootstrapfixture.cxx43
2 files changed, 35 insertions, 11 deletions
diff --git a/test/inc/test/bootstrapfixture.hxx b/test/inc/test/bootstrapfixture.hxx
index 4896d8a3dec1..dc807312f25d 100644
--- a/test/inc/test/bootstrapfixture.hxx
+++ b/test/inc/test/bootstrapfixture.hxx
@@ -57,9 +57,10 @@ class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
{
bool m_bNeedUCB;
bool m_bAssertOnDialog;
- DECL_LINK( ImplInitFilterHdl, ConvertData* );
public:
+ DECL_STATIC_LINK( BootstrapFixture, ImplInitFilterHdl, ConvertData* );
+
BootstrapFixture( bool bAssertOnDialog = true, bool bNeedUCB = true );
virtual ~BootstrapFixture();
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index 3a6e1eb23956..e898e1cf66a9 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -65,12 +65,13 @@ test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB )
{
}
-void test::BootstrapFixture::setUp()
+extern "C"
{
- test::BootstrapFixtureBase::setUp();
+void test_init_impl(bool bAssertOnDialog, bool bNeedUCB,
+ lang::XMultiServiceFactory * pSFactory)
+{
// force locale (and resource files loaded) to en-US
-
OUString aLangISO( "en-US" );
ResMgr::SetDefaultLocale( LanguageTag( aLangISO) );
@@ -82,19 +83,20 @@ void test::BootstrapFixture::setUp()
if (Application::IsHeadlessModeRequested())
Application::EnableHeadlessMode(true);
- if( m_bAssertOnDialog )
+ if (bAssertOnDialog)
ErrorHandler::RegisterDisplay( aBasicErrorFunc );
// Make GraphicConverter work, normally done in desktop::Desktop::Main()
- Application::SetFilterHdl( LINK( this, test::BootstrapFixture, ImplInitFilterHdl ) );
+ Application::SetFilterHdl(
+ STATIC_LINK(0, test::BootstrapFixture, ImplInitFilterHdl));
- if (m_bNeedUCB)
+ if (bNeedUCB)
{
// initialise unconfigured UCB:
- uno::Reference<ucb::XUniversalContentBroker> xUcb(m_xSFactory->createInstance("com.sun.star.ucb.UniversalContentBroker"), uno::UNO_QUERY_THROW);
- uno::Reference<ucb::XContentProvider> xFileProvider(m_xSFactory->createInstance("com.sun.star.ucb.FileContentProvider"), uno::UNO_QUERY_THROW);
+ uno::Reference<ucb::XUniversalContentBroker> xUcb(pSFactory->createInstance("com.sun.star.ucb.UniversalContentBroker"), uno::UNO_QUERY_THROW);
+ uno::Reference<ucb::XContentProvider> xFileProvider(pSFactory->createInstance("com.sun.star.ucb.FileContentProvider"), uno::UNO_QUERY_THROW);
xUcb->registerContentProvider(xFileProvider, "file", sal_True);
- uno::Reference<ucb::XContentProvider> xTdocProvider(m_xSFactory->createInstance("com.sun.star.ucb.TransientDocumentsContentProvider"), uno::UNO_QUERY);
+ uno::Reference<ucb::XContentProvider> xTdocProvider(pSFactory->createInstance("com.sun.star.ucb.TransientDocumentsContentProvider"), uno::UNO_QUERY);
if (xTdocProvider.is())
{
xUcb->registerContentProvider(xTdocProvider, "vnd.sun.star.tdoc", sal_True);
@@ -102,6 +104,26 @@ void test::BootstrapFixture::setUp()
}
}
+// this is called from pyuno
+SAL_DLLPUBLIC_EXPORT void test_init(lang::XMultiServiceFactory *pFactory)
+{
+ try
+ {
+ ::comphelper::setProcessServiceFactory(pFactory);
+ test_init_impl(false, true, pFactory);
+ }
+ catch (...) { abort(); }
+}
+
+} // extern "C"
+
+void test::BootstrapFixture::setUp()
+{
+ test::BootstrapFixtureBase::setUp();
+
+ test_init_impl(m_bAssertOnDialog, m_bNeedUCB, m_xSFactory.get());
+}
+
void test::BootstrapFixture::tearDown()
{
test::BootstrapFixtureBase::tearDown();
@@ -111,7 +133,8 @@ test::BootstrapFixture::~BootstrapFixture()
{
}
-IMPL_LINK( test::BootstrapFixture, ImplInitFilterHdl, ConvertData*, pData )
+IMPL_STATIC_LINK_NOINSTANCE(
+ test::BootstrapFixture, ImplInitFilterHdl, ConvertData*, pData)
{
return GraphicFilter::GetGraphicFilter().GetFilterCallback().Call( pData );
}