split bootstrapfixture and move test-filters class for sot test
sot is below vcl, but is a filters test, we can split bootstrapfixture into a vcl needing bit and and non-vcl bit and filters test api can be standalone and combined with whichever bit in order to form pre and post vcl filters test
This commit is contained in:
@@ -37,12 +37,13 @@ $(eval $(call gb_CppunitTest_add_exception_objects,hwpfilter_test_hwpfilter, \
|
|||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_add_linked_libs,hwpfilter_test_hwpfilter, \
|
$(eval $(call gb_CppunitTest_add_linked_libs,hwpfilter_test_hwpfilter, \
|
||||||
test \
|
|
||||||
ucbhelper \
|
ucbhelper \
|
||||||
comphelper \
|
comphelper \
|
||||||
cppu \
|
cppu \
|
||||||
cppuhelper \
|
cppuhelper \
|
||||||
sal \
|
sal \
|
||||||
|
test \
|
||||||
|
unotest \
|
||||||
$(gb_STDLIBS) \
|
$(gb_STDLIBS) \
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@@ -26,7 +26,8 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
#include <com/sun/star/document/XFilter.hpp>
|
#include <com/sun/star/document/XFilter.hpp>
|
||||||
|
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
@@ -37,7 +38,9 @@ using namespace ::com::sun::star;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class HwpFilterTest : public test::FiltersTest
|
class HwpFilterTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void setUp();
|
virtual void setUp();
|
||||||
@@ -53,7 +56,7 @@ namespace
|
|||||||
|
|
||||||
void HwpFilterTest::setUp()
|
void HwpFilterTest::setUp()
|
||||||
{
|
{
|
||||||
test::FiltersTest::setUp();
|
test::BootstrapFixture::setUp();
|
||||||
|
|
||||||
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
|
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
||||||
|
@@ -37,11 +37,12 @@ $(eval $(call gb_CppunitTest_add_exception_objects,lotuswordpro_test_lotuswordpr
|
|||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_add_linked_libs,lotuswordpro_test_lotuswordpro, \
|
$(eval $(call gb_CppunitTest_add_linked_libs,lotuswordpro_test_lotuswordpro, \
|
||||||
test \
|
|
||||||
comphelper \
|
comphelper \
|
||||||
cppu \
|
cppu \
|
||||||
cppuhelper \
|
cppuhelper \
|
||||||
sal \
|
sal \
|
||||||
|
test \
|
||||||
|
unotest \
|
||||||
vcl \
|
vcl \
|
||||||
$(gb_STDLIBS) \
|
$(gb_STDLIBS) \
|
||||||
))
|
))
|
||||||
|
@@ -26,7 +26,8 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
#include <com/sun/star/document/XFilter.hpp>
|
#include <com/sun/star/document/XFilter.hpp>
|
||||||
|
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
@@ -36,10 +37,12 @@ using namespace ::com::sun::star;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class LotusWordProTest : public test::FiltersTest
|
class LotusWordProTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LotusWordProTest() : FiltersTest(true, false) {}
|
LotusWordProTest() : BootstrapFixture(true, false) {}
|
||||||
|
|
||||||
virtual void setUp();
|
virtual void setUp();
|
||||||
|
|
||||||
@@ -57,7 +60,7 @@ namespace
|
|||||||
|
|
||||||
void LotusWordProTest::setUp()
|
void LotusWordProTest::setUp()
|
||||||
{
|
{
|
||||||
test::FiltersTest::setUp();
|
test::BootstrapFixture::setUp();
|
||||||
|
|
||||||
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
|
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
||||||
|
@@ -35,7 +35,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_filters_test, \
|
|||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \
|
$(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \
|
||||||
test \
|
|
||||||
avmedia \
|
avmedia \
|
||||||
basegfx \
|
basegfx \
|
||||||
comphelper \
|
comphelper \
|
||||||
@@ -60,9 +59,11 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \
|
|||||||
svt \
|
svt \
|
||||||
svx \
|
svx \
|
||||||
svxcore \
|
svxcore \
|
||||||
tk \
|
test \
|
||||||
tl \
|
tl \
|
||||||
|
tk \
|
||||||
ucbhelper \
|
ucbhelper \
|
||||||
|
unotest \
|
||||||
utl \
|
utl \
|
||||||
vbahelper \
|
vbahelper \
|
||||||
vcl \
|
vcl \
|
||||||
|
@@ -28,7 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sal/config.h>
|
#include <sal/config.h>
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
#include <rtl/strbuf.hxx>
|
#include <rtl/strbuf.hxx>
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
|
|
||||||
@@ -137,7 +138,9 @@ void testCondFile(rtl::OUString& aFileName, ScDocument* pDoc, SCTAB nTab)
|
|||||||
|
|
||||||
/* Implementation of Filters test */
|
/* Implementation of Filters test */
|
||||||
|
|
||||||
class ScFiltersTest : public test::FiltersTest
|
class ScFiltersTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScFiltersTest();
|
ScFiltersTest();
|
||||||
@@ -648,7 +651,7 @@ ScFiltersTest::ScFiltersTest()
|
|||||||
|
|
||||||
void ScFiltersTest::setUp()
|
void ScFiltersTest::setUp()
|
||||||
{
|
{
|
||||||
test::FiltersTest::setUp();
|
test::BootstrapFixture::setUp();
|
||||||
|
|
||||||
// This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
|
// This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
|
||||||
// which is a private symbol to us, gets called
|
// which is a private symbol to us, gets called
|
||||||
@@ -661,7 +664,7 @@ void ScFiltersTest::setUp()
|
|||||||
void ScFiltersTest::tearDown()
|
void ScFiltersTest::tearDown()
|
||||||
{
|
{
|
||||||
uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
|
uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
|
||||||
test::FiltersTest::tearDown();
|
test::BootstrapFixture::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);
|
CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);
|
||||||
|
@@ -42,9 +42,8 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sot_test_sot, \
|
|||||||
cppuhelper \
|
cppuhelper \
|
||||||
sal \
|
sal \
|
||||||
sot \
|
sot \
|
||||||
test \
|
|
||||||
tl \
|
tl \
|
||||||
vcl \
|
unotest \
|
||||||
$(gb_STDLIBS) \
|
$(gb_STDLIBS) \
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
to sot : tools ucbhelper unotools test NULL
|
to sot : tools ucbhelper unotools unotest NULL
|
||||||
to sot\prj nmake - all sot_prj NULL
|
to sot\prj nmake - all sot_prj NULL
|
||||||
|
BIN
sot/qa/cppunit/data/pass/fdo41642-2.compound
Normal file
BIN
sot/qa/cppunit/data/pass/fdo41642-2.compound
Normal file
Binary file not shown.
@@ -26,7 +26,8 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <unotest/bootstrapfixturebase.hxx>
|
||||||
|
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
#include <osl/process.h>
|
#include <osl/process.h>
|
||||||
@@ -36,12 +37,12 @@ using namespace ::com::sun::star;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class SotTest : public test::FiltersTest
|
class SotTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixtureBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SotTest() : FiltersTest(false, false) {}
|
SotTest() {}
|
||||||
|
|
||||||
virtual void setUp();
|
|
||||||
|
|
||||||
virtual bool load(const rtl::OUString &,
|
virtual bool load(const rtl::OUString &,
|
||||||
const rtl::OUString &rURL, const rtl::OUString &);
|
const rtl::OUString &rURL, const rtl::OUString &);
|
||||||
@@ -53,11 +54,6 @@ namespace
|
|||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
};
|
};
|
||||||
|
|
||||||
void SotTest::setUp()
|
|
||||||
{
|
|
||||||
test::FiltersTest::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SotTest::load(const rtl::OUString &,
|
bool SotTest::load(const rtl::OUString &,
|
||||||
const rtl::OUString &rURL, const rtl::OUString &)
|
const rtl::OUString &rURL, const rtl::OUString &)
|
||||||
{
|
{
|
||||||
|
@@ -35,13 +35,14 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svtools_filters_test, \
|
|||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_add_linked_libs,svtools_filters_test, \
|
$(eval $(call gb_CppunitTest_add_linked_libs,svtools_filters_test, \
|
||||||
test \
|
|
||||||
comphelper \
|
comphelper \
|
||||||
cppu \
|
cppu \
|
||||||
cppuhelper \
|
cppuhelper \
|
||||||
sal \
|
sal \
|
||||||
svt \
|
svt \
|
||||||
|
test \
|
||||||
tl \
|
tl \
|
||||||
|
unotest \
|
||||||
vcl \
|
vcl \
|
||||||
$(gb_STDLIBS) \
|
$(gb_STDLIBS) \
|
||||||
))
|
))
|
||||||
|
@@ -27,7 +27,8 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
|
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
#include <osl/process.h>
|
#include <osl/process.h>
|
||||||
@@ -38,10 +39,12 @@ using namespace ::com::sun::star;
|
|||||||
|
|
||||||
/* Implementation of Filters test */
|
/* Implementation of Filters test */
|
||||||
|
|
||||||
class SvtoolsFiltersTest : public test::FiltersTest
|
class SvtoolsFiltersTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SvtoolsFiltersTest() : FiltersTest(true, false) {}
|
SvtoolsFiltersTest() : BootstrapFixture(true, false) {}
|
||||||
|
|
||||||
virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
|
virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
|
||||||
|
|
||||||
|
@@ -43,15 +43,16 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_filters_test, \
|
|||||||
$(call gb_CxxObject_get_target,sw/qa/core/filters-test): $(WORKDIR)/AllLangRes/sw
|
$(call gb_CxxObject_get_target,sw/qa/core/filters-test): $(WORKDIR)/AllLangRes/sw
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_add_linked_libs,sw_filters_test, \
|
$(eval $(call gb_CppunitTest_add_linked_libs,sw_filters_test, \
|
||||||
test \
|
|
||||||
sw \
|
sw \
|
||||||
sfx \
|
sfx \
|
||||||
svl \
|
svl \
|
||||||
svt \
|
svt \
|
||||||
vcl \
|
test \
|
||||||
tl \
|
tl \
|
||||||
ucbhelper \
|
ucbhelper \
|
||||||
|
unotest \
|
||||||
utl \
|
utl \
|
||||||
|
vcl \
|
||||||
i18nisolang1 \
|
i18nisolang1 \
|
||||||
comphelper \
|
comphelper \
|
||||||
cppu \
|
cppu \
|
||||||
|
@@ -27,7 +27,8 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
|
|
||||||
#include <sfx2/app.hxx>
|
#include <sfx2/app.hxx>
|
||||||
#include <sfx2/docfilt.hxx>
|
#include <sfx2/docfilt.hxx>
|
||||||
@@ -48,7 +49,9 @@ using namespace ::com::sun::star;
|
|||||||
|
|
||||||
/* Implementation of Filters test */
|
/* Implementation of Filters test */
|
||||||
|
|
||||||
class SwFiltersTest : public test::FiltersTest
|
class SwFiltersTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
|
bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
|
||||||
@@ -92,7 +95,7 @@ void SwFiltersTest::testCVEs()
|
|||||||
|
|
||||||
void SwFiltersTest::setUp()
|
void SwFiltersTest::setUp()
|
||||||
{
|
{
|
||||||
test::FiltersTest::setUp();
|
test::BootstrapFixture::setUp();
|
||||||
|
|
||||||
//This is a bit of a fudge, we do this to ensure that SwGlobals::ensure,
|
//This is a bit of a fudge, we do this to ensure that SwGlobals::ensure,
|
||||||
//which is a private symbol to us, gets called
|
//which is a private symbol to us, gets called
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "cppunit/TestFixture.h"
|
#include "cppunit/TestFixture.h"
|
||||||
#include "cppunit/extensions/HelperMacros.h"
|
#include "cppunit/extensions/HelperMacros.h"
|
||||||
#include "cppunit/plugin/TestPlugIn.h"
|
#include "cppunit/plugin/TestPlugIn.h"
|
||||||
|
#include "unotest/bootstrapfixturebase.hxx"
|
||||||
#include "test/testdllapi.hxx"
|
#include "test/testdllapi.hxx"
|
||||||
|
|
||||||
namespace test {
|
namespace test {
|
||||||
@@ -51,34 +52,15 @@ namespace test {
|
|||||||
|
|
||||||
// NB. this class is instantiated multiple times during a
|
// NB. this class is instantiated multiple times during a
|
||||||
// run of unit tests ...
|
// run of unit tests ...
|
||||||
class OOO_DLLPUBLIC_TEST BootstrapFixture : public CppUnit::TestFixture
|
class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
|
||||||
{
|
{
|
||||||
bool m_bNeedUCB;
|
bool m_bNeedUCB;
|
||||||
bool m_bAssertOnDialog;
|
bool m_bAssertOnDialog;
|
||||||
::rtl::OUString m_aSrcRootURL;
|
|
||||||
::rtl::OUString m_aSrcRootPath;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
|
|
||||||
com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
|
|
||||||
com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BootstrapFixture( bool bAssertOnDialog = true, bool bNeedUCB = true );
|
BootstrapFixture( bool bAssertOnDialog = true, bool bNeedUCB = true );
|
||||||
virtual ~BootstrapFixture();
|
virtual ~BootstrapFixture();
|
||||||
|
|
||||||
com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
|
|
||||||
getComponentContext() { return m_xContext; }
|
|
||||||
com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
|
|
||||||
getMultiServiceFactory() { return m_xSFactory; }
|
|
||||||
|
|
||||||
::rtl::OUString getSrcRootURL() { return m_aSrcRootURL; }
|
|
||||||
::rtl::OUString getSrcRootPath() { return m_aSrcRootPath; }
|
|
||||||
|
|
||||||
// return a URL to a given c-str path from the source directory
|
|
||||||
::rtl::OUString getURLFromSrc( const char *pPath );
|
|
||||||
|
|
||||||
virtual void setUp();
|
virtual void setUp();
|
||||||
virtual void tearDown();
|
virtual void tearDown();
|
||||||
};
|
};
|
||||||
|
@@ -6,4 +6,3 @@ mkdir: %_DEST%\inc\test
|
|||||||
..\%__SRC%\lib\libtest.dll.a %_DEST%\lib\libtest.dll.a
|
..\%__SRC%\lib\libtest.dll.a %_DEST%\lib\libtest.dll.a
|
||||||
..\inc\test\testdllapi.hxx %_DEST%\inc\test\testdllapi.hxx
|
..\inc\test\testdllapi.hxx %_DEST%\inc\test\testdllapi.hxx
|
||||||
..\inc\test\bootstrapfixture.hxx %_DEST%\inc\test\bootstrapfixture.hxx
|
..\inc\test\bootstrapfixture.hxx %_DEST%\inc\test\bootstrapfixture.hxx
|
||||||
..\inc\test\filters-test.hxx %_DEST%\inc\test\filters-test.hxx
|
|
||||||
|
@@ -61,18 +61,7 @@ static void aBasicErrorFunc( const String &rErr, const String &rAction )
|
|||||||
test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB )
|
test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB )
|
||||||
: m_bNeedUCB( bNeedUCB )
|
: m_bNeedUCB( bNeedUCB )
|
||||||
, m_bAssertOnDialog( bAssertOnDialog )
|
, m_bAssertOnDialog( bAssertOnDialog )
|
||||||
, m_aSrcRootURL(RTL_CONSTASCII_USTRINGPARAM("file://"))
|
|
||||||
{
|
{
|
||||||
const char* pSrcRoot = getenv( "SRC_ROOT" );
|
|
||||||
CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0);
|
|
||||||
|
|
||||||
#ifdef WNT
|
|
||||||
if (pSrcRoot[1] == ':')
|
|
||||||
m_aSrcRootURL += rtl::OUString::createFromAscii( "/" );
|
|
||||||
#endif
|
|
||||||
m_aSrcRootPath = rtl::OUString::createFromAscii( pSrcRoot );
|
|
||||||
m_aSrcRootURL += m_aSrcRootPath;
|
|
||||||
|
|
||||||
// force locale (and resource files loaded) to en-US
|
// force locale (and resource files loaded) to en-US
|
||||||
const LanguageType eLang=LANGUAGE_ENGLISH_US;
|
const LanguageType eLang=LANGUAGE_ENGLISH_US;
|
||||||
|
|
||||||
@@ -84,20 +73,7 @@ test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB )
|
|||||||
|
|
||||||
void test::BootstrapFixture::setUp()
|
void test::BootstrapFixture::setUp()
|
||||||
{
|
{
|
||||||
// set UserInstallation to user profile dir in test/user-template
|
test::BootstrapFixtureBase::setUp();
|
||||||
rtl::Bootstrap aDefaultVars;
|
|
||||||
aDefaultVars.set( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserInstallation") ),
|
|
||||||
getURLFromSrc("/test/user-template"));
|
|
||||||
|
|
||||||
m_xContext = cppu::defaultBootstrap_InitialComponentContext();
|
|
||||||
m_xFactory = m_xContext->getServiceManager();
|
|
||||||
m_xSFactory = uno::Reference<lang::XMultiServiceFactory> (m_xFactory, uno::UNO_QUERY_THROW);
|
|
||||||
|
|
||||||
// Without this we're crashing because callees are using
|
|
||||||
// getProcessServiceFactory. In general those should be removed in favour
|
|
||||||
// of retaining references to the root ServiceFactory as its passed around
|
|
||||||
comphelper::setProcessServiceFactory(m_xSFactory);
|
|
||||||
|
|
||||||
if (m_bNeedUCB)
|
if (m_bNeedUCB)
|
||||||
{
|
{
|
||||||
// initialise UCB-Broker
|
// initialise UCB-Broker
|
||||||
@@ -128,16 +104,11 @@ void test::BootstrapFixture::setUp()
|
|||||||
void test::BootstrapFixture::tearDown()
|
void test::BootstrapFixture::tearDown()
|
||||||
{
|
{
|
||||||
ucbhelper::ContentBroker::get()->deinitialize();
|
ucbhelper::ContentBroker::get()->deinitialize();
|
||||||
// uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
|
test::BootstrapFixtureBase::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
test::BootstrapFixture::~BootstrapFixture()
|
test::BootstrapFixture::~BootstrapFixture()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
::rtl::OUString test::BootstrapFixture::getURLFromSrc( const char *pPath )
|
|
||||||
{
|
|
||||||
return m_aSrcRootURL + rtl::OUString::createFromAscii( pPath );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -38,8 +38,7 @@ CDEFS += -DOOO_DLLIMPLEMENTATION_TEST
|
|||||||
CFLAGSCXX += $(CPPUNIT_CFLAGS)
|
CFLAGSCXX += $(CPPUNIT_CFLAGS)
|
||||||
|
|
||||||
SLOFILES = \
|
SLOFILES = \
|
||||||
$(SLO)/bootstrapfixture.obj \
|
$(SLO)/bootstrapfixture.obj
|
||||||
$(SLO)/filters-test.obj
|
|
||||||
|
|
||||||
.IF "$(CROSS_COMPILING)" == "YES"
|
.IF "$(CROSS_COMPILING)" == "YES"
|
||||||
SHL1IMPLIB = $(SHL1TARGET)
|
SHL1IMPLIB = $(SHL1TARGET)
|
||||||
|
88
unotest/inc/unotest/bootstrapfixturebase.hxx
Normal file
88
unotest/inc/unotest/bootstrapfixturebase.hxx
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License or as specified alternatively below. You may obtain a copy of
|
||||||
|
* the License at http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* Major Contributor(s):
|
||||||
|
* Copyright (C) 2011 Michael Meeks <michael.meeks@suse.com>
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* For minor contributions see the git repository.
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
|
||||||
|
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
|
||||||
|
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
|
||||||
|
* instead of those above.
|
||||||
|
*/
|
||||||
|
#ifndef INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
|
||||||
|
#define INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
|
||||||
|
|
||||||
|
#include <sal/config.h>
|
||||||
|
|
||||||
|
#include <rtl/string.hxx>
|
||||||
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||||
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||||
|
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
|
||||||
|
|
||||||
|
#include "sal/precppunit.hxx"
|
||||||
|
#include "cppunit/TestAssert.h"
|
||||||
|
#include "cppunit/TestFixture.h"
|
||||||
|
#include "cppunit/extensions/HelperMacros.h"
|
||||||
|
#include "cppunit/plugin/TestPlugIn.h"
|
||||||
|
#include "unotest/detail/unotestdllapi.hxx"
|
||||||
|
|
||||||
|
namespace test {
|
||||||
|
|
||||||
|
// Class to do lots of heavy-lifting UNO & environment
|
||||||
|
// bootstrapping for unit tests, such that we can use
|
||||||
|
// almost an entire LibreOffice during compile - so
|
||||||
|
// that we can get pieces of code alone to beat them up.
|
||||||
|
|
||||||
|
// NB. this class is instantiated multiple times during a
|
||||||
|
// run of unit tests ...
|
||||||
|
class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
::rtl::OUString m_aSrcRootURL;
|
||||||
|
::rtl::OUString m_aSrcRootPath;
|
||||||
|
|
||||||
|
com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
|
||||||
|
com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
|
||||||
|
com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
|
||||||
|
|
||||||
|
public:
|
||||||
|
BootstrapFixtureBase();
|
||||||
|
virtual ~BootstrapFixtureBase();
|
||||||
|
|
||||||
|
com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
|
||||||
|
getComponentContext() { return m_xContext; }
|
||||||
|
com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
|
||||||
|
getMultiServiceFactory() { return m_xSFactory; }
|
||||||
|
|
||||||
|
::rtl::OUString getSrcRootURL() { return m_aSrcRootURL; }
|
||||||
|
::rtl::OUString getSrcRootPath() { return m_aSrcRootPath; }
|
||||||
|
|
||||||
|
// return a URL to a given c-str path from the source directory
|
||||||
|
::rtl::OUString getURLFromSrc( const char *pPath );
|
||||||
|
|
||||||
|
virtual void setUp();
|
||||||
|
virtual void tearDown();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -28,8 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
#include <test/bootstrapfixture.hxx>
|
#include "unotest/detail/unotestdllapi.hxx"
|
||||||
#include "test/testdllapi.hxx"
|
|
||||||
|
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
@@ -47,13 +46,9 @@ enum filterStatus
|
|||||||
* e.g. m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
|
* e.g. m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
|
||||||
*/
|
*/
|
||||||
/* Implementation of Filters test */
|
/* Implementation of Filters test */
|
||||||
class OOO_DLLPUBLIC_TEST FiltersTest : public test::BootstrapFixture
|
class OOO_DLLPUBLIC_UNOTEST FiltersTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FiltersTest(bool bAssertOnDialog = true, bool bNeedUCB = true)
|
|
||||||
: BootstrapFixture(bAssertOnDialog, bNeedUCB)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void testDir(
|
void testDir(
|
||||||
//filter name
|
//filter name
|
||||||
const rtl::OUString &rFilter,
|
const rtl::OUString &rFilter,
|
@@ -1,4 +1,4 @@
|
|||||||
unote unotest : BOOST:boost cppu cppuhelper CPPUNIT:cppunit javaunohelper offapi ridljar sal solenv stlport unoil qadevOOo NULL
|
unote unotest : BOOST:boost cppu cppuhelper comphelper CPPUNIT:cppunit javaunohelper offapi ridljar sal solenv unoil qadevOOo NULL
|
||||||
unote unotest\source\cpp nmake - all source_cpp NULL
|
unote unotest\source\cpp nmake - all source_cpp NULL
|
||||||
unote unotest\source\cpp\unoexceptionprotector nmake - all source_cpp_unoexceptionprotector NULL
|
unote unotest\source\cpp\unoexceptionprotector nmake - all source_cpp_unoexceptionprotector NULL
|
||||||
unote unotest\source\java\org\openoffice\test nmake - all source_java NULL
|
unote unotest\source\java\org\openoffice\test nmake - all source_java NULL
|
||||||
|
@@ -9,6 +9,8 @@ mkdir: %_DEST%\inc\unotest\detail
|
|||||||
..\%__SRC%\lib\unoexceptionprotector.dylib %_DEST%\lib\unoexceptionprotector.dylib
|
..\%__SRC%\lib\unoexceptionprotector.dylib %_DEST%\lib\unoexceptionprotector.dylib
|
||||||
..\%__SRC%\lib\unoexceptionprotector.so %_DEST%\lib\unoexceptionprotector.so
|
..\%__SRC%\lib\unoexceptionprotector.so %_DEST%\lib\unoexceptionprotector.so
|
||||||
..\inc\unotest\detail\unotestdllapi.hxx %_DEST%\inc\unotest\detail\unotestdllapi.hxx
|
..\inc\unotest\detail\unotestdllapi.hxx %_DEST%\inc\unotest\detail\unotestdllapi.hxx
|
||||||
|
..\inc\unotest\bootstrapfixturebase.hxx %_DEST%\inc\unotest\bootstrapfixturebase.hxx
|
||||||
|
..\inc\unotest\filters-test.hxx %_DEST%\inc\unotest\filters-test.hxx
|
||||||
..\inc\unotest\gettestargument.hxx %_DEST%\inc\unotest\gettestargument.hxx
|
..\inc\unotest\gettestargument.hxx %_DEST%\inc\unotest\gettestargument.hxx
|
||||||
..\inc\unotest\officeconnection.hxx %_DEST%\inc\unotest\officeconnection.hxx
|
..\inc\unotest\officeconnection.hxx %_DEST%\inc\unotest\officeconnection.hxx
|
||||||
..\inc\unotest\oustringostreaminserter.hxx %_DEST%\inc\unotest\oustringostreaminserter.hxx
|
..\inc\unotest\oustringostreaminserter.hxx %_DEST%\inc\unotest\oustringostreaminserter.hxx
|
||||||
|
98
unotest/source/cpp/bootstrapfixturebase.cxx
Normal file
98
unotest/source/cpp/bootstrapfixturebase.cxx
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License or as specified alternatively below. You may obtain a copy of
|
||||||
|
* the License at http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* Major Contributor(s):
|
||||||
|
* Copyright (C) 2011 Michael Meeks <michael.meeks@suse.com>
|
||||||
|
* Caolán McNamara <caolanm@redhat.com>
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* For minor contributions see the git repository.
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
|
||||||
|
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
|
||||||
|
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
|
||||||
|
* instead of those above.
|
||||||
|
*/
|
||||||
|
#include <unotest/bootstrapfixturebase.hxx>
|
||||||
|
#include <tools/errinf.hxx>
|
||||||
|
#include <rtl/strbuf.hxx>
|
||||||
|
#include <rtl/bootstrap.hxx>
|
||||||
|
#include <cppuhelper/bootstrap.hxx>
|
||||||
|
#include <ucbhelper/contentbroker.hxx>
|
||||||
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <i18npool/mslangid.hxx>
|
||||||
|
|
||||||
|
#include <com/sun/star/lang/Locale.hpp>
|
||||||
|
#include <com/sun/star/lang/XComponent.hpp>
|
||||||
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||||
|
|
||||||
|
#include <vcl/svapp.hxx>
|
||||||
|
#include <tools/resmgr.hxx>
|
||||||
|
#include <unotools/syslocaleoptions.hxx>
|
||||||
|
|
||||||
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
|
// NB. this constructor is called before any tests are run, once for each
|
||||||
|
// test function in a rather non-intuitive way. This is why all the 'real'
|
||||||
|
// heavy lifting is deferred until setUp. setUp and tearDown are interleaved
|
||||||
|
// between the tests as you might expect.
|
||||||
|
test::BootstrapFixtureBase::BootstrapFixtureBase()
|
||||||
|
: m_aSrcRootURL(RTL_CONSTASCII_USTRINGPARAM("file://"))
|
||||||
|
{
|
||||||
|
const char* pSrcRoot = getenv( "SRC_ROOT" );
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0);
|
||||||
|
|
||||||
|
#ifdef WNT
|
||||||
|
if (pSrcRoot[1] == ':')
|
||||||
|
m_aSrcRootURL += rtl::OUString::createFromAscii( "/" );
|
||||||
|
#endif
|
||||||
|
m_aSrcRootPath = rtl::OUString::createFromAscii( pSrcRoot );
|
||||||
|
m_aSrcRootURL += m_aSrcRootPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
test::BootstrapFixtureBase::~BootstrapFixtureBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
::rtl::OUString test::BootstrapFixtureBase::getURLFromSrc( const char *pPath )
|
||||||
|
{
|
||||||
|
return m_aSrcRootURL + rtl::OUString::createFromAscii( pPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
void test::BootstrapFixtureBase::setUp()
|
||||||
|
{
|
||||||
|
// set UserInstallation to user profile dir in test/user-template
|
||||||
|
rtl::Bootstrap aDefaultVars;
|
||||||
|
aDefaultVars.set( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserInstallation") ),
|
||||||
|
getURLFromSrc("/test/user-template"));
|
||||||
|
|
||||||
|
m_xContext = cppu::defaultBootstrap_InitialComponentContext();
|
||||||
|
m_xFactory = m_xContext->getServiceManager();
|
||||||
|
m_xSFactory = uno::Reference<lang::XMultiServiceFactory> (m_xFactory, uno::UNO_QUERY_THROW);
|
||||||
|
|
||||||
|
// Without this we're crashing because callees are using
|
||||||
|
// getProcessServiceFactory. In general those should be removed in favour
|
||||||
|
// of retaining references to the root ServiceFactory as its passed around
|
||||||
|
comphelper::setProcessServiceFactory(m_xSFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test::BootstrapFixtureBase::tearDown()
|
||||||
|
{
|
||||||
|
// uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -27,12 +27,13 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
#include <osl/thread.h>
|
#include <osl/thread.h>
|
||||||
#include <rtl/cipher.h>
|
#include <rtl/cipher.h>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
#include "sal/precppunit.hxx"
|
||||||
|
#include "cppunit/TestAssert.h"
|
||||||
|
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
@@ -38,6 +38,8 @@ CDEFS += -DOOO_DLLIMPLEMENTATION_UNOTEST
|
|||||||
CFLAGSCXX += $(CPPUNIT_CFLAGS)
|
CFLAGSCXX += $(CPPUNIT_CFLAGS)
|
||||||
|
|
||||||
SLOFILES = \
|
SLOFILES = \
|
||||||
|
$(SLO)/bootstrapfixturebase.obj \
|
||||||
|
$(SLO)/filters-test.obj \
|
||||||
$(SLO)/getargument.obj \
|
$(SLO)/getargument.obj \
|
||||||
$(SLO)/gettestargument.obj \
|
$(SLO)/gettestargument.obj \
|
||||||
$(SLO)/officeconnection.obj \
|
$(SLO)/officeconnection.obj \
|
||||||
@@ -52,6 +54,7 @@ SHL1IMPLIB = i$(SHL1TARGET)
|
|||||||
SHL1OBJS = $(SLOFILES)
|
SHL1OBJS = $(SLOFILES)
|
||||||
SHL1RPATH = NONE
|
SHL1RPATH = NONE
|
||||||
SHL1STDLIBS = \
|
SHL1STDLIBS = \
|
||||||
|
$(COMPHELPERLIB) \
|
||||||
$(CPPUHELPERLIB) \
|
$(CPPUHELPERLIB) \
|
||||||
$(CPPULIB) \
|
$(CPPULIB) \
|
||||||
$(CPPUNITLIB) \
|
$(CPPUNITLIB) \
|
||||||
|
@@ -35,12 +35,13 @@ $(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_rtftok, \
|
|||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_add_linked_libs,writerfilter_rtftok, \
|
$(eval $(call gb_CppunitTest_add_linked_libs,writerfilter_rtftok, \
|
||||||
test \
|
|
||||||
comphelper \
|
comphelper \
|
||||||
cppu \
|
cppu \
|
||||||
cppuhelper \
|
cppuhelper \
|
||||||
sal \
|
sal \
|
||||||
|
test \
|
||||||
ucbhelper \
|
ucbhelper \
|
||||||
|
unotest \
|
||||||
vcl \
|
vcl \
|
||||||
writerfilter \
|
writerfilter \
|
||||||
$(gb_STDLIBS) \
|
$(gb_STDLIBS) \
|
||||||
|
@@ -26,7 +26,8 @@
|
|||||||
* instead of those above.
|
* instead of those above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/filters-test.hxx>
|
#include <unotest/filters-test.hxx>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
#include <com/sun/star/document/XFilter.hpp>
|
#include <com/sun/star/document/XFilter.hpp>
|
||||||
|
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
@@ -34,7 +35,9 @@
|
|||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
class RtfTest : public test::FiltersTest
|
class RtfTest
|
||||||
|
: public test::FiltersTest
|
||||||
|
, public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ private:
|
|||||||
|
|
||||||
void RtfTest::setUp()
|
void RtfTest::setUp()
|
||||||
{
|
{
|
||||||
test::FiltersTest::setUp();
|
test::BootstrapFixture::setUp();
|
||||||
|
|
||||||
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
|
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.RtfFilter"))),
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.RtfFilter"))),
|
||||||
|
Reference in New Issue
Block a user