[Libreoffice-commits] .: 9 commits - hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk hwpfilter/qa lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk lotuswordpro/qa sal/cppunittester sax/source sc/CppunitTest_sc_filters_test.mk sc/qa sot/CppunitTest_sot_test_sot.mk sot/Module_sot.mk sot/prj sot/qa sot/source svtools/CppunitTest_svtools_filters_test.mk svtools/qa sw/CppunitTest_sw_filters_test.mk sw/qa test/inc test/prj test/source unotest/inc unotest/prj unotest/source unotools/inc unotools/source unusedcode.easy vcl/source vcl/unx writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/qa

Caolán McNamara caolan at kemper.freedesktop.org
Sat Oct 15 04:19:55 PDT 2011


 hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk          |    3 
 hwpfilter/qa/cppunit/test_hwpfilter.cxx                    |    9 
 lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk |    3 
 lotuswordpro/qa/cppunit/test_lotuswordpro.cxx              |   11 
 sal/cppunittester/cppunittester.cxx                        |    2 
 sax/source/tools/converter.cxx                             |    5 
 sc/CppunitTest_sc_filters_test.mk                          |    5 
 sc/qa/unit/filters-test.cxx                                |   11 
 sot/CppunitTest_sot_test_sot.mk                            |   71 ++++++
 sot/Module_sot.mk                                          |    4 
 sot/prj/build.lst                                          |    2 
 sot/qa/cppunit/data/pass/fdo41642-2.compound               |binary
 sot/qa/cppunit/test_sot.cxx                                |   77 ++++++
 sot/source/sdstor/stgdir.cxx                               |   16 +
 svtools/CppunitTest_svtools_filters_test.mk                |    3 
 svtools/qa/cppunit/filters-test.cxx                        |    9 
 sw/CppunitTest_sw_filters_test.mk                          |    5 
 sw/qa/core/filters-test.cxx                                |    9 
 test/inc/test/bootstrapfixture.hxx                         |   22 -
 test/inc/test/filters-test.hxx                             |   80 -------
 test/prj/d.lst                                             |    1 
 test/source/bootstrapfixture.cxx                           |   33 --
 test/source/filters-test.cxx                               |  147 ------------
 test/source/makefile.mk                                    |    3 
 unotest/inc/unotest/bootstrapfixturebase.hxx               |   88 +++++++
 unotest/inc/unotest/filters-test.hxx                       |   75 ++++++
 unotest/prj/build.lst                                      |    2 
 unotest/prj/d.lst                                          |    2 
 unotest/source/cpp/bootstrapfixturebase.cxx                |   92 ++++++++
 unotest/source/cpp/filters-test.cxx                        |  148 +++++++++++++
 unotest/source/cpp/makefile.mk                             |    3 
 unotools/inc/unotools/bootstrap.hxx                        |    6 
 unotools/source/config/bootstrap.cxx                       |   33 --
 unusedcode.easy                                            |    2 
 vcl/source/gdi/jobset.cxx                                  |    8 
 vcl/source/gdi/pdfwriter_impl.cxx                          |    5 
 vcl/source/gdi/pdfwriter_impl2.cxx                         |   10 
 vcl/unx/generic/printergfx/common_gfx.cxx                  |    6 
 writerfilter/CppunitTest_writerfilter_rtftok.mk            |    3 
 writerfilter/qa/cppunittests/rtftok/testrtftok.cxx         |    9 
 40 files changed, 649 insertions(+), 374 deletions(-)

New commits:
commit ca85f280e26b9090c06b8b2092e3dde570043e16
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 15 12:11:43 2011 +0100

    Fix overflow in smoketest, promotion from sal_Int32 to sal_Int64 doesn't happen before assign

diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 092e82d..e9a08c4 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -400,8 +400,9 @@ void Converter::convertMeasure( OUStringBuffer& rBuffer,
         break;
     }
 
-    OSL_ENSURE(nMeasure <= SAL_MAX_INT64 / nMul, "convertMeasure: overflow");
-    sal_Int64 nValue = nMeasure * nMul;
+    sal_Int64 nValue = nMeasure;
+    OSL_ENSURE(nValue <= SAL_MAX_INT64 / nMul, "convertMeasure: overflow");
+    nValue *= nMul;
     nValue /= nDiv;
     nValue += 5;
     nValue /= 10;
commit afd6a9059bcfd6def2b4cb45198b26aa65248f21
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 14 23:54:39 2011 +0100

    ByteString->rtl::OString

diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 785a438..0f5c106 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -401,10 +401,10 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup )
 
             ImplOldJobSetupData aOldData;
             memset( &aOldData, 0, sizeof( aOldData ) );
-            ByteString aPrnByteName( rJobSetup.GetPrinterName(), RTL_TEXTENCODING_UTF8 );
-            strncpy( aOldData.cPrinterName, aPrnByteName.GetBuffer(), 63 );
-            ByteString aDriverByteName( rJobSetup.GetDriverName(), RTL_TEXTENCODING_UTF8 );
-            strncpy( aOldData.cDriverName, aDriverByteName.GetBuffer(), 31 );
+            rtl::OString aPrnByteName(rtl::OUStringToOString(rJobSetup.GetPrinterName(), RTL_TEXTENCODING_UTF8));
+            strncpy( aOldData.cPrinterName, aPrnByteName.getStr(), 63 );
+            rtl::OString aDriverByteName(rtl::OUStringToOString(rJobSetup.GetDriverName(), RTL_TEXTENCODING_UTF8));
+            strncpy( aOldData.cDriverName, aDriverByteName.getStr(), 31 );
 //          nLen = sizeof( aOldData ) + 4 + nOldJobDataSize + pJobData->mnDriverDataLen;
             int nPos = rOStream.Tell();
             rOStream << nLen;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 0fd955a..3bdcbe1 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6990,9 +6990,8 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
                         cChar -= 0xf000;
                     else
                     {
-                        String aString(cChar);
-                        ByteString aChar( aString, RTL_TEXTENCODING_MS_1252 );
-                        cChar = ((sal_Ucs)aChar.GetChar( 0 )) & 0x00ff;
+                        rtl::OString aChar(&cChar, 1, RTL_TEXTENCODING_MS_1252);
+                        cChar = ((sal_Ucs)aChar[0]) & 0x00ff;
                     }
                 }
             }
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index b973ee3..f7a1ad5 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -557,11 +557,11 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                         {
                             SvMemoryStream  aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
                             sal_Bool        bSkipSequence = sal_False;
-                            ByteString      sSeqEnd;
+                            rtl::OString sSeqEnd;
 
                             if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) )
                             {
-                                sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" );
+                                sSeqEnd = rtl::OString(RTL_CONSTASCII_STRINGPARAM("XPATHSTROKE_SEQ_END"));
                                 SvtGraphicStroke aStroke;
                                 aMemStm >> aStroke;
 
@@ -646,7 +646,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                             }
                             else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) )
                             {
-                                sSeqEnd = ByteString( "XPATHFILL_SEQ_END" );
+                                sSeqEnd = rtl::OString(RTL_CONSTASCII_STRINGPARAM("XPATHFILL_SEQ_END"));
                                 SvtGraphicFill aFill;
                                 aMemStm >> aFill;
 
@@ -754,8 +754,8 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                                     pAction = aMtf.GetAction( i );
                                     if ( pAction->GetType() == META_COMMENT_ACTION )
                                     {
-                                        ByteString sComment( ((MetaCommentAction*)pAction)->GetComment() );
-                                        if ( sComment.Equals( sSeqEnd ) )
+                                        rtl::OString sComment( ((MetaCommentAction*)pAction)->GetComment() );
+                                        if (sComment == sSeqEnd)
                                             break;
                                     }
                                     // #i44496#
diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx
index 71ae696..e576173 100644
--- a/vcl/unx/generic/printergfx/common_gfx.cxx
+++ b/vcl/unx/generic/printergfx/common_gfx.cxx
@@ -1191,12 +1191,12 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize
     aStream.Seek( STREAM_SEEK_TO_BEGIN );
     ByteString aLine;
 
-    ByteString aDocTitle;
+    rtl::OString aDocTitle;
     double fLeft = 0, fRight = 0, fTop = 0, fBottom = 0;
     bool bEndComments = false;
     while( ! aStream.IsEof()
            && ( ( fLeft == 0 && fRight == 0 && fTop == 0 && fBottom == 0 ) ||
-                ( aDocTitle.Len() == 0 && bEndComments == false ) )
+                ( aDocTitle.getLength() == 0 && bEndComments == false ) )
            )
     {
         aStream.ReadLine( aLine );
@@ -1229,7 +1229,7 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize
     }
 
     static sal_uInt16 nEps = 0;
-    if( ! aDocTitle.Len() )
+    if( ! aDocTitle.getLength() )
         aDocTitle = rtl::OString::valueOf(static_cast<sal_Int32>(nEps++));
 
     if( fLeft != fRight && fTop != fBottom )
commit 7a8c46ae1ffe72c3c77274bf4e7828e1363b34e6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 14 10:00:59 2011 +0100

    don't need getExecutableDirectory anymore

diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index d5959cd..c239854 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -453,20 +453,6 @@ OUString getExecutableBaseName()
     return sExecutable;
 }
 
-// ---------------------------------------------------------------------------------------
-static
-OUString getExecutableDirectory()
-{
-    OUString sFileName;
-    OSL_VERIFY(osl_Process_E_None == osl_getExecutableFile(&sFileName.pData));
-
-    sal_Int32 nDirEnd = sFileName.lastIndexOf(cURLSeparator);
-
-    OSL_ENSURE(nDirEnd >= 0, "Cannot locate executable directory");
-
-    return sFileName.copy(0,nDirEnd);
-}
-
 // ----------------------------------------------------------------------------------
 
 static
commit cdbd93e9a548d48109f2227bff1d94743e46949b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 13 22:27:12 2011 +0100

    callcatcher: some unused code

diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx
index 81135c4..f596d63 100644
--- a/unotools/inc/unotools/bootstrap.hxx
+++ b/unotools/inc/unotools/bootstrap.hxx
@@ -64,9 +64,6 @@ namespace utl
         /// retrieve the BUILDID information item; uses the given default, if not found
         static rtl::OUString getBuildIdData(rtl::OUString const& _sDefault);
 
-        /// retrieve the ALLUSERS information item from setup.ini file; uses the given default, if not found
-        static rtl::OUString getAllUsersValue(rtl::OUString const& _sDefault);
-
         /// reload cached data
         static void reloadData();
 
@@ -123,9 +120,6 @@ namespace utl
             INVALID_BOOTSTRAP_DATA        /// some bootstrap data was invalid in unexpected ways
         };
 
-        /// Evaluates the status of the installation and returns a diagnostic message corresponding to this status
-        static Status checkBootstrapStatus(rtl::OUString& _rDiagnosticMessage);
-
         /** Evaluates the status of the installation and returns a diagnostic
             message and error code corresponding to this status
         */
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index aa0d1b4..d5959cd 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -682,17 +682,6 @@ OUString Bootstrap::getBuildIdData(OUString const& _sDefault)
 
 // ---------------------------------------------------------------------------------------
 
-OUString Bootstrap::getAllUsersValue(OUString const& _sDefault)
-{
-    OUString const csAllUsersItem(RTL_CONSTASCII_USTRINGPARAM(SETUP_ITEM_ALLUSERS));
-
-    rtl::Bootstrap aData( getExecutableDirectory() + OUString( RTL_CONSTASCII_USTRINGPARAM( "/"SETUP_DATA_NAME ) ) );
-    OUString sResult;
-    aData.getFrom( csAllUsersItem, sResult, _sDefault );
-    return sResult;
-}
-// ---------------------------------------------------------------------------------------
-
 Bootstrap::PathStatus Bootstrap::locateBaseInstallation(OUString& _rURL)
 {
     Impl::PathData const& aPathData = data().aBaseInstall_;
@@ -765,14 +754,6 @@ PathStatus Bootstrap::locateVersionFile(OUString& _rURL)
 }
 // ---------------------------------------------------------------------------------------
 
-Bootstrap::Status Bootstrap::checkBootstrapStatus(OUString& _rDiagnosticMessage)
-{
-    FailureCode eDummyCode(NO_FAILURE);
-
-    return checkBootstrapStatus(_rDiagnosticMessage,eDummyCode);
-}
-// ---------------------------------------------------------------------------------------
-
 Bootstrap::Status Bootstrap::checkBootstrapStatus(rtl::OUString& _rDiagnosticMessage, FailureCode& _rErrCode)
 {
     Impl const& aData = data();
diff --git a/unusedcode.easy b/unusedcode.easy
index c025a98..624eeb7 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -2816,8 +2816,6 @@ unicode::isTitle(unsigned short)
 unicode::isUnicodeScriptType(unsigned short, short)
 unographic::GraphicDescriptor::isValid() const
 utl::AccessibleStateSetHelper::Compare(utl::AccessibleStateSetHelper const&, utl::AccessibleStateSetHelper&, utl::AccessibleStateSetHelper&)
-utl::Bootstrap::checkBootstrapStatus(rtl::OUString&)
-utl::Bootstrap::getAllUsersValue(rtl::OUString const&)
 utl::ConfigManager::ConfigManager(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>)
 utl::MultiAtomProvider::getLastAtom(int) const
 utl::MultiAtomProvider::hasAtom(int, int) const
commit a5aef9544429319cd0c0cfa0631571c8a46ae70f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 13 13:58:42 2011 +0100

    now drop not available yet includes

diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx
index 5748e33..3fccdf1 100644
--- a/unotest/source/cpp/bootstrapfixturebase.cxx
+++ b/unotest/source/cpp/bootstrapfixturebase.cxx
@@ -27,22 +27,16 @@
  * 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
commit db5a5ffa82f835c81cf9a411d24f4cb0b1bb8fa5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 12 15:19:21 2011 +0100

    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

diff --git a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk
index 01edac8..a6c841c 100644
--- a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk
+++ b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk
@@ -37,12 +37,13 @@ $(eval $(call gb_CppunitTest_add_exception_objects,hwpfilter_test_hwpfilter, \
 ))
 
 $(eval $(call gb_CppunitTest_add_linked_libs,hwpfilter_test_hwpfilter, \
-    test \
     ucbhelper \
     comphelper \
     cppu \
     cppuhelper \
     sal \
+    test \
+    unotest \
     $(gb_STDLIBS) \
 ))
 
diff --git a/hwpfilter/qa/cppunit/test_hwpfilter.cxx b/hwpfilter/qa/cppunit/test_hwpfilter.cxx
index 2e96284..cbd3aa0 100644
--- a/hwpfilter/qa/cppunit/test_hwpfilter.cxx
+++ b/hwpfilter/qa/cppunit/test_hwpfilter.cxx
@@ -26,7 +26,8 @@
  * 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 <osl/file.hxx>
@@ -37,7 +38,9 @@ using namespace ::com::sun::star;
 
 namespace
 {
-    class HwpFilterTest : public test::FiltersTest
+    class HwpFilterTest
+        : public test::FiltersTest
+        , public test::BootstrapFixture
     {
     public:
         virtual void setUp();
@@ -53,7 +56,7 @@ namespace
 
     void HwpFilterTest::setUp()
     {
-        test::FiltersTest::setUp();
+        test::BootstrapFixture::setUp();
 
         m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
diff --git a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
index 66aee34..0541ed8 100644
--- a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
+++ b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
@@ -37,11 +37,12 @@ $(eval $(call gb_CppunitTest_add_exception_objects,lotuswordpro_test_lotuswordpr
 ))
 
 $(eval $(call gb_CppunitTest_add_linked_libs,lotuswordpro_test_lotuswordpro, \
-    test \
     comphelper \
     cppu \
     cppuhelper \
     sal \
+    test \
+    unotest \
     vcl \
     $(gb_STDLIBS) \
 ))
diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
index 7500e25..1f1f4e0 100644
--- a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
+++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
@@ -26,7 +26,8 @@
  * 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 <osl/file.hxx>
@@ -36,10 +37,12 @@ using namespace ::com::sun::star;
 
 namespace
 {
-    class LotusWordProTest : public test::FiltersTest
+    class LotusWordProTest
+        : public test::FiltersTest
+        , public test::BootstrapFixture
     {
     public:
-        LotusWordProTest() : FiltersTest(true, false) {}
+        LotusWordProTest() : BootstrapFixture(true, false) {}
 
         virtual void setUp();
 
@@ -57,7 +60,7 @@ namespace
 
     void LotusWordProTest::setUp()
     {
-        test::FiltersTest::setUp();
+        test::BootstrapFixture::setUp();
 
         m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk
index d6ea1b8..38f013b 100644
--- a/sc/CppunitTest_sc_filters_test.mk
+++ b/sc/CppunitTest_sc_filters_test.mk
@@ -35,7 +35,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_filters_test, \
 ))
 
 $(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \
-	test \
     avmedia \
     basegfx \
     comphelper \
@@ -60,9 +59,11 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \
     svt \
     svx \
     svxcore \
-    tk \
+	test \
     tl \
+    tk \
     ucbhelper \
+	unotest \
     utl \
     vbahelper \
     vcl \
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 38eb940..1faba35 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -28,7 +28,8 @@
  */
 
 #include <sal/config.h>
-#include <test/filters-test.hxx>
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
 #include <rtl/strbuf.hxx>
 #include <osl/file.hxx>
 
@@ -137,7 +138,9 @@ void testCondFile(rtl::OUString& aFileName, ScDocument* pDoc, SCTAB nTab)
 
 /* Implementation of Filters test */
 
-class ScFiltersTest : public test::FiltersTest
+class ScFiltersTest
+    : public test::FiltersTest
+    , public test::BootstrapFixture
 {
 public:
     ScFiltersTest();
@@ -648,7 +651,7 @@ ScFiltersTest::ScFiltersTest()
 
 void ScFiltersTest::setUp()
 {
-    test::FiltersTest::setUp();
+    test::BootstrapFixture::setUp();
 
     // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
     // which is a private symbol to us, gets called
@@ -661,7 +664,7 @@ void ScFiltersTest::setUp()
 void ScFiltersTest::tearDown()
 {
     uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
-    test::FiltersTest::tearDown();
+    test::BootstrapFixture::tearDown();
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);
diff --git a/sot/CppunitTest_sot_test_sot.mk b/sot/CppunitTest_sot_test_sot.mk
index d3ac12f..0536528 100644
--- a/sot/CppunitTest_sot_test_sot.mk
+++ b/sot/CppunitTest_sot_test_sot.mk
@@ -42,9 +42,8 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sot_test_sot, \
     cppuhelper \
     sal \
     sot \
-    test \
     tl \
-    vcl \
+    unotest \
     $(gb_STDLIBS) \
 ))
 
diff --git a/sot/prj/build.lst b/sot/prj/build.lst
index 302881c..73434fb 100644
--- a/sot/prj/build.lst
+++ b/sot/prj/build.lst
@@ -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
diff --git a/sot/qa/cppunit/data/pass/fdo41642-2.compound b/sot/qa/cppunit/data/pass/fdo41642-2.compound
new file mode 100644
index 0000000..b1ae6dd
Binary files /dev/null and b/sot/qa/cppunit/data/pass/fdo41642-2.compound differ
diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index 39d86cb..b695e80 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -26,7 +26,8 @@
  * instead of those above.
  */
 
-#include <test/filters-test.hxx>
+#include <unotest/filters-test.hxx>
+#include <unotest/bootstrapfixturebase.hxx>
 
 #include <osl/file.hxx>
 #include <osl/process.h>
@@ -36,12 +37,12 @@ using namespace ::com::sun::star;
 
 namespace
 {
-    class SotTest : public test::FiltersTest
+    class SotTest
+        : public test::FiltersTest
+        , public test::BootstrapFixtureBase
     {
     public:
-        SotTest() : FiltersTest(false, false) {}
-
-        virtual void setUp();
+        SotTest() {}
 
         virtual bool load(const rtl::OUString &,
             const rtl::OUString &rURL, const rtl::OUString &);
@@ -53,11 +54,6 @@ namespace
         CPPUNIT_TEST_SUITE_END();
     };
 
-    void SotTest::setUp()
-    {
-        test::FiltersTest::setUp();
-    }
-
     bool SotTest::load(const rtl::OUString &,
         const rtl::OUString &rURL, const rtl::OUString &)
     {
diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk
index 8f4cd6a..3ccbd5d 100644
--- a/svtools/CppunitTest_svtools_filters_test.mk
+++ b/svtools/CppunitTest_svtools_filters_test.mk
@@ -35,13 +35,14 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svtools_filters_test, \
 ))
 
 $(eval $(call gb_CppunitTest_add_linked_libs,svtools_filters_test, \
-	test \
 	comphelper \
 	cppu \
 	cppuhelper \
 	sal \
     svt \
+	test \
 	tl \
+	unotest \
 	vcl \
     $(gb_STDLIBS) \
 ))
diff --git a/svtools/qa/cppunit/filters-test.cxx b/svtools/qa/cppunit/filters-test.cxx
index a216bc6..a1c4a44 100644
--- a/svtools/qa/cppunit/filters-test.cxx
+++ b/svtools/qa/cppunit/filters-test.cxx
@@ -27,7 +27,8 @@
  * instead of those above.
  */
 
-#include <test/filters-test.hxx>
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
 
 #include <osl/file.hxx>
 #include <osl/process.h>
@@ -38,10 +39,12 @@ using namespace ::com::sun::star;
 
 /* Implementation of Filters test */
 
-class SvtoolsFiltersTest : public test::FiltersTest
+class SvtoolsFiltersTest
+    : public test::FiltersTest
+    , public test::BootstrapFixture
 {
 public:
-    SvtoolsFiltersTest() : FiltersTest(true, false) {}
+    SvtoolsFiltersTest() : BootstrapFixture(true, false) {}
 
     virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
 
diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk
index 720adae..7726115 100644
--- a/sw/CppunitTest_sw_filters_test.mk
+++ b/sw/CppunitTest_sw_filters_test.mk
@@ -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
 
 $(eval $(call gb_CppunitTest_add_linked_libs,sw_filters_test, \
-	test \
     sw \
     sfx \
     svl \
     svt \
-    vcl \
+	test \
     tl \
     ucbhelper \
+    unotest \
     utl \
+    vcl \
     i18nisolang1 \
     comphelper \
     cppu \
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 84bb4be..cd63ebe 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -27,7 +27,8 @@
  * instead of those above.
  */
 
-#include <test/filters-test.hxx>
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
 
 #include <sfx2/app.hxx>
 #include <sfx2/docfilt.hxx>
@@ -48,7 +49,9 @@ using namespace ::com::sun::star;
 
 /* Implementation of Filters test */
 
-class SwFiltersTest : public test::FiltersTest
+class SwFiltersTest
+    : public test::FiltersTest
+    , public test::BootstrapFixture
 {
 public:
     bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
@@ -92,7 +95,7 @@ void SwFiltersTest::testCVEs()
 
 void SwFiltersTest::setUp()
 {
-    test::FiltersTest::setUp();
+    test::BootstrapFixture::setUp();
 
     //This is a bit of a fudge, we do this to ensure that SwGlobals::ensure,
     //which is a private symbol to us, gets called
diff --git a/test/inc/test/bootstrapfixture.hxx b/test/inc/test/bootstrapfixture.hxx
index 3c7a91f..3b9a40f 100644
--- a/test/inc/test/bootstrapfixture.hxx
+++ b/test/inc/test/bootstrapfixture.hxx
@@ -40,6 +40,7 @@
 #include "cppunit/TestFixture.h"
 #include "cppunit/extensions/HelperMacros.h"
 #include "cppunit/plugin/TestPlugIn.h"
+#include "unotest/bootstrapfixturebase.hxx"
 #include "test/testdllapi.hxx"
 
 namespace test {
@@ -51,34 +52,15 @@ namespace test {
 
 // NB. this class is instantiated multiple times during a
 // run of unit tests ...
-class OOO_DLLPUBLIC_TEST BootstrapFixture : public CppUnit::TestFixture
+class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
 {
   bool m_bNeedUCB;
   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:
   BootstrapFixture( bool bAssertOnDialog = true, bool bNeedUCB = true );
   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 tearDown();
 };
diff --git a/test/inc/test/filters-test.hxx b/test/inc/test/filters-test.hxx
deleted file mode 100644
index 0cc77c0..0000000
--- a/test/inc/test/filters-test.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- 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. 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.
- *
- * The Initial Developer of the Original Code is
- *       Caolán McNamara <caolanm at redhat.com>
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Caolán McNamara <caolanm at redhat.com>
- *
- * 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 <rtl/ustring.hxx>
-#include <test/bootstrapfixture.hxx>
-#include "test/testdllapi.hxx"
-
-namespace test {
-
-enum filterStatus
-{
-    fail = 0,
-    pass = 1,
-    indeterminate = 2
-};
-
-/*
- * NOTE, any files beginning with CVE- will be assumed to be encrypted using
- * arcfour with key 0x435645, this is to silence panicky virus/malware-checkers
- *
- * e.g.  m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
- */
-/* Implementation of Filters test */
-class OOO_DLLPUBLIC_TEST FiltersTest : public test::BootstrapFixture
-{
-public:
-    FiltersTest(bool bAssertOnDialog = true, bool bNeedUCB = true)
-        : BootstrapFixture(bAssertOnDialog, bNeedUCB)
-    {}
-
-    void testDir(
-        //filter name
-        const rtl::OUString &rFilter,
-        //root dir of test files, must contain pass, fail, indeterminate
-        const rtl::OUString &rURL,
-        //additional filter data for SfxFilter
-        const rtl::OUString &rUserData);
-
-    virtual bool load(
-        const rtl::OUString &rFilter,
-        const rtl::OUString &rURL,
-        const rtl::OUString &rUserData) = 0;
-
-protected:
-    void recursiveScan(
-        const rtl::OUString &rFilter,
-        const rtl::OUString &rURL,
-        const rtl::OUString &rUserData,
-        filterStatus nExpected);
-};
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/prj/d.lst b/test/prj/d.lst
index 84491d1..9211e33 100644
--- a/test/prj/d.lst
+++ b/test/prj/d.lst
@@ -6,4 +6,3 @@ mkdir: %_DEST%\inc\test
 ..\%__SRC%\lib\libtest.dll.a %_DEST%\lib\libtest.dll.a
 ..\inc\test\testdllapi.hxx %_DEST%\inc\test\testdllapi.hxx
 ..\inc\test\bootstrapfixture.hxx %_DEST%\inc\test\bootstrapfixture.hxx
-..\inc\test\filters-test.hxx %_DEST%\inc\test\filters-test.hxx
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index 5f24697..dccd3a4 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -61,18 +61,7 @@ static void aBasicErrorFunc( const String &rErr, const String &rAction )
 test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB )
     : m_bNeedUCB( bNeedUCB )
     , 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
     const LanguageType eLang=LANGUAGE_ENGLISH_US;
 
@@ -84,20 +73,7 @@ test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB )
 
 void test::BootstrapFixture::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);
-
+    test::BootstrapFixtureBase::setUp();
     if (m_bNeedUCB)
     {
         // initialise UCB-Broker
@@ -128,16 +104,11 @@ void test::BootstrapFixture::setUp()
 void test::BootstrapFixture::tearDown()
 {
     ucbhelper::ContentBroker::get()->deinitialize();
-    //    uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
+    test::BootstrapFixtureBase::tearDown();
 }
 
 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: */
diff --git a/test/source/filters-test.cxx b/test/source/filters-test.cxx
deleted file mode 100644
index f36e014..0000000
--- a/test/source/filters-test.cxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- 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. 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.
- *
- * The Initial Developer of the Original Code is
- *       Caolán McNamara <caolanm at redhat.com>
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Caolán McNamara <caolanm at redhat.com>
- *
- * 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 <test/filters-test.hxx>
-#include <osl/file.hxx>
-#include <osl/thread.h>
-#include <rtl/cipher.h>
-
-using namespace ::com::sun::star;
-
-namespace test {
-
-void decode(const rtl::OUString& rIn, const rtl::OUString &rOut)
-{
-    rtlCipher cipher = rtl_cipher_create(rtl_Cipher_AlgorithmARCFOUR, rtl_Cipher_ModeStream);
-    CPPUNIT_ASSERT_MESSAGE("cipher creation failed", cipher != 0);
-
-    //mcrypt --bare -a arcfour -o hex -k 435645 -s 3
-    const sal_uInt8 aKey[3] = {'C', 'V', 'E'};
-
-    rtlCipherError result = rtl_cipher_init(cipher, rtl_Cipher_DirectionDecode, aKey, SAL_N_ELEMENTS(aKey), 0, 0);
-
-    CPPUNIT_ASSERT_MESSAGE("cipher init failed", result == rtl_Cipher_E_None);
-
-    osl::File aIn(rIn);
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.open(osl_File_OpenFlag_Read));
-
-    osl::File aOut(rOut);
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.open(osl_File_OpenFlag_Write));
-
-    sal_uInt8 in[8192];
-    sal_uInt8 out[8192];
-    sal_uInt64 nBytesRead, nBytesWritten;
-    while(1)
-    {
-        CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.read(in, sizeof(in), nBytesRead));
-        if (!nBytesRead)
-            break;
-        CPPUNIT_ASSERT(rtl_Cipher_E_None == rtl_cipher_decode(cipher, in, nBytesRead, out, sizeof(out)));
-        CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.write(out, nBytesRead, nBytesWritten));
-        CPPUNIT_ASSERT(nBytesRead == nBytesWritten);
-    }
-
-    rtl_cipher_destroy(cipher);
-}
-
-void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData,
-    filterStatus nExpected)
-{
-    osl::Directory aDir(rURL);
-
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open());
-    osl::DirectoryItem aItem;
-    osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
-    while (aDir.getNextItem(aItem) == osl::FileBase::E_None)
-    {
-        aItem.getFileStatus(aFileStatus);
-        rtl::OUString sURL = aFileStatus.getFileURL();
-        if (aFileStatus.getFileType() == osl::FileStatus::Directory)
-            recursiveScan(rFilter, sURL, rUserData, nExpected);
-        else
-        {
-            rtl::OUString sTmpFile;
-            bool bCVE = false;
-
-            sal_Int32 nLastSlash = sURL.lastIndexOf('/');
-
-            if ((nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()))
-            {
-                //ignore .files
-                if (sURL.getStr()[nLastSlash+1] == '.')
-                    continue;
-
-                if (sURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("CVE"), nLastSlash+1))
-                    bCVE = true;
-            }
-
-            rtl::OString aRes(rtl::OUStringToOString(sURL,
-                osl_getThreadTextEncoding()));
-
-            if (bCVE)
-            {
-                CPPUNIT_ASSERT(osl::FileBase::E_None == osl::FileBase::createTempFile(NULL, NULL, &sTmpFile));
-                decode(sURL, sTmpFile);
-                sURL = sTmpFile;
-            }
-
-            //output name early, so in the case of a hang, the name of
-            //the hanging input file is visible
-            fprintf(stderr, "%s,", aRes.getStr());
-            sal_uInt32 nStartTime = osl_getGlobalTimer();
-            bool bRes = load(rFilter, sURL, rUserData);
-            sal_uInt32 nEndTime = osl_getGlobalTimer();
-
-            if (bCVE)
-                CPPUNIT_ASSERT(osl::FileBase::E_None == osl::File::remove(sTmpFile));
-
-            fprintf(stderr, "%s,%"SAL_PRIuUINT32"\n",
-                bRes?"Pass":"Fail",nEndTime-nStartTime);
-            if (nExpected == test::indeterminate)
-                continue;
-            CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == (nExpected == test::pass));
-        }
-    }
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
-}
-
-void FiltersTest::testDir(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData)
-{
-    fprintf(stderr, "File tested,Test Result,Execution Time (ms)\n");
-    recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pass")),
-        rUserData, test::pass);
-    recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fail")),
-        rUserData, test::fail);
-    recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("indeterminate")),
-        rUserData, test::indeterminate);
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/source/makefile.mk b/test/source/makefile.mk
index 6f68b71..63109a8 100644
--- a/test/source/makefile.mk
+++ b/test/source/makefile.mk
@@ -38,8 +38,7 @@ CDEFS += -DOOO_DLLIMPLEMENTATION_TEST
 CFLAGSCXX += $(CPPUNIT_CFLAGS)
 
 SLOFILES = \
-    $(SLO)/bootstrapfixture.obj \
-    $(SLO)/filters-test.obj
+    $(SLO)/bootstrapfixture.obj
 
 .IF "$(CROSS_COMPILING)" == "YES"
 SHL1IMPLIB = $(SHL1TARGET)
diff --git a/unotest/inc/unotest/bootstrapfixturebase.hxx b/unotest/inc/unotest/bootstrapfixturebase.hxx
new file mode 100644
index 0000000..6edd3f5
--- /dev/null
+++ b/unotest/inc/unotest/bootstrapfixturebase.hxx
@@ -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 at 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: */
diff --git a/unotest/inc/unotest/filters-test.hxx b/unotest/inc/unotest/filters-test.hxx
new file mode 100644
index 0000000..974c1fa
--- /dev/null
+++ b/unotest/inc/unotest/filters-test.hxx
@@ -0,0 +1,75 @@
+/* -*- 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. 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.
+ *
+ * The Initial Developer of the Original Code is
+ *       Caolán McNamara <caolanm at redhat.com>
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Caolán McNamara <caolanm at redhat.com>
+ *
+ * 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 <rtl/ustring.hxx>
+#include "unotest/detail/unotestdllapi.hxx"
+
+namespace test {
+
+enum filterStatus
+{
+    fail = 0,
+    pass = 1,
+    indeterminate = 2
+};
+
+/*
+ * NOTE, any files beginning with CVE- will be assumed to be encrypted using
+ * arcfour with key 0x435645, this is to silence panicky virus/malware-checkers
+ *
+ * e.g.  m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
+ */
+/* Implementation of Filters test */
+class OOO_DLLPUBLIC_UNOTEST FiltersTest
+{
+public:
+    void testDir(
+        //filter name
+        const rtl::OUString &rFilter,
+        //root dir of test files, must contain pass, fail, indeterminate
+        const rtl::OUString &rURL,
+        //additional filter data for SfxFilter
+        const rtl::OUString &rUserData);
+
+    virtual bool load(
+        const rtl::OUString &rFilter,
+        const rtl::OUString &rURL,
+        const rtl::OUString &rUserData) = 0;
+
+protected:
+    void recursiveScan(
+        const rtl::OUString &rFilter,
+        const rtl::OUString &rURL,
+        const rtl::OUString &rUserData,
+        filterStatus nExpected);
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotest/prj/build.lst b/unotest/prj/build.lst
index d3be738..1cbe6e3 100644
--- a/unotest/prj/build.lst
+++ b/unotest/prj/build.lst
@@ -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\unoexceptionprotector nmake - all source_cpp_unoexceptionprotector NULL
 unote unotest\source\java\org\openoffice\test nmake - all source_java NULL
diff --git a/unotest/prj/d.lst b/unotest/prj/d.lst
index af2c362..a173c2f 100644
--- a/unotest/prj/d.lst
+++ b/unotest/prj/d.lst
@@ -9,6 +9,8 @@ mkdir: %_DEST%\inc\unotest\detail
 ..\%__SRC%\lib\unoexceptionprotector.dylib %_DEST%\lib\unoexceptionprotector.dylib
 ..\%__SRC%\lib\unoexceptionprotector.so %_DEST%\lib\unoexceptionprotector.so
 ..\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\officeconnection.hxx %_DEST%\inc\unotest\officeconnection.hxx
 ..\inc\unotest\oustringostreaminserter.hxx %_DEST%\inc\unotest\oustringostreaminserter.hxx
diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx
new file mode 100644
index 0000000..5748e33
--- /dev/null
+++ b/unotest/source/cpp/bootstrapfixturebase.cxx
@@ -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 at suse.com>
+ *   Caolán McNamara <caolanm at 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: */
diff --git a/unotest/source/cpp/filters-test.cxx b/unotest/source/cpp/filters-test.cxx
new file mode 100644
index 0000000..f3801da
--- /dev/null
+++ b/unotest/source/cpp/filters-test.cxx
@@ -0,0 +1,148 @@
+/* -*- 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. 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.
+ *
+ * The Initial Developer of the Original Code is
+ *       Caolán McNamara <caolanm at redhat.com>
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Caolán McNamara <caolanm at redhat.com>
+ *
+ * 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/filters-test.hxx>
+#include <osl/file.hxx>
+#include <osl/thread.h>
+#include <rtl/cipher.h>
+
+#include "sal/precppunit.hxx"
+#include "cppunit/TestAssert.h"
+
+namespace test {
+
+void decode(const rtl::OUString& rIn, const rtl::OUString &rOut)
+{
+    rtlCipher cipher = rtl_cipher_create(rtl_Cipher_AlgorithmARCFOUR, rtl_Cipher_ModeStream);
+    CPPUNIT_ASSERT_MESSAGE("cipher creation failed", cipher != 0);
+
+    //mcrypt --bare -a arcfour -o hex -k 435645 -s 3
+    const sal_uInt8 aKey[3] = {'C', 'V', 'E'};
+
+    rtlCipherError result = rtl_cipher_init(cipher, rtl_Cipher_DirectionDecode, aKey, SAL_N_ELEMENTS(aKey), 0, 0);
+
+    CPPUNIT_ASSERT_MESSAGE("cipher init failed", result == rtl_Cipher_E_None);
+
+    osl::File aIn(rIn);
+    CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.open(osl_File_OpenFlag_Read));
+
+    osl::File aOut(rOut);
+    CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.open(osl_File_OpenFlag_Write));
+
+    sal_uInt8 in[8192];
+    sal_uInt8 out[8192];
+    sal_uInt64 nBytesRead, nBytesWritten;
+    while(1)
+    {
+        CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.read(in, sizeof(in), nBytesRead));
+        if (!nBytesRead)
+            break;
+        CPPUNIT_ASSERT(rtl_Cipher_E_None == rtl_cipher_decode(cipher, in, nBytesRead, out, sizeof(out)));
+        CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.write(out, nBytesRead, nBytesWritten));
+        CPPUNIT_ASSERT(nBytesRead == nBytesWritten);
+    }
+
+    rtl_cipher_destroy(cipher);
+}
+
+void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData,
+    filterStatus nExpected)
+{
+    osl::Directory aDir(rURL);
+
+    CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open());
+    osl::DirectoryItem aItem;
+    osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
+    while (aDir.getNextItem(aItem) == osl::FileBase::E_None)
+    {
+        aItem.getFileStatus(aFileStatus);
+        rtl::OUString sURL = aFileStatus.getFileURL();
+        if (aFileStatus.getFileType() == osl::FileStatus::Directory)
+            recursiveScan(rFilter, sURL, rUserData, nExpected);
+        else
+        {
+            rtl::OUString sTmpFile;
+            bool bCVE = false;
+
+            sal_Int32 nLastSlash = sURL.lastIndexOf('/');
+
+            if ((nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()))
+            {
+                //ignore .files
+                if (sURL.getStr()[nLastSlash+1] == '.')
+                    continue;
+
+                if (sURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("CVE"), nLastSlash+1))
+                    bCVE = true;
+            }
+
+            rtl::OString aRes(rtl::OUStringToOString(sURL,
+                osl_getThreadTextEncoding()));
+
+            if (bCVE)
+            {
+                CPPUNIT_ASSERT(osl::FileBase::E_None == osl::FileBase::createTempFile(NULL, NULL, &sTmpFile));
+                decode(sURL, sTmpFile);
+                sURL = sTmpFile;
+            }
+
+            //output name early, so in the case of a hang, the name of
+            //the hanging input file is visible
+            fprintf(stderr, "%s,", aRes.getStr());
+            sal_uInt32 nStartTime = osl_getGlobalTimer();
+            bool bRes = load(rFilter, sURL, rUserData);
+            sal_uInt32 nEndTime = osl_getGlobalTimer();
+
+            if (bCVE)
+                CPPUNIT_ASSERT(osl::FileBase::E_None == osl::File::remove(sTmpFile));
+
+            fprintf(stderr, "%s,%"SAL_PRIuUINT32"\n",
+                bRes?"Pass":"Fail",nEndTime-nStartTime);
+            if (nExpected == test::indeterminate)
+                continue;
+            CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == (nExpected == test::pass));
+        }
+    }
+    CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
+}
+
+void FiltersTest::testDir(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData)
+{
+    fprintf(stderr, "File tested,Test Result,Execution Time (ms)\n");
+    recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pass")),
+        rUserData, test::pass);
+    recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fail")),
+        rUserData, test::fail);
+    recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("indeterminate")),
+        rUserData, test::indeterminate);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotest/source/cpp/makefile.mk b/unotest/source/cpp/makefile.mk
index b28b1ed..928a8b2 100644
--- a/unotest/source/cpp/makefile.mk
+++ b/unotest/source/cpp/makefile.mk
@@ -38,6 +38,8 @@ CDEFS += -DOOO_DLLIMPLEMENTATION_UNOTEST
 CFLAGSCXX += $(CPPUNIT_CFLAGS)
 
 SLOFILES = \
+    $(SLO)/bootstrapfixturebase.obj \
+    $(SLO)/filters-test.obj \
     $(SLO)/getargument.obj \
     $(SLO)/gettestargument.obj \
     $(SLO)/officeconnection.obj \
@@ -52,6 +54,7 @@ SHL1IMPLIB = i$(SHL1TARGET)
 SHL1OBJS = $(SLOFILES)
 SHL1RPATH = NONE
 SHL1STDLIBS = \
+    $(COMPHELPERLIB) \
     $(CPPUHELPERLIB) \
     $(CPPULIB) \
     $(CPPUNITLIB) \
diff --git a/writerfilter/CppunitTest_writerfilter_rtftok.mk b/writerfilter/CppunitTest_writerfilter_rtftok.mk
index a863994..a104cfe 100644
--- a/writerfilter/CppunitTest_writerfilter_rtftok.mk
+++ b/writerfilter/CppunitTest_writerfilter_rtftok.mk
@@ -35,12 +35,13 @@ $(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_rtftok, \
 ))
 
 $(eval $(call gb_CppunitTest_add_linked_libs,writerfilter_rtftok, \
-	test \
 	comphelper \
 	cppu \
 	cppuhelper \
 	sal \
+	test \
 	ucbhelper \
+	unotest \
 	vcl \
 	writerfilter \
 	$(gb_STDLIBS) \
diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
index 9a012d3..986c67f 100644
--- a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
+++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
@@ -26,7 +26,8 @@
  * 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 <osl/file.hxx>
@@ -34,7 +35,9 @@
 
 using namespace ::com::sun::star;
 
-class RtfTest : public test::FiltersTest
+class RtfTest
+    : public test::FiltersTest
+    , public test::BootstrapFixture
 {
 public:
 
@@ -52,7 +55,7 @@ private:
 
 void RtfTest::setUp()
 {
-    test::FiltersTest::setUp();
+    test::BootstrapFixture::setUp();
 
     m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance(
         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.RtfFilter"))),
commit 528a225ddb1d429eeb048626d5e9e045118bad2e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 12 14:57:11 2011 +0100

    get TestResult dtor before osl::Module dtor

diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index f80f450..c1b415e 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -172,9 +172,9 @@ SAL_IMPLEMENT_MAIN() {
 #endif
 #endif
 
-    CppUnit::TestResult result;
     boost::ptr_vector<osl::Module> modules;
     cppunittester::LibreOfficeProtector *throw_protector = 0;
+    CppUnit::TestResult result;
     std::string args;
     std::string testlib;
     sal_uInt32 index = 0;
commit a851938bfc4c8a12bbb25be3d14b7da835a49e6f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 11 23:53:58 2011 +0100

    Related: fdo#41642 add regression test

diff --git a/sot/CppunitTest_sot_test_sot.mk b/sot/CppunitTest_sot_test_sot.mk
new file mode 100644
index 0000000..d3ac12f
--- /dev/null
+++ b/sot/CppunitTest_sot_test_sot.mk
@@ -0,0 +1,72 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# 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.
+#
+# The Initial Developer of the Original Code is
+#       Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen at canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#       Caolán McNamara, Red Hat, Inc. <caolanm at redhat.com>
+#       David Tardon, Red Hat Inc. <dtardon at redhat.com>
+#
+# 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.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sot_test_sot))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sot_test_sot, \
+    sot/qa/cppunit/test_sot \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sot_test_sot, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    sot \
+    test \
+    tl \
+    vcl \
+    $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sot_test_sot,\
+    $$(INCLUDE) \
+    -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sot_test_sot,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sot_test_sot))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sot_test_sot,\
+    types \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sot_test_sot,\
+    --headless \
+    --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sot/Module_sot.mk b/sot/Module_sot.mk
index f71abc1..4ca4393 100644
--- a/sot/Module_sot.mk
+++ b/sot/Module_sot.mk
@@ -33,6 +33,10 @@ $(eval $(call gb_Module_add_targets,sot,\
     Library_sot \
 ))
 
+$(eval $(call gb_Module_add_check_targets,sot,\
+    CppunitTest_sot_test_sot \
+))
+
 $(eval $(call gb_Module_add_subsequentcheck_targets,sot,\
     JunitTest_sot_complex \
 ))
diff --git a/sot/prj/build.lst b/sot/prj/build.lst
index 63f7a94..302881c 100644
--- a/sot/prj/build.lst
+++ b/sot/prj/build.lst
@@ -1,2 +1,2 @@
-to	sot	:	tools ucbhelper unotools NULL
+to	sot	:	tools ucbhelper unotools test NULL
 to	sot\prj				    nmake	-	all	sot_prj NULL
diff --git a/sot/qa/cppunit/data/fail/.gitignore b/sot/qa/cppunit/data/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sot/qa/cppunit/data/indeterminate/.gitignore b/sot/qa/cppunit/data/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
new file mode 100644
index 0000000..39d86cb
--- /dev/null
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -0,0 +1,81 @@
+/* -*- 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. 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.
+ *
+ * The Initial Developer of the Original Code is
+ *        Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm at redhat.com>
+ *
+ * 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 <test/filters-test.hxx>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <sot/storage.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+    class SotTest : public test::FiltersTest
+    {
+    public:
+        SotTest() : FiltersTest(false, false) {}
+
+        virtual void setUp();
+
+        virtual bool load(const rtl::OUString &,
+            const rtl::OUString &rURL, const rtl::OUString &);
+
+        void test();
+
+        CPPUNIT_TEST_SUITE(SotTest);
+        CPPUNIT_TEST(test);
+        CPPUNIT_TEST_SUITE_END();
+    };
+
+    void SotTest::setUp()
+    {
+        test::FiltersTest::setUp();
+    }
+
+    bool SotTest::load(const rtl::OUString &,
+        const rtl::OUString &rURL, const rtl::OUString &)
+    {
+        SvFileStream aStream(rURL, STREAM_READ);
+        SotStorageRef xObjStor = new SotStorage(aStream);
+        return xObjStor.Is() && !xObjStor->GetError();
+    }
+
+    void SotTest::test()
+    {
+        testDir(rtl::OUString(),
+            getURLFromSrc("/sot/qa/cppunit/data/"),
+            rtl::OUString());
+    }
+
+    CPPUNIT_TEST_SUITE_REGISTRATION(SotTest);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 751b72050331c6b97c91bb1d4c69e05e3e32d998
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 11 23:08:03 2011 +0100

    Resolves: fdo#41642 detect loops in StgDirStrm entry chains

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index ad1e975..950d130 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -820,6 +820,14 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
 
         if( nLeaf != 0 && nLeft != 0 && nRight != 0 )
         {
+            //fdo#41642 Do we need to check full chain upwards for loops ?
+            if (pUpper && pUpper->aEntry.GetLeaf(STG_CHILD) == nLeaf)
+            {
+                OSL_FAIL("Leaf node of upper StgDirEntry is same as current StgDirEntry's leaf node. Circular entry chain, discarding link");
+                delete pCur;
+                return;
+            }
+
             if( StgAvlNode::Insert
                 ( (StgAvlNode**) ( pUpper ? &pUpper->pDown : &pRoot ), pCur ) )
             {
@@ -829,10 +837,10 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
             else
             {
                 // bnc#682484: There are some really broken docs out there
-        // that contain duplicate entries in 'Directory' section
-        // so don't set the error flag here and just skip those
-        // (was: rIo.SetError( SVSTREAM_CANNOT_MAKE );)
-                delete pCur; pCur = NULL;
+                // that contain duplicate entries in 'Directory' section
+                // so don't set the error flag here and just skip those
+                // (was: rIo.SetError( SVSTREAM_CANNOT_MAKE );)
+                delete pCur;
                 return;
             }
             SetupEntry( nLeft, pUpper );


More information about the Libreoffice-commits mailing list