ooo-build r11645 - trunk/patches/test



Author: michael
Date: Wed Feb 20 15:33:21 2008
New Revision: 11645
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11645&view=rev

Log:
cleanups.


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 15:33:21 2008
@@ -1,6 +1,6 @@
 --- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/makefile.mk	2008-02-20 12:10:50.000000000 +0000
-@@ -0,0 +1,87 @@
++++ sc/qa/unit/makefile.mk	2008-02-20 15:36:14.000000000 +0000
+@@ -0,0 +1,95 @@
 +#*************************************************************************
 +#
 +#   OpenOffice.org - a multi-platform office productivity suite
@@ -82,251 +82,38 @@
 +
 +ALLTAR: test
 +
-+$(MISC)$/$(TARGET).rdb .ERRREMOVE:
-+    $(COPY) $(SOLARBINDIR)$/types.rdb $@
-+    regmerge $@ / $(SOLARLIBDIR)$/services.rdb
-+
-+test .PHONY: $(SHL1TARGETN) $(MISC)$/$(TARGET).rdb
-+    testshl2 $(SHL1TARGETN) -forward "$(MISC)$/$(TARGET).rdb#$(PWD)$/$(MISC)$/$(TARGET).registry"
---- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/ubootstrap.cxx	2008-02-20 14:43:28.000000000 +0000
-@@ -0,0 +1,115 @@
-+#include "common.hxx"
-+#include <osl/file.hxx>
-+
-+// Do all those evil things to make the tests actually work ...
-+Magic::Magic()
-+{
-+    rtl_uString *curWd = NULL;
-+    osl_getProcessWorkingDir( &curWd );
-+
-+    rtl::OUString aKey;
-+    rtl::OUString aValue( curWd );
-+
-+    // Unless you do this, obviously you don't want your paths to be correct 
-+    // or file access to work properly
-+    aKey = rtl::OUString::createFromAscii( "BaseInstallation" );
-+    rtl_bootstrap_set( aKey.pData, aValue.pData );
-+    // Unless you do this, obviously you don't deserve to have anything work
-+    aKey = rtl::OUString::createFromAscii( "CFG_INIFILE" );
-+    aValue += rtl::OUString::createFromAscii( "/configmgrrc" );
-+    rtl_bootstrap_set( aKey.pData, aValue.pData );
-+
-+    // FIXME: Create a safe /tmp directory - unfotunately that
-+    // either requires dependencies we don't have, or some cut &
-+    // paste action of unotools/source/ucbhelper/tempfile.cxx
-+    if (osl::File::getTempDirURL(maTempDir) != osl::FileBase::E_None) {
-+        t_print ("no tmp dir");
-+        CPPUNIT_FAIL ("no tmp dir");
-+    }
-+    maTempDir += rtl::OUString::createFromAscii("/unittstconfig");
-+    osl::FileBase::RC err = osl::Directory::create (maTempDir);
-+                            
-+    if (err != osl::FileBase::E_None) {
-+        t_print ("tmp dir '%s' already exists\n",
-+                 rtl::OUStringToOString (maTempDir, RTL_TEXTENCODING_UTF8).getStr());
-+//        CPPUNIT_FAIL ("tmp user config dir already exists!");
-+    }
-+
-+    aKey = rtl::OUString::createFromAscii( "UserInstallation" );
-+    rtl_bootstrap_set( aKey.pData, maTempDir.pData );
-+
-+    {
-+        rtl::OUString aTmp, aSolver;
-+        
-+        aTmp = (rtl::OUString::createFromAscii(getenv("SOLARVER")) +
-+                rtl::OUString::createFromAscii("/") +
-+                rtl::OUString::createFromAscii(getenv("INPATH")));
-+        
-+        if (osl::FileBase::getFileURLFromSystemPath(aTmp, aSolver) != osl::FileBase::E_None)
-+            std::abort();
-+
-+        fprintf (stderr, "set SOLVER to '%s'\n",
-+                 rtl::OUStringToOString (aSolver, RTL_TEXTENCODING_UTF8).getStr());
-+
-+        aKey = rtl::OUString::createFromAscii( "SOLVER" );
-+        rtl_bootstrap_set( aKey.pData, aSolver.pData );
-+    }
-+
-+    // Force vcl to be headless on Unix
-+    fprintf (stderr, "Clobber display\n");
-+    putenv ("SAL_USE_VCLPLUGIN=svp");
-+    putenv ("OOO_FORCE_DESKTOP=none");
-+}
-+
-+void removeRecursive (const rtl::OUString& aPath)
-+{
-+	sal_Int32 nMask = FileStatusMask_Type | FileStatusMask_FileURL;
-+
-+//    fprintf (stderr, "Remove recursive '%s'\n", rtl::OUStringToOString (aPath, RTL_TEXTENCODING_UTF8).getStr());
-+    
-+	osl::DirectoryItem aItem;
-+	osl::FileStatus aStatus( nMask );
-+	osl::FileBase::RC nError;
-+
-+    nError = osl::DirectoryItem::get( aPath, aItem );
-+    CPPUNIT_ASSERT_MESSAGE ("invalid path", nError == osl::FileBase::E_None);
-+
-+    nError = aItem.getFileStatus( aStatus );
-+    CPPUNIT_ASSERT_MESSAGE ("invalid file", nError == osl::FileBase::E_None);
-+
-+    if (aStatus.getFileType() == osl::FileStatus::Regular ||
-+        aStatus.getFileType() == osl::FileStatus::Link )
-+    {
-+		nError = osl::File::remove( aPath );
-+//        fprintf (stderr, "Remove file '%s'\n", rtl::OUStringToOString (aPath, RTL_TEXTENCODING_UTF8).getStr());
-+        CPPUNIT_ASSERT_MESSAGE ("removing file", nError == osl::FileBase::E_None);
-+    }
-+    else if (aStatus.getFileType() == osl::FileStatus::Directory)
-+    {
-+		osl::Directory aDirectory (aPath);
-+		nError = aDirectory.open();
-+        CPPUNIT_ASSERT_MESSAGE ("opening dir", nError == osl::FileBase::E_None);
-+
-+		rtl::OUString name;
-+
-+        while (true) {
-+            nError = aDirectory.getNextItem( aItem );
-+            if ( nError != osl::FileBase::E_None )
-+                break;
-+  			nError = aItem.getFileStatus( aStatus );
-+            CPPUNIT_ASSERT_MESSAGE ("getting status", nError == osl::FileBase::E_None);
-+            removeRecursive (aStatus.getFileURL());
-+		}
-+  		aDirectory.close();
-+
-+		nError = osl::Directory::remove( aPath );
-+//        fprintf (stderr, "Remove dir '%s'\n", rtl::OUStringToOString (aPath, RTL_TEXTENCODING_UTF8).getStr());
-+
-+        CPPUNIT_ASSERT_MESSAGE ("removing directory", nError == osl::FileBase::E_None);
-+    }
-+}
-+
-+Magic::~Magic()
-+{
-+//    removeRecursive (maTempDir);
-+}
---- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/common.hxx	2008-02-20 14:17:38.000000000 +0000
-@@ -0,0 +1,105 @@
-+/*************************************************************************
-+ *
-+ *  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
-+ *
-+ ************************************************************************/
-+
-+#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"
++USERDIR=$(OUT)$/unit
 +
-+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
-+{
-+    rtl::OUString maTempDir;
-+  public:
-+    Magic();
-+    ~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();
++$(USERDIR):
++    $(RM) -rf $(USERDIR)
++    $(COPY) $(COPYRECURSE) $(SOLARXMLDIR)$/unit-skel $(USERDIR)
 +
-+    CPPUNIT_TEST_SUITE(Test);
-+    CPPUNIT_TEST(createDocument);
-+    CPPUNIT_TEST_SUITE_END();
++$(USERDIR)$/$(TARGET).rdb .ERRREMOVE: $(USERDIR)
++    $(COPY) $(SOLARBINDIR)$/types.rdb $@
++    regmerge $@ / $(SOLARLIBDIR)$/services.rdb
 +
-+private:
-+    css::uno::Reference< css::uno::XComponentContext > mxContext;
-+    css::uno::Reference< css::lang::XMultiServiceFactory > mxProvider;
-+};
++test .PHONY: $(SHL1TARGETN) $(USERDIR)$/$(TARGET).rdb
++    testshl2 $(SHL1TARGETN) -forward "$(USERDIR)$/$(TARGET).rdb#$(USERDIR)"
++    @$(RM) -rf $(USERDIR)
 +
-+void disposeComponent (const css::uno::Reference<css::uno::XInterface> &xComp);
 --- /dev/null	2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/ucalc.cxx	2008-02-20 14:44:22.000000000 +0000
-@@ -0,0 +1,170 @@
++++ 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"
 +
 +// TODO ...
-+//    re-factor
-+//    don't call regcomp if we don't have it.
++//    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
-+//    [etc.]
++//    find & kill signalfile stuff (?)
++//    use system .rdb ? [ quite big ... ]
 +
 +#include "comphelper/processfactory.hxx"
 +#include "vcl/svapp.hxx"
@@ -339,22 +126,18 @@
 +
 +void Test::setUp()
 +{
-+    mpMagic = new Magic();
-+
 +    char const * f = getForwardString();
-+    rtl::OUString args(
-+        f, rtl_str_getLength(f), osl_getThreadTextEncoding());
-+        //TODO: handle conversion failure
++    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 regpath(args.copy(i + 1));
-+    rtl::OUString regurl;
-+    if (osl::FileBase::getFileURLFromSystemPath(regpath, regurl) !=
-+        osl::FileBase::E_None)
-+        std::abort();
++    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);
@@ -362,6 +145,8 @@
 +        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(
@@ -512,3 +297,120 @@
 +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
++ *
++ ************************************************************************/
++
++#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
++{
++  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;
++};
++
++void disposeComponent (const css::uno::Reference<css::uno::XInterface> &xComp);
+--- /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 @@
++UDK_3.0 {
++    global:
++        registerAllTestFunction;
++
++    local:
++        *;
++};



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