diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-04-13 11:13:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-04-13 13:15:25 +0100 |
commit | 8d7e8a0a3b9a4a4f7b805e91674b79a4cca7cf72 (patch) | |
tree | bb736d3ccaeb1732b552ae1f537c5f3ef0c41c0b /i18npool | |
parent | 452af5f4522e750627d0c0ac9fbc794aeb1f1f8f (diff) |
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
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/CppunitTest_i18npool_test_breakiterator.mk | 1 | ||||
-rw-r--r-- | i18npool/qa/cppunit/test_breakiterator.cxx | 34 |
2 files changed, 8 insertions, 27 deletions
diff --git a/i18npool/CppunitTest_i18npool_test_breakiterator.mk b/i18npool/CppunitTest_i18npool_test_breakiterator.mk index b9e972c34b06..62100a017244 100644 --- a/i18npool/CppunitTest_i18npool_test_breakiterator.mk +++ b/i18npool/CppunitTest_i18npool_test_breakiterator.mk @@ -37,6 +37,7 @@ $(eval $(call gb_CppunitTest_use_libraries,i18npool_test_breakiterator,\ cppu \ cppuhelper \ sal \ + unotest \ $(gb_STDLIBS) \ )) 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 <cppuhelper/compbase1.hxx> #include <cppuhelper/bootstrap.hxx> #include <cppuhelper/basemutex.hxx> -#include "cppunit/TestAssert.h" -#include "cppunit/TestFixture.h" -#include "cppunit/extensions/HelperMacros.h" -#include "cppunit/plugin/TestPlugIn.h" #include <com/sun/star/i18n/XBreakIterator.hpp> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/i18n/WordType.hpp> +#include <unotest/bootstrapfixturebase.hxx> #include <rtl/strbuf.hxx> @@ -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<uno::XComponentContext> m_xContext; - uno::Reference<lang::XMultiComponentFactory> m_xFactory; - uno::Reference<lang::XMultiServiceFactory> m_xMSF; uno::Reference<i18n::XBreakIterator> 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<lang::XMultiServiceFactory>(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); |