[Libreoffice-commits] .: 3 commits - cli_ure/source cppuhelper/test cppu/qa

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jan 14 07:40:03 PST 2011


 cli_ure/source/climaker/climaker_emit.cxx    |    2 +-
 cppu/qa/makefile.mk                          |   23 ++++++++++++-----------
 cppu/qa/test_any.cxx                         |   13 ++++++++++---
 cppu/qa/test_recursion.cxx                   |   13 ++++++++++---
 cppu/qa/test_reference.cxx                   |   13 ++++++++++---
 cppu/qa/test_unotype.cxx                     |   13 ++++++++++---
 cppu/qa/version.map                          |    2 +-
 cppuhelper/test/cfg_test.cxx                 |    4 ++--
 cppuhelper/test/makefile.mk                  |   14 +++++++-------
 cppuhelper/test/testdefaultbootstrapping.cxx |    1 +
 cppuhelper/test/testpropshlp.cxx             |   16 ++++++++--------
 11 files changed, 72 insertions(+), 42 deletions(-)

New commits:
commit da953ad45c52e7307e8db9866a221e9a2a27a7b1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 14 15:36:53 2011 +0000

    cppunit: port these tests over to canonical cppunit

diff --git a/cppu/qa/makefile.mk b/cppu/qa/makefile.mk
index b40d351..f1b3066 100644
--- a/cppu/qa/makefile.mk
+++ b/cppu/qa/makefile.mk
@@ -33,11 +33,18 @@ ENABLE_EXCEPTIONS := TRUE
 
 .INCLUDE: settings.mk
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
+#building with stlport, but cppunit was not built with stlport
+.IF "$(USE_SYSTEM_STL)"!="YES"
+.IF "$(SYSTEM_CPPUNIT)"=="YES"
+CFLAGSCXX+=-DADAPT_EXT_STL
+.ENDIF
+.ENDIF
 
-DLLPRE = # no leading "lib" on .so files
+CFLAGSCXX+=$(CPPUNIT_CFLAGS)
 
-INCPRE += $(MISC)$/$(TARGET)$/inc
+DLLPRE=# no leading "lib" on .so files
+
+INCPRE+=$(MISC)$/$(TARGET)$/inc
 
 SHL1TARGET = $(TARGET)_any
 SHL1OBJS = $(SLO)$/test_any.obj
@@ -71,8 +78,6 @@ SLOFILES = $(SHL1OBJS) $(SHL2OBJS) $(SHL3OBJS) $(SHL4OBJS)
 
 .INCLUDE: target.mk
 
-ALLTAR: test
-
 $(SHL1OBJS): $(MISC)$/$(TARGET).cppumaker.flag
 
 $(MISC)$/$(TARGET).cppumaker.flag: $(MISC)$/$(TARGET).rdb
@@ -82,15 +87,11 @@ $(MISC)$/$(TARGET).cppumaker.flag: $(MISC)$/$(TARGET).rdb
     $(TOUCH) $@
 
 $(MISC)$/$(TARGET).rdb: $(MISC)$/$(TARGET)$/types.urd
-    - rm $@
+    - $(RM) $@
     $(REGMERGE) $@ /UCR $<
 
 $(MISC)$/$(TARGET)$/types.urd: types.idl
     - $(MKDIR) $(MISC)$/$(TARGET)
     $(IDLC) -O$(MISC)$/$(TARGET) -I$(SOLARIDLDIR) -cid -we $<
 
-test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN) $(SHL4TARGETN)
-    $(TESTSHL2) $(SHL1TARGETN)
-    $(TESTSHL2) $(SHL2TARGETN)
-    $(TESTSHL2) $(SHL3TARGETN)
-    $(TESTSHL2) $(SHL4TARGETN)
+.INCLUDE : _cppunit.mk
diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx
index 7f44006..3d62d89 100644
--- a/cppu/qa/test_any.cxx
+++ b/cppu/qa/test_any.cxx
@@ -33,6 +33,14 @@
 
 #include <stdlib.h> // wntmsci10 does not like <cstdlib>
 
+#include "preextstl.h"
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "postextstl.h"
+
 #include "Enum1.hpp"
 #include "Enum2.hpp"
 #include "Exception1.hpp"
@@ -56,7 +64,6 @@
 #include "com/sun/star/uno/Sequence.hxx"
 #include "com/sun/star/uno/Type.hxx"
 #include "com/sun/star/uno/XInterface.hpp"
-#include "testshl/simpleheader.hxx"
 #include "osl/diagnose.h"
 #include "osl/interlck.h"
 #include "rtl/string.h"
@@ -2324,10 +2331,10 @@ void Test::testNull() {
     }
 }
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
 
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_recursion.cxx b/cppu/qa/test_recursion.cxx
index b5e12ca..84a1ed2 100644
--- a/cppu/qa/test_recursion.cxx
+++ b/cppu/qa/test_recursion.cxx
@@ -29,7 +29,14 @@
 #include "precompiled_cppu.hxx"
 #include "sal/config.h"
 
-#include "testshl/simpleheader.hxx"
+#include "preextstl.h"
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "postextstl.h"
+
 #include "sal/types.h"
 
 #include "Rec.hpp"
@@ -51,10 +58,10 @@ void Test::testRecursion() {
     CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), Rec().x.getLength());
 }
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "tests");
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
 
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_reference.cxx b/cppu/qa/test_reference.cxx
index b4ef870..b299865 100644
--- a/cppu/qa/test_reference.cxx
+++ b/cppu/qa/test_reference.cxx
@@ -31,9 +31,16 @@
 
 #include "sal/config.h"
 
+#include "preextstl.h"
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "postextstl.h"
+
 #include "Interface1.hpp"
 
-#include "testshl/simpleheader.hxx"
 #include "rtl/ustring.hxx"
 #include "sal/types.h"
 
@@ -150,10 +157,10 @@ void Test::testUnoSetThrow()
     CPPUNIT_ASSERT_EQUAL( false, bCaughtException );
 }
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }   // namespace
 
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx
index d6fe948..218f22b 100644
--- a/cppu/qa/test_unotype.cxx
+++ b/cppu/qa/test_unotype.cxx
@@ -31,6 +31,14 @@
 
 #include "sal/config.h"
 
+#include "preextstl.h"
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "postextstl.h"
+
 #include <typeinfo>
 
 #include "com/sun/star/beans/Optional.hpp"
@@ -45,7 +53,6 @@
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/uno/XInterface.hpp"
 #include "cppu/unotype.hxx"
-#include "testshl/simpleheader.hxx"
 #include "rtl/ustring.h"
 #include "rtl/ustring.hxx"
 #include "sal/types.h"
@@ -806,10 +813,10 @@ void Test::testGetTypeFavourChar() {
 #endif
 }
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
 
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/version.map b/cppu/qa/version.map
index f313c44..0dbbcc5 100644
--- a/cppu/qa/version.map
+++ b/cppu/qa/version.map
@@ -27,7 +27,7 @@
 
 UDK_3_0_0 {
     global:
-        registerAllTestFunction;
+        cppunitTestPlugIn;
 
     local:
         *;
commit e5dd50766006e3baa32eed1efa7dec49016767ab
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 14 15:15:22 2011 +0000

    get this to build again

diff --git a/cppuhelper/test/cfg_test.cxx b/cppuhelper/test/cfg_test.cxx
index 5334581..e1073d1 100644
--- a/cppuhelper/test/cfg_test.cxx
+++ b/cppuhelper/test/cfg_test.cxx
@@ -263,7 +263,7 @@ SAL_IMPLEMENT_MAIN()
         // show what is in context
         xContext->getValueByName( OUSTR("dump_maps") );
         
-        sal_Int32 n;
+        sal_Int32 n(0);
         OSL_VERIFY( xContext->getValueByName( OUSTR("/global-context-properties/TestValue") ) >>= n );
         ::fprintf( stderr, "> n=%d\n", n );
         
@@ -272,7 +272,7 @@ SAL_IMPLEMENT_MAIN()
         OSL_VERIFY( xContext->getValueByName( OUSTR("/singletons/com.sun.star.script.theConverter") ) >>= x );
         OSL_VERIFY( xContext->getValueByName( OUSTR("/singletons/com.sun.star.bootstrap.theTestComponent0") ) >>= x );
         
-        ::fprintf( stderr, "> registering service...\n", n );
+        ::fprintf( stderr, "> registering service...\n");
 #if defined(SAL_W32) || defined(SAL_OS2)
         OUString libName( OUSTR("cfg_test.dll") );
 #elif defined(SAL_UNX)
diff --git a/cppuhelper/test/makefile.mk b/cppuhelper/test/makefile.mk
index 26e1cb3..2746b3f 100644
--- a/cppuhelper/test/makefile.mk
+++ b/cppuhelper/test/makefile.mk
@@ -141,15 +141,15 @@ $(UNO_OUT)$/%$(EXT_SO): $(UNO_PATH)$/%$(EXT_SO)
     $(COPY) $^ $@
 
 $(BIN)$/cpputest.rdb: $(ALLIDLFILES) $(UNO_OUT)$/invocadapt.uno$(EXT_SO) $(UNO_OUT)$/bootstrap.uno$(EXT_SO)
-    idlc -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $(ALLIDLFILES)
-    regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
-    regmerge $@ / $(UNOUCRRDB)
-    regcomp -register -r $@ -c reflection.uno$(DLLPOST)
-    touch $@
+    $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $(ALLIDLFILES)
+    $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+    $(REGMERGE) $@ / $(UNOUCRRDB)
+    $(REGCOMP) -register -r $@ -c reflection.uno$(DLLPOST)
+    $(TOUCH) $@
 
 unoheader: $(BIN)$/cpputest.rdb
-    cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TYPES);$(HELPERTYPES)" $(BIN)$/cpputest.rdb
-    cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(FACTORYTYPES)" $(BIN)$/cpputest.rdb
+    $(CPPUMAKER) $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TYPES);$(HELPERTYPES)" $(BIN)$/cpputest.rdb
+    $(CPPUMAKER) $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(FACTORYTYPES)" $(BIN)$/cpputest.rdb
 
 
 $(BIN)$/testdefaultbootstrapping.pl: testdefaultbootstrapping.pl
diff --git a/cppuhelper/test/testdefaultbootstrapping.cxx b/cppuhelper/test/testdefaultbootstrapping.cxx
index 52f1c96..399bbc3 100644
--- a/cppuhelper/test/testdefaultbootstrapping.cxx
+++ b/cppuhelper/test/testdefaultbootstrapping.cxx
@@ -39,6 +39,7 @@
 #include <cppuhelper/bootstrap.hxx>
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 using namespace ::cppu;
 using namespace ::com::sun::star::lang;
diff --git a/cppuhelper/test/testpropshlp.cxx b/cppuhelper/test/testpropshlp.cxx
index 8628567..d9f29ed 100644
--- a/cppuhelper/test/testpropshlp.cxx
+++ b/cppuhelper/test/testpropshlp.cxx
@@ -495,7 +495,7 @@ public:
                 OSL_ENSURE( pExceptedListenerValues[nCurrent].getValueType().getTypeClass() == TypeClass_SHORT ,
                             "PropertySetHelper: wrong data type" );
                 
-                sal_Int16 nInt16, nOldInt16;
+                sal_Int16 nInt16(0), nOldInt16(0);
                 pExceptedListenerValues[nCurrent] 	>>= nInt16;
                 evt.OldValue 						>>= nOldInt16;
                 OSL_ENSURE( nInt16 == nOldInt16, "PropertySetHelper: wrong old value" );
@@ -511,7 +511,7 @@ public:
                 {
                     OSL_ENSURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), "PropertySetHelper: wrong name" );
     
-                    sal_Int32 nInt32,nOldInt32; 
+                    sal_Int32 nInt32(0),nOldInt32(0);
                     
                     pExceptedListenerValues[nCurrent] >>= nInt32;
                     evt.OldValue >>= nOldInt32;
@@ -550,7 +550,7 @@ public:
                 {
                     OSL_ENSURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), "PropertySetHelper: wrong name" );
     
-                    sal_Int16 nInt16, nOldInt16;
+                    sal_Int16 nInt16(0), nOldInt16(0);
                     pExceptedListenerValues[nCurrent] 	>>= nInt16;
                     evt.OldValue 						>>= nOldInt16;
     
@@ -572,7 +572,7 @@ public:
                 {
                     OSL_ENSURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), "PropertySetHelper: wrong name" );
                     
-                    sal_Int32 nInt32,nOldInt32; 
+                    sal_Int32 nInt32(0),nOldInt32(0);
                     pExceptedListenerValues[nCurrent] >>= nInt32;
                     evt.OldValue >>= nOldInt32;
                     OSL_ENSURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong old value" );
@@ -613,7 +613,7 @@ public:
                     {
                     OSL_ENSURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), "PropertySetHelper: wrong name" );
 
-                    sal_Int16 nInt16, nOldInt16;
+                    sal_Int16 nInt16(0), nOldInt16(0);
                     pExceptedListenerValues[nCurrent] 	>>= nInt16;
                     evt.OldValue 						>>= nOldInt16;
                     OSL_ENSURE( nInt16 == nOldInt16 , "PropertySetHelper: wrong old value" );
@@ -630,7 +630,7 @@ public:
                     OSL_ENSURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), "PropertySetHelper: wrong name" );
 
                     
-                    sal_Int32 nInt32,nOldInt32; 
+                    sal_Int32 nInt32(0),nOldInt32(0);
                     pExceptedListenerValues[nCurrent] >>= nInt32;
                     evt.OldValue >>= nOldInt32;
                     OSL_ENSURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong old value" );
@@ -1011,7 +1011,7 @@ void test_PropertySetHelper()
             b = *((sal_Bool*)aValue.getValue());
             OSL_ENSURE( !b, "PropertySetHelper: wrong BOOL value" );
         
-            sal_Int16 n16;
+            sal_Int16 n16(0);
             aValue <<=(sal_Int16)22;
             xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), aValue );
             aValue = xPS->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ) );
@@ -1028,7 +1028,7 @@ void test_PropertySetHelper()
             aValue <<= (sal_Int16)55;
             xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), aValue );
             aValue = xPS->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ) );
-            sal_Int32 n32;
+            sal_Int32 n32(0);
             aValue >>= n32;
             OSL_ENSURE( 55 == n32 , "PropertySetHelper: wrong INT32 value" );
             aValue <<= (sal_Int16)66;
commit cbd00a865a2a59d488f243444a72892b2acca5fa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 14 15:05:19 2011 +0000

    cppcheck: prefer prefix variant

diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx
index 49343d7..ffc63a0 100644
--- a/cli_ure/source/climaker/climaker_emit.cxx
+++ b/cli_ure/source/climaker/climaker_emit.cxx
@@ -765,7 +765,7 @@ Assembly * TypeEmitter::type_resolve(
 
             typedef std::vector<Reference<reflection::XInterfaceTypeDescription2> >::const_iterator it;
             int index = 0;
-            for (it i = vecBaseTypes.begin(); i != vecBaseTypes.end(); i++, index++)
+            for (it i = vecBaseTypes.begin(); i != vecBaseTypes.end(); ++i, ++index)
                 base_interfaces[ index ] = get_type( *i );
             type_builder = m_module_builder->DefineType(
                 cts_name, attr, 0, base_interfaces );


More information about the Libreoffice-commits mailing list