postprocess/qa/services.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
New commits: commit c05ef7eeb1c6d5f797103e9edda3896f8eb87536 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Sat Apr 5 00:36:03 2014 +1100 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.sherloc...@gmail.com> Tested-by: Chris Sherlock <chris.sherloc...@gmail.com> diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx index 654a9ef..680ad63 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) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits