[Libreoffice-commits] .: patches/dev300 patches/unittesting
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Dec 20 08:24:25 PST 2010
patches/dev300/apply | 2
patches/unittesting/unittesting-more-sw.diff | 374 ---------------------------
2 files changed, 376 deletions(-)
New commits:
commit e3e441e9339a061d7de1770a874ead294ffa51d3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 20 16:24:18 2010 +0000
merged this into the build now
diff --git a/patches/dev300/apply b/patches/dev300/apply
index a1d4b59..c512f26 100755
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1724,8 +1724,6 @@ SectionIssue => i#86525
unit-deliver.diff
unit-comphelper.diff
unit-sc.diff
-# experimental unit testing using writer core
-# unittesting-more-sw.diff, thorsten
[ OxygenOfficePalettes ]
diff --git a/patches/unittesting/unittesting-more-sw.diff b/patches/unittesting/unittesting-more-sw.diff
deleted file mode 100644
index d96b1a1..0000000
--- a/patches/unittesting/unittesting-more-sw.diff
+++ /dev/null
@@ -1,374 +0,0 @@
-Some lame unit tests actually using writer core
-
-From: Thorsten Behrens <thb at openoffice.org>
-
-
----
-
- sw/qa/core/Test-BigPtrArray.cxx | 2 -
- sw/qa/core/makefile.mk | 68 +++++++++++++++++++
- sw/qa/core/swdoc-test.cxx | 135 +++++++++++++++++++++++++++++++++++++
- sw/source/core/bastyp/init.cxx | 15 +++-
- sw/source/core/bastyp/makefile.mk | 1
- tools/source/rc/resmgr.cxx | 37 ++++------
- 6 files changed, 230 insertions(+), 28 deletions(-)
- create mode 100644 sw/qa/core/swdoc-test.cxx
-
-
-diff --git sw/qa/core/Test-BigPtrArray.cxx sw/qa/core/Test-BigPtrArray.cxx
-index 4b0f9a5..b759917 100644
---- sw/qa/core/Test-BigPtrArray.cxx
-+++ sw/qa/core/Test-BigPtrArray.cxx
-@@ -34,7 +34,7 @@
-
- #include <cppunit/simpleheader.hxx>
- #include <bparr.hxx>
--#include <string>
-+#include <string.h>
- #include <stdlib.h>
- #include <rtl/logfile.hxx>
-
-diff --git sw/qa/core/makefile.mk sw/qa/core/makefile.mk
-index 7794dd7..3d1d2bf 100644
---- sw/qa/core/makefile.mk
-+++ sw/qa/core/makefile.mk
-@@ -73,9 +73,77 @@ DEF1NAME =$(SHL1TARGET)
- # DEF1EXPORTFILE= export.exp
- SHL1VERSIONMAP = export.map
-
-+# 2nd test ------------------------------------------------------------------
-+
-+SHL2OBJS=$(SLO)$/swdoc-test.obj
-+SHL2TARGET=swdoctest
-+SHL2STDLIBS+= \
-+ $(LNGLIB) \
-+ $(CPPUNITLIB) \
-+ $(SVXCORELIB) \
-+ $(SVXLIB) \
-+ $(SFXLIB) \
-+ $(XMLOFFLIB) \
-+ $(BASICLIB) \
-+ $(GOODIESLIB) \
-+ $(BASEGFXLIB) \
-+ $(DRAWINGLAYERLIB) \
-+ $(SVTOOLLIB) \
-+ $(TKLIB) \
-+ $(VCLLIB) \
-+ $(SVLLIB) \
-+ $(SOTLIB) \
-+ $(UNOTOOLSLIB) \
-+ $(TOOLSLIB) \
-+ $(I18NISOLANGLIB) \
-+ $(COMPHELPERLIB) \
-+ $(UCBHELPERLIB) \
-+ $(CPPUHELPERLIB) \
-+ $(CPPULIB) \
-+ $(VOSLIB) \
-+ $(SALLIB) \
-+ $(SALHELPERLIB) \
-+ $(ICUUCLIB) \
-+ $(I18NUTILLIB) \
-+ $(VBAHELPERLIB) \
-+ $(AVMEDIALIB)
-+
-+SHL2IMPLIB= i$(SHL2TARGET)
-+DEF2NAME =$(SHL2TARGET)
-+SHL2VERSIONMAP = export.map
-+
-+# linking statically against sw parts
-+SHL2LIBS=\
-+ $(SLB)$/swall.lib \
-+ $(SLB)$/core1.lib \
-+ $(SLB)$/core2.lib \
-+ $(SLB)$/core3.lib \
-+ $(SLB)$/core4.lib \
-+ $(SLB)$/filter.lib \
-+ $(SLB)$/ui1.lib \
-+ $(SLB)$/ui2.lib
-+
- # END ------------------------------------------------------------------
-
- # --- Targets ------------------------------------------------------
-
- .INCLUDE : target.mk
- .INCLUDE : _cppunit.mk
-+
-+# --- Fake uno bootstrap & copy testfile ------------------------
-+
-+$(BIN)$/sw_unittest_test.ini : makefile.mk
-+ rm -f $@
-+ @echo UNO_SERVICES= > $@
-+ @echo UNO_TYPES=$(UNOUCRRDB:s/\/\\/) >> $@
-+
-+# --- Enable testshl2 execution in normal build ------------------------
-+
-+$(MISC)$/sw_unittest_succeeded : $(SHL2TARGETN) $(BIN)$/sw_unittest_test.ini
-+ @echo ----------------------------------------------------------
-+ @echo - start unit test on library $(SHL2TARGETN)
-+ @echo ----------------------------------------------------------
-+ testshl2 -forward $(BIN)$/ $(SHL2TARGETN)
-+ $(TOUCH) $@
-+
-+ALLTAR : $(MISC)$/sw_unittest_succeeded
-diff --git sw/qa/core/swdoc-test.cxx sw/qa/core/swdoc-test.cxx
-new file mode 100644
-index 0000000..cffb562
---- /dev/null
-+++ sw/qa/core/swdoc-test.cxx
-@@ -0,0 +1,135 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: $
-+ *
-+ * $Revision: $
-+ *
-+ * last change: $Author: $ $Date: $
-+ *
-+ * 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 2005 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 "precompiled_sw.hxx"
-+
-+#include <cppunit/simpleheader.hxx>
-+
-+#include <osl/file.hxx>
-+#include <osl/process.h>
-+#include <cppuhelper/compbase1.hxx>
-+#include <cppuhelper/bootstrap.hxx>
-+#include <cppuhelper/basemutex.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <vcl/svapp.hxx>
-+#include <sfx2/app.hxx>
-+
-+#include "init.hxx"
-+#include "swtypes.hxx"
-+#include "../source/ui/inc/initui.hxx"
-+#include "doc.hxx"
-+
-+using namespace ::com::sun::star;
-+
-+/* Implementation of Swdoc-Test class */
-+
-+class SwDocTest : public CppUnit::TestFixture
-+{
-+ uno::Reference<uno::XComponentContext> mxCtx;
-+ bool mbUnoInitialized;
-+
-+public:
-+ SwDocTest() : mxCtx(), mbUnoInitialized(false) {}
-+
-+ void setUp()
-+ {
-+ if( !mbUnoInitialized )
-+ {
-+ const char* pArgs( getForwardString() );
-+ CPPUNIT_ASSERT_MESSAGE("Test file parameter", pArgs);
-+
-+ const rtl::OUString sBaseDir(
-+ rtl::OUString::createFromAscii(pArgs));
-+
-+ // bootstrap UNO
-+ try
-+ {
-+ ::rtl::OUString aIniUrl;
-+ CPPUNIT_ASSERT_MESSAGE(
-+ "Converting ini file to URL",
-+ osl_getFileURLFromSystemPath(
-+ (sBaseDir+rtl::OUString::createFromAscii("sw_unittest_test.ini")).pData,
-+ &aIniUrl.pData ) == osl_File_E_None );
-+
-+ mxCtx = ::cppu::defaultBootstrap_InitialComponentContext(aIniUrl);
-+ CPPUNIT_ASSERT_MESSAGE("Getting component context", mxCtx.is());
-+
-+ uno::Reference<lang::XMultiServiceFactory> xFac(
-+ mxCtx->getServiceManager(),
-+ uno::UNO_QUERY_THROW);
-+ comphelper::setProcessServiceFactory(xFac);
-+
-+ InitVCL(xFac);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ CPPUNIT_ASSERT_MESSAGE("Bootstrapping UNO/UCB/VCL", false);
-+ }
-+
-+ mbUnoInitialized = true;
-+ }
-+
-+ _InitCore();
-+ pSwResMgr = SfxApplication::CreateResManager( "sw" );
-+ _InitUI();
-+ }
-+
-+ void tearDown()
-+ {
-+ _FinitUI();
-+ pSwResMgr = 0;
-+ _FinitCore();
-+ }
-+
-+ void randomTest()
-+ {
-+ SwDoc aDoc;
-+
-+ CPPUNIT_ASSERT_MESSAGE("SwDoc::IsRedlineOn()", !aDoc.IsRedlineOn());
-+ }
-+
-+ CPPUNIT_TEST_SUITE(SwDocTest);
-+ CPPUNIT_TEST(randomTest);
-+ CPPUNIT_TEST_SUITE_END();
-+
-+private:
-+};
-+
-+//#####################################
-+// register test suites
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(SwDocTest, "SwDocTest");
-+
-+NOADDITIONAL;
-+
-diff --git sw/source/core/bastyp/init.cxx sw/source/core/bastyp/init.cxx
-index 79dc3f7..22674eb 100644
---- sw/source/core/bastyp/init.cxx
-+++ sw/source/core/bastyp/init.cxx
-@@ -754,9 +754,14 @@ void _InitCore()
-
- pGlobalOLEExcludeList = new SvPtrarr;
-
-- const SvxSwAutoFmtFlags& rAFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
-- SwDoc::pACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
-- rAFlags.nAutoCmpltWordLen );
-+ try
-+ {
-+ const SvxSwAutoFmtFlags& rAFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
-+ SwDoc::pACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
-+ rAFlags.nAutoCmpltWordLen );
-+ } catch( uno::RuntimeException& )
-+ {
-+ }
- }
-
- /******************************************************************************
-@@ -861,7 +866,9 @@ CharClass& GetAppCharClass()
-
- LocaleDataWrapper& GetAppLocaleData()
- {
-- SvtSysLocale aSysLocale;
-+ // wow. returning reference to a local object. hacked to work for
-+ // now...
-+ static SvtSysLocale aSysLocale;
- return (LocaleDataWrapper&)aSysLocale.GetLocaleData();
- }
-
-diff --git sw/source/core/bastyp/makefile.mk sw/source/core/bastyp/makefile.mk
-index 2203980..4444944 100644
---- sw/source/core/bastyp/makefile.mk
-+++ sw/source/core/bastyp/makefile.mk
-@@ -78,6 +78,7 @@ SLOFILES = \
-
- EXCEPTIONSFILES = \
- $(SLO)$/SwBitArray.obj \
-+ $(SLO)$/init.obj \
- $(SLO)$/tabcol.obj
-
- # --- Tagets -------------------------------------------------------
-diff --git tools/source/rc/resmgr.cxx tools/source/rc/resmgr.cxx
-index 3610223..fec0c42 100644
---- tools/source/rc/resmgr.cxx
-+++ tools/source/rc/resmgr.cxx
-@@ -838,26 +838,6 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr,
-
- // =======================================================================
-
--static void RscException_Impl()
--{
-- switch ( NAMESPACE_VOS(OSignalHandler)::raise( OSL_SIGNAL_USER_RESOURCEFAILURE, (void*)"" ) )
-- {
-- case NAMESPACE_VOS(OSignalHandler)::TAction_CallNextHandler:
-- abort();
--
-- case NAMESPACE_VOS(OSignalHandler)::TAction_Ignore:
-- return;
--
-- case NAMESPACE_VOS(OSignalHandler)::TAction_AbortApplication:
-- abort();
--
-- case NAMESPACE_VOS(OSignalHandler)::TAction_KillApplication:
-- exit(-1);
-- }
--}
--
--// =======================================================================
--
- void ImpRCStack::Init( ResMgr* pMgr, const Resource* pObj, sal_uInt32 Id )
- {
- pResource = NULL;
-@@ -952,7 +932,6 @@ void ResMgr::Init( const OUString& rFileName )
- aStr += ByteString( OUStringToOString( rFileName, RTL_TEXTENCODING_UTF8 ) );
- DBG_ERROR( aStr.GetBuffer() );
- #endif
-- RscException_Impl();
- }
- #ifdef DBG_UTIL
- else
-@@ -1183,6 +1162,18 @@ BOOL ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
- pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes;
- else
- {
-+ if( !pImpRes )
-+ {
-+#ifdef DBG_UTIL
-+ RscError_Impl( "Cannot load resource! ",
-+ this, nRT, nId, aStack, nCurStack-1 );
-+#endif
-+ pTop->Flags |= RC_NOTFOUND;
-+ pTop->pClassRes = getEmptyBuffer();
-+ pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes;
-+ return FALSE;
-+ }
-+
- pTop->pClassRes = pImpRes->LoadGlobalRes( nRT, nId, &pTop->aResHandle );
- if ( pTop->pClassRes )
- {
-@@ -1688,7 +1679,7 @@ ResMgr* ResMgr::CreateResMgr( const sal_Char* pPrefixName,
- aLocale = ResMgrContainer::get().getDefLocale();
-
- InternalResMgr* pImp = ResMgrContainer::get().getResMgr( aPrefix, aLocale );
-- return pImp ? new ResMgr( pImp ) : NULL;
-+ return new ResMgr( pImp );
- }
-
- // -----------------------------------------------------------------------
-@@ -1705,7 +1696,7 @@ ResMgr* ResMgr::SearchCreateResMgr(
- rLocale = ResMgrContainer::get().getDefLocale();
-
- InternalResMgr* pImp = ResMgrContainer::get().getResMgr( aPrefix, rLocale );
-- return pImp ? new ResMgr( pImp ) : NULL;
-+ return new ResMgr( pImp );
- }
-
- // -----------------------------------------------------------------------
More information about the Libreoffice-commits
mailing list