From 8d7e8a0a3b9a4a4f7b805e91674b79a4cca7cf72 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 13 Apr 2012 11:13:19 +0100 Subject: setup/teardown default component context once before/after all tests avoids the problems of dangling uno singletons invalidated after the first dispose and the chain of other singletons that don't expect to need to re-initialize, etc. reenable editeng cppunit test inherit i18npool cppunit test from unotest base drop LibreOfficeProtector, do "throwable" work in setUp/tearDown not in ctors/dtors --- i18npool/qa/cppunit/test_breakiterator.cxx | 34 ++++++------------------------ 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'i18npool/qa') diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 7a70f010210e..14051d4ee358 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -35,14 +35,11 @@ #include #include #include -#include "cppunit/TestAssert.h" -#include "cppunit/TestFixture.h" -#include "cppunit/extensions/HelperMacros.h" -#include "cppunit/plugin/TestPlugIn.h" #include #include #include #include +#include #include @@ -50,12 +47,9 @@ using namespace ::com::sun::star; -class TestBreakIterator : public CppUnit::TestFixture +class TestBreakIterator : public test::BootstrapFixtureBase { public: - TestBreakIterator(); - ~TestBreakIterator(); - virtual void setUp(); virtual void tearDown(); @@ -72,11 +66,7 @@ public: CPPUNIT_TEST(testAsian); CPPUNIT_TEST(testThai); CPPUNIT_TEST_SUITE_END(); - private: - uno::Reference m_xContext; - uno::Reference m_xFactory; - uno::Reference m_xMSF; uno::Reference m_xBreak; }; @@ -327,27 +317,17 @@ void TestBreakIterator::testThai() #endif } -TestBreakIterator::TestBreakIterator() -{ - m_xContext = cppu::defaultBootstrap_InitialComponentContext(); - m_xFactory = m_xContext->getServiceManager(); - m_xMSF = uno::Reference(m_xFactory, uno::UNO_QUERY_THROW); - m_xBreak = uno::Reference< i18n::XBreakIterator >(m_xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))), - uno::UNO_QUERY_THROW); -} - void TestBreakIterator::setUp() { -} - -TestBreakIterator::~TestBreakIterator() -{ - uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose(); + BootstrapFixtureBase::setUp(); + m_xBreak = uno::Reference< i18n::XBreakIterator >(m_xSFactory->createInstance( + "com.sun.star.i18n.BreakIterator"), uno::UNO_QUERY_THROW); } void TestBreakIterator::tearDown() { + BootstrapFixtureBase::tearDown(); + m_xBreak.clear(); } CPPUNIT_TEST_SUITE_REGISTRATION(TestBreakIterator); -- cgit