diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-05 00:36:03 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-04 08:53:05 -0500 |
commit | c05ef7eeb1c6d5f797103e9edda3896f8eb87536 (patch) | |
tree | d14d3aaa0b6c2d14561e2ca4fa44cf654d84b7df /postprocess | |
parent | 32f301f5a64d8ff7815cf88858fc8a87cb9ad76a (diff) |
Make service unit test easier to debug
It's sort of hard to break into this function with gdb. Seperating it out
makes it a lot easier to work out where things are breaking.
Change-Id: If99effd44fe677452ac3c1012b99da7da80c720e
Reviewed-on: https://gerrit.libreoffice.org/8844
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'postprocess')
-rw-r--r-- | postprocess/qa/services.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx index 654a9ef032bd..680ad637686f 100644 --- a/postprocess/qa/services.cxx +++ b/postprocess/qa/services.cxx @@ -48,7 +48,7 @@ void ServicesTest::test() } SAL_WARN( "postprocess.cppunit", - "trying \"" << s[i] << "\""); + "trying (index: " << i << ") \"" << s[i] << "\""); Reference< XServiceTypeDescription2 > xDesc( xTypeManager->getByHierarchicalName(s[i]), UNO_QUERY_THROW); Sequence< Reference< XServiceConstructorDescription > > xseq = xDesc->getConstructors(); @@ -56,16 +56,18 @@ void ServicesTest::test() if (!xseq[c]->getParameters().hasElements()) try { - CPPUNIT_ASSERT_MESSAGE( - OUStringToOString(s[i], RTL_TEXTENCODING_UTF8).getStr(), - ((xseq[c]->isDefaultConstructor() - ? (m_xContext->getServiceManager() - ->createInstanceWithContext(s[i], m_xContext)) - : (m_xContext->getServiceManager() - ->createInstanceWithArgumentsAndContext( - s[i], css::uno::Sequence<css::uno::Any>(), - m_xContext))) - .is())); + OString message = OUStringToOString(s[i], RTL_TEXTENCODING_UTF8); + sal_Bool bDefConstructor = xseq[c]->isDefaultConstructor(); + Reference< css::lang::XMultiComponentFactory > serviceManager = m_xContext->getServiceManager(); + Reference< XInterface > instance; + + if( bDefConstructor ) + instance = serviceManager->createInstanceWithContext(s[i], m_xContext); + else + instance = serviceManager->createInstanceWithArgumentsAndContext( + s[i], css::uno::Sequence<css::uno::Any>(), m_xContext); + + CPPUNIT_ASSERT_MESSAGE( message.getStr(), instance.is() ); } catch(const Exception & e) { |