[Libreoffice-commits] .: sc/CppunitTest_sc_ucalc.mk sc/qa sw/qa

Michael Meeks michael at kemper.freedesktop.org
Wed Sep 28 07:31:45 PDT 2011


 sc/CppunitTest_sc_ucalc.mk  |    1 
 sc/qa/unit/filters-test.cxx |    4 --
 sc/qa/unit/ucalc.cxx        |   85 +-------------------------------------------
 sw/qa/core/filters-test.cxx |    5 --
 sw/qa/core/swdoc-test.cxx   |    1 
 5 files changed, 3 insertions(+), 93 deletions(-)

New commits:
commit 2f3d6644197a98e1c191df7943da3e50e80d606f
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Wed Sep 28 15:32:14 2011 +0100

    more unit test cut/paste redux

diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index c7a6b2f..5bd1e5c 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -63,6 +63,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_ucalc, \
     svt \
     svx \
     svxcore \
+	test \
     tk \
     tl \
     ucbhelper \
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 45916ff..dfc4cc9 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -29,12 +29,8 @@
 
 #include <sal/config.h>
 #include <test/bootstrapfixture.hxx>
-
 #include <rtl/strbuf.hxx>
 #include <osl/file.hxx>
-#include <osl/process.h>
-
-#include <tools/urlobj.hxx>
 
 #include <sfx2/app.hxx>
 #include <sfx2/docfilt.hxx>
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b3f6fd3..aae35e3 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -26,39 +26,12 @@
  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
  * instead of those above.
  */
-
-// TODO ...
-//    officecfg: can we move this into our skeleton ?
-//          Solve the Setup.xcu problem pleasantly [ custom version ? ]
-//    deliver.pl
-//          don't call regcomp if we don't have it.
-//              In an ideal world
-//              a) scp2 goes away and logic moved into the deliver d.lst
-//              b) install set gets built incrementally as the build progresses
-//              c) the new .xml component registration stuff then removes
-//                 the need for manually calling regcomp and knowing what
-//                 services we need, and in what .so they are implemented
-
-
 #include <sal/config.h>
-#include "sal/precppunit.hxx"
-
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include <test/bootstrapfixture.hxx>
 
 #include <rtl/strbuf.hxx>
 #include <osl/file.hxx>
-#include <osl/process.h>
-
-#include <cppuhelper/bootstrap.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/oslfile2streamwrap.hxx>
-#include <i18npool/mslangid.hxx>
-#include <unotools/syslocaleoptions.hxx>
 
-#include <vcl/svapp.hxx>
 #include "scdll.hxx"
 #include "document.hxx"
 #include "stringutil.hxx"
@@ -234,10 +207,9 @@ private:
     MatrixType maMatrix;
 };
 
-class Test : public CppUnit::TestFixture {
+class Test : public test::BootstrapFixture {
 public:
     Test();
-    ~Test();
 
     virtual void setUp();
     virtual void tearDown();
@@ -312,62 +284,14 @@ public:
     CPPUNIT_TEST_SUITE_END();
 
 private:
-    uno::Reference< uno::XComponentContext > m_xContext;
     ScDocument *m_pDoc;
     ScDocShellRef m_xDocShRef;
-    ::rtl::OUString m_aSrcRoot;
 };
 
 Test::Test()
     : m_pDoc(0)
-    , m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://"))
 {
-    m_xContext = cppu::defaultBootstrap_InitialComponentContext();
-
-    uno::Reference<lang::XMultiComponentFactory> xFactory(m_xContext->getServiceManager());
-    uno::Reference<lang::XMultiServiceFactory> xSM(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(xSM);
-
-    // initialise UCB-Broker
-    uno::Sequence<uno::Any> aUcbInitSequence(2);
-    aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local"));
-    aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office"));
-    bool bInitUcb = ucbhelper::ContentBroker::initialize(xSM, aUcbInitSequence);
-    CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb);
-
-    uno::Reference<ucb::XContentProviderManager> xUcb =
-        ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
-    uno::Reference<ucb::XContentProvider> xFileProvider(xSM->createInstance(
-        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY);
-    xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True);
-
-    // force locale (and resource files loaded) to en-US
-    const LanguageType eLang=LANGUAGE_ENGLISH_US;
-
-    rtl::OUString aLang, aCountry;
-    MsLangId::convertLanguageToIsoNames(eLang, aLang, aCountry);
-    lang::Locale aLocale(aLang, aCountry, rtl::OUString());
-    ResMgr::SetDefaultLocale( aLocale );
-
-    SvtSysLocaleOptions aLocalOptions;
-    aLocalOptions.SetUILocaleConfigString(
-        MsLangId::convertLanguageToIsoString( eLang ) );
-
-    InitVCL(xSM);
     ScDLL::Init();
-
-    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_aSrcRoot += rtl::OUString::createFromAscii( "/" );
-#endif
-    m_aSrcRoot += rtl::OUString::createFromAscii( pSrcRoot );
 }
 
 void Test::setUp()
@@ -385,11 +309,6 @@ void Test::tearDown()
     m_xDocShRef.Clear();
 }
 
-Test::~Test()
-{
-    uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
-}
-
 void Test::testCollator()
 {
     OUString s1(RTL_CONSTASCII_USTRINGPARAM("A"));
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 6bd2ba8..8041191 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -29,11 +29,7 @@
 
 #include <sal/config.h>
 #include <test/bootstrapfixture.hxx>
-
 #include <osl/file.hxx>
-#include <osl/process.h>
-
-#include <tools/urlobj.hxx>
 
 #include <sfx2/app.hxx>
 #include <sfx2/docfilt.hxx>
@@ -76,7 +72,6 @@ public:
 
 private:
     uno::Reference<uno::XInterface> m_xWriterComponent;
-    ::rtl::OUString m_aSrcRoot;
     int m_nLoadedDocs;
 };
 
diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
index e707cbd..992cf5b 100644
--- a/sw/qa/core/swdoc-test.cxx
+++ b/sw/qa/core/swdoc-test.cxx
@@ -32,7 +32,6 @@
 #include <test/bootstrapfixture.hxx>
 
 #include <osl/file.hxx>
-#include <osl/process.h>
 
 #include <tools/urlobj.hxx>
 #include <unotools/tempfile.hxx>


More information about the Libreoffice-commits mailing list