ooo-build r11646 - trunk/patches/test



Author: michael
Date: Wed Feb 20 16:23:06 2008
New Revision: 11646
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11646&view=rev

Log:
yet sweeter.


Modified:
   trunk/patches/test/built-in-unit-test-sc.diff

Modified: trunk/patches/test/built-in-unit-test-sc.diff
==============================================================================
--- trunk/patches/test/built-in-unit-test-sc.diff	(original)
+++ trunk/patches/test/built-in-unit-test-sc.diff	Wed Feb 20 16:23:06 2008
@@ -1,5 +1,5 @@
 --- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/makefile.mk	2008-02-20 15:36:14.000000000 +0000
++++ sc/qa/unit/makefile.mk	2008-02-20 15:48:10.000000000 +0000
 @@ -0,0 +1,95 @@
 +#*************************************************************************
 +#
@@ -94,163 +94,71 @@
 +
 +test .PHONY: $(SHL1TARGETN) $(USERDIR)$/$(TARGET).rdb
 +    testshl2 $(SHL1TARGETN) -forward "$(USERDIR)$/$(TARGET).rdb#$(USERDIR)"
-+    @$(RM) -rf $(USERDIR)
++    $(RM) -rf $(USERDIR)
 +
 --- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/ucalc.cxx	2008-02-20 15:32:57.000000000 +0000
-@@ -0,0 +1,173 @@
-+// To debug me use:
-+// $ export ENVCFGFLAGS='-me -ti -tw -tp -td'
-+#include "common.hxx"
-+
++++ sc/qa/unit/ucalc.cxx	2008-02-20 16:25:12.000000000 +0000
+@@ -0,0 +1,81 @@
 +// TODO ...
-+//    dmake to make & clean up tstunitconfig [ ? ]
-+//          can be a directory inside unxlngi6.pro [!]
-+//          much cleaner. Why -forward ?
-+//    officecfg - should make a nice skeleton to copy. 'unit'
-+//    simplify the config setup & shrink it ...
-+//    Solve the Setup.xcu problem pleasantly [ custom version ? ]
-+//    don't call regcomp if we don't have it.
-+//    dung out the local configuration tree
++//    officecfg: can we move this into our skeleton ?
++//          Solve the Setup.xcu problem pleasantly [ custom version ? ]
++//    Remove: Foo killed exception ! ...
++//    deliver.pl
++//          don't call regcomp if we don't have it.
 +//    find & kill signalfile stuff (?)
-+//    use system .rdb ? [ quite big ... ]
++//    Consider - where to dump this code ?
++//             - surely there is some Uno module we can use... ?
++//             - 'unohelper' ?
 +
-+#include "comphelper/processfactory.hxx"
++#include "sal/config.h"
++#include "ubootstrap.hxx"
 +#include "vcl/svapp.hxx"
-+
-+// calc bits
 +#include <scdll.hxx>
 +#include <document.hxx>
++#include "cppunit/simpleheader.hxx"
 +
-+using namespace css;
-+
-+void Test::setUp()
-+{
-+    char const * f = getForwardString();
-+    rtl::OUString args (f, rtl_str_getLength(f), osl_getThreadTextEncoding());
-+    sal_Int32 i = args.indexOf('#');
-+    if (i < 0)
-+        std::abort();
-+
-+    rtl::OUString rdb(args.copy(0, i));
-+    rtl::OUString aUserDir(args.copy(i + 1));
-+
-+    fprintf (stderr, "Setup with user dir URL '%s'\n",
-+             rtl::OUStringToOString (aUserDir, RTL_TEXTENCODING_UTF8).getStr());
-+    mpMagic = new Magic(aUserDir);
-+
-+    css::uno::Reference< css::beans::XPropertySet > factory(
-+        cppu::createRegistryServiceFactory(rdb), css::uno::UNO_QUERY_THROW);
-+    css::uno::Reference< css::uno::XComponentContext > context(
-+        factory->getPropertyValue(
-+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
-+        css::uno::UNO_QUERY_THROW);
-+
-+    rtl::OUString regurl = rtl::OUString();
-+    cppu::ContextEntry_Init entry(
-+        rtl::OUString(
-+            RTL_CONSTASCII_USTRINGPARAM(
-+                "/modules/com.sun.star.configuration/bootstrap/Strata")),
-+        css::uno::makeAny(
-+            rtl::OUString(
-+                RTL_CONSTASCII_USTRINGPARAM(
-+                    "com.sun.star.comp.configuration.backend.LocalStratum:"))
-+            + regurl));
-+    mxContext = cppu::createComponentContext(&entry, 1, context);
-+
-+    CPPUNIT_ASSERT_MESSAGE ("component context is valid", mxContext.is());
-+
-+    try {
-+        mxProvider = css::uno::Reference< css::lang::XMultiServiceFactory >(
-+            (css::uno::Reference< css::lang::XMultiComponentFactory >(
-+                mxContext->getServiceManager(), css::uno::UNO_QUERY_THROW)->
-+             createInstanceWithContext(
-+                 rtl::OUString(
-+                     RTL_CONSTASCII_USTRINGPARAM(
-+                         "com.sun.star.configuration.ConfigurationProvider")),
-+                 mxContext)),
-+            css::uno::UNO_QUERY_THROW);
-+        
-+    } catch (css::uno::Exception&e) {
-+        CPPUNIT_FAIL( "exception creating provider" );
-+        throw;
++#define CATCH_FAIL(msg) \
++    catch (const css::uno::Exception &e) { \
++        t_print ("msg '%s'\n", rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr()); \
++        CPPUNIT_FAIL( msg ); \
++        throw; \
 +    }
 +
-+    css::uno::Reference< css::lang::XMultiServiceFactory > xMSF ( context->getServiceManager(), css::uno::UNO_QUERY );
-+    comphelper::setProcessServiceFactory( xMSF );
-+    InitVCL (xMSF);
++class Test: public CppUnit::TestFixture {
++    UnitBootstrap *mpUnitBootstrap;
++public:
++    // init
++    virtual void setUp();
++    virtual void tearDown();
 +
-+    ScDLL::Init();
-+}
++    // tests
++    void createDocument();
 +
-+css::uno::Reference< css::uno::XInterface >
-+Test::createView(const sal_Char *pNodepath, bool bUpdate)
-+{
-+    rtl::OUString aNodePath = rtl::OUString::createFromAscii(pNodepath);
-+    static const rtl::OUString kInfoViewService( 
-+        RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")) ;
-+    static const rtl::OUString kUpdateViewService( 
-+        RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")) ;
-+    static const rtl::OUString kNodepath(RTL_CONSTASCII_USTRINGPARAM("nodepath")) ;
-+    static const rtl::OUString kAsync(RTL_CONSTASCII_USTRINGPARAM("EnableAsync")) ;
-+    
-+    const rtl::OUString & kViewService = bUpdate ? kUpdateViewService : kInfoViewService;
-+    css::uno::Sequence< css::uno::Any > aViewArgs(2);
-+    aViewArgs[0] <<= css::beans::NamedValue( kNodepath, css::uno::makeAny(aNodePath) );
-+    aViewArgs[1] <<= css::beans::NamedValue( kAsync, css::uno::makeAny(sal_False) );
-+
-+    css::uno::Reference< css::uno::XInterface > xView(
-+        mxProvider->createInstanceWithArguments( kViewService, aViewArgs ) );
-+    return xView;
-+}
++    CPPUNIT_TEST_SUITE(Test);
++    CPPUNIT_TEST(createDocument);
++    CPPUNIT_TEST_SUITE_END();
 +
-+void disposeComponent (const css::uno::Reference<css::uno::XInterface> &xComp)
-+{
-+    css::uno::Reference< css::lang::XComponent >(
-+        xComp, css::uno::UNO_QUERY_THROW)->dispose();
-+}
++private:
++};
 +
-+void Test::tearDown()
++void Test::setUp()
 +{
-+    DeInitVCL ();
++    mpUnitBootstrap = new UnitBootstrap();
 +
-+    disposeComponent (mxProvider);
-+    disposeComponent (mxContext);
++    InitVCL (mpUnitBootstrap->getMSF());
 +
-+    delete mpMagic;
++    ScDLL::Init();
 +}
 +
-+void Test::normalizePathKey (rtl::OString &rPath, rtl::OString &rKey)
++void Test::tearDown()
 +{
-+    sal_Int32 idx = rKey.lastIndexOf("/");
-+    if (idx > 0) {
-+        rPath += "/";
-+        rPath += rKey.copy (0, idx);
-+        rKey = rKey.copy (idx + 1);
-+//        t_print ("write to '%s' '%s'\n", (const sal_Char *)rPath,
-+//                 (const sal_Char *)rKey);
-+    }
-+}
++    DeInitVCL ();
 +
-+uno::Any Test::getKey (const sal_Char *pPath, rtl::OUString aName)
-+{
-+    uno::Reference< container::XHierarchicalNameAccess > xNameAccess( 
-+        createView(pPath, false), css::uno::UNO_QUERY_THROW);
-+    uno::Any aVal;
-+    aVal = xNameAccess->getByHierarchicalName (aName);
-+    disposeComponent (xNameAccess);
-+    return aVal;
++    delete mpUnitBootstrap;
 +}
 +
 +void Test::createDocument()
 +{
-+    // Poke the config database just to make sure ...
-+    try {
-+        rtl::OUString aStr;
-+        if (!(getKey ("/org.openoffice.Setup", "L10N/ooLocale") >>= aStr))
-+            CPPUNIT_FAIL("to fetch key");
-+    } CATCH_FAIL ("fetching key")
-+
 +    ScDocument *doc = new ScDocument();
 +    
 +    rtl::OUString aTabName = rtl::OUString::createFromAscii ("foo");
@@ -273,137 +181,26 @@
 +
 +NOADDITIONAL;
 --- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/configmgrrc	2008-02-20 11:02:31.000000000 +0000
-@@ -0,0 +1,22 @@
-+[Bootstrap]
-+CFG_ServerType=uno
-+BootstrapFile=$ORIGIN/bootstraprc
-+VersionFile=$ORIGIN/versionrc
-+UnoFile=$ORIGIN/unorc
-+BaseInstallation=${$BootstrapFile:BaseInstallation}
-+UserInstallation=${$BootstrapFile:UserInstallation}
-+CFG_SchemaVersion=${$VersionFile:buildid}
-+CFG_SchemaDataUrl=$SOLVER/xml/registry/schema
-+CFG_DefaultLayerUrls=$SOLVER/xml/registry
-+CFG_CacheDisposeDelay=900
-+CFG_CacheDisposeInterval=60
-+CFG_CacheWriteInterval=2
-+CFG_UserLayerUrl=$UserInstallation
-+CFG_CacheUrl=$UserInstallation/cache
-+CFG_DefaultLayerUrl=$SOLVER/xml/registry
-+CFG_BackendService=com.sun.star.comp.configuration.backend.MultiStratumBackend
-+CFG_SchemaSupplier=com.sun.star.comp.configuration.backend.LocalSchemaSupplier
-+CFG_LocalDataSvc=com.sun.star.comp.configuration.backend.LocalStratum
-+CFG_LocalModuleDataSvc=com.sun.star.comp.configuration.backend.LocalMultiStratum
-+# CFG_Strata=${CFG_LocalDataSvc}:$CFG_DefaultLayerUrl;?com.sun.star.comp.configuration.backend.SystemIntegration:;?com.sun.star.comp.configuration.backend.PolicyLayerBackend:;${CFG_LocalDataSvc}:$CFG_UserLayerUrl
-+CFG_Strata=${CFG_LocalDataSvc}:$CFG_DefaultLayerUrl;${CFG_LocalDataSvc}:$CFG_UserLayerUrl
---- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/common.hxx	2008-02-20 15:20:26.000000000 +0000
-@@ -0,0 +1,104 @@
-+/*************************************************************************
-+ *
-+ *  OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ *  $RCSfile: common.hxx,v $
-+ *
-+ *  $Revision: 1.2 $
-+ *
-+ *  last change: $Author: ihi $ $Date: 2007/11/23 13:57:16 $
-+ *
-+ *  The Contents of this file are made available subject to
-+ *  the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ *    GNU Lesser General Public License Version 2.1
-+ *    =============================================
-+ *    Copyright 2007 by Sun Microsystems, Inc.
-+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ *    This library is free software; you can redistribute it and/or
-+ *    modify it under the terms of the GNU Lesser General Public
-+ *    License version 2.1, as published by the Free Software Foundation.
-+ *
-+ *    This library is distributed in the hope that it will be useful,
-+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ *    Lesser General Public License for more details.
-+ *
-+ *    You should have received a copy of the GNU Lesser General Public
-+ *    License along with this library; if not, write to the Free Software
-+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ *    MA  02111-1307  USA
-+ *
-+ ************************************************************************/
++++ sc/qa/unit/ubootstrap.hxx	2008-02-20 16:20:46.000000000 +0000
+@@ -0,0 +1,18 @@
++#ifndef UNIT_BOOTSTRAP_HXX
++#define UNIT_BOOTSTRAP_HXX
 +
-+#include "sal/config.h"
-+#include <cstdlib>
-+#include "com/sun/star/beans/NamedValue.hpp"
-+#include "com/sun/star/beans/XPropertySet.hpp"
-+#include "com/sun/star/beans/XPropertyState.hpp"
-+#include "com/sun/star/lang/XComponent.hpp"
-+#include "com/sun/star/lang/XMultiComponentFactory.hpp"
 +#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/container/XNameReplace.hpp"
-+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
-+#include "com/sun/star/util/XChangesBatch.hpp"
-+#include "com/sun/star/uno/Any.hxx"
-+#include "com/sun/star/uno/Reference.hxx"
 +#include "com/sun/star/uno/XComponentContext.hpp"
-+#include "cppuhelper/component_context.hxx"
-+#include "cppuhelper/servicefactory.hxx"
-+#include "cppunit/simpleheader.hxx"
-+#include "osl/file.hxx"
-+#include "osl/thread.h"
-+#include "osl/process.h"
-+#include "rtl/string.h"
-+#include "rtl/bootstrap.h"
-+#include "rtl/ustring.h"
-+#include "rtl/ustring.hxx"
-+#include "sal/types.h"
-+
-+namespace css = com::sun::star;
-+
-+#define CATCH_FAIL(msg) \
-+    catch (const css::uno::Exception &e) { \
-+        t_print ("msg '%s'\n", rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr()); \
-+        CPPUNIT_FAIL( msg ); \
-+        throw; \
-+    }
 +
-+class Magic
++class UnitBootstrap
 +{
++    com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
++    com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
 +  public:
-+    Magic(rtl::OUString aUserDir);
-+    ~Magic();
-+};
-+
-+class Test: public CppUnit::TestFixture {
-+    Magic *mpMagic;
-+public:
-+    // init
-+    virtual void setUp();
-+    virtual void tearDown();
-+    
-+    // helpers
-+    void normalizePathKey (rtl::OString &rPath, rtl::OString &rKey);
-+    css::uno::Reference< css::uno::XInterface > createView(const sal_Char *pNodepath, bool bUpdate);
-+    css::uno::Any getKey (const sal_Char *pPath, rtl::OUString aName);
-+    css::uno::Any getKey (const sal_Char *pPath, const sal_Char *pName)
-+        { return getKey (pPath, rtl::OUString::createFromAscii (pName)); }
-+
-+    // tests
-+    void createDocument();
-+
-+    CPPUNIT_TEST_SUITE(Test);
-+    CPPUNIT_TEST(createDocument);
-+    CPPUNIT_TEST_SUITE_END();
-+
-+private:
-+    css::uno::Reference< css::uno::XComponentContext > mxContext;
-+    css::uno::Reference< css::lang::XMultiServiceFactory > mxProvider;
++    UnitBootstrap();
++    ~UnitBootstrap();
++    com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
++        getMSF() { return mxMSF; }
 +};
 +
-+void disposeComponent (const css::uno::Reference<css::uno::XInterface> &xComp);
++#endif // UNIT_BOOTSTRAP_HXX
 --- /dev/null	2007-09-21 22:50:58.000000000 +0100
 +++ sc/qa/unit/export.map	2007-11-23 13:57:51.000000000 +0000
 @@ -0,0 +1,7 @@



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]