Find attached changes to lib-gui/comphelper to get some tests working again. These patches are LGPLv3+/MPL.
This is my first contribution in this project - so don't hesitate with critics if its not the common procedure.
>From c1ae4fedb99ffa883f2aeac5fc0d26b9a496ec75 Mon Sep 17 00:00:00 2001 From: Wilhelm Pflueger <wilhelm.pflue...@web.de> Date: Sat, 5 Feb 2011 22:56:20 +0100 Subject: [PATCH 1/2] Re-animated tests that were based on deprecated testshl. --- comphelper/prj/build.lst | 1 + comphelper/qa/makefile.mk | 10 +++------- comphelper/qa/test_string.cxx | 22 ++++++++++++---------- comphelper/qa/test_weakbag.cxx | 10 ++++++---- comphelper/qa/version.map | 3 +-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/comphelper/prj/build.lst b/comphelper/prj/build.lst index a38f999..d5eced0 100644 --- a/comphelper/prj/build.lst +++ b/comphelper/prj/build.lst @@ -11,3 +11,4 @@ ph comphelper\source\compare nmake - all ph_compare ph_inc NULL ph comphelper\source\officeinstdir nmake - all ph_officeinstdir ph_inc NULL ph comphelper\source\xml nmake - all ph_xml NULL ph comphelper\util nmake - all ph_util ph_container ph_evtatmgr ph_misc ph_procfact ph_property ph_streaming ph_compare ph_officeinstdir ph_xml NULL +ph comphelper\qa nmake - all ph_complex NULL \ No newline at end of file diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/makefile.mk index 0360d30..9d68caa 100644 --- a/comphelper/qa/makefile.mk +++ b/comphelper/qa/makefile.mk @@ -40,8 +40,8 @@ DLLPRE = # no leading "lib" on .so files INCPRE += $(MISC)$/$(TARGET)$/inc SHL1TARGET = $(TARGET)_weakbag -SHL1OBJS = $(SLO)$/test_weakbag.obj -SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(TESTSHL2LIB) $(SALLIB) +SHL1OBJS = $(SLO)$/test_weakbag.obj $(SLO)$/test_string.obj +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(TESTSHL2LIB) $(SALLIB) $(COMPHELPERLIB) SHL1VERSIONMAP = version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) @@ -49,8 +49,4 @@ DEF1NAME = $(SHL1TARGET) SLOFILES = $(SHL1OBJS) .INCLUDE: target.mk - -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - $(TESTSHL2) $(SHL1TARGETN) +.INCLUDE: _cppunit.mk diff --git a/comphelper/qa/test_string.cxx b/comphelper/qa/test_string.cxx index 7b997e6..3a631d9 100644 --- a/comphelper/qa/test_string.cxx +++ b/comphelper/qa/test_string.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -30,7 +30,9 @@ #include "sal/config.h" #include "comphelper/string.hxx" -#include "testshl/simpleheader.hxx" +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> #include "rtl/string.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -38,20 +40,20 @@ namespace { -class Test: public CppUnit::TestFixture { +class TestString: public CppUnit::TestFixture { public: void test(); - CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST_SUITE(TestString); CPPUNIT_TEST(test); CPPUNIT_TEST_SUITE_END(); }; -void Test::test() { +void TestString::test() { rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("foobarbar")); sal_Int32 n1; rtl::OUString s2( - comphelper::string::searchAndReplace( + comphelper::string::searchAndReplaceAsciiL( s1, RTL_CONSTASCII_STRINGPARAM("bar"), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baaz")), 0, &n1)); CPPUNIT_ASSERT( @@ -59,7 +61,7 @@ void Test::test() { CPPUNIT_ASSERT(n1 == 3); sal_Int32 n2; rtl::OUString s3( - comphelper::string::searchAndReplace( + comphelper::string::searchAndReplaceAsciiL( s2, RTL_CONSTASCII_STRINGPARAM("bar"), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bz")), n1 + RTL_CONSTASCII_LENGTH("baaz"), &n2)); @@ -68,7 +70,7 @@ void Test::test() { CPPUNIT_ASSERT(n2 == 7); sal_Int32 n3; rtl::OUString s4( - comphelper::string::searchAndReplace( + comphelper::string::searchAndReplaceAsciiL( s3, RTL_CONSTASCII_STRINGPARAM("bar"), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baz")), n2 + RTL_CONSTASCII_LENGTH("bz"), &n3)); @@ -76,10 +78,10 @@ void Test::test() { CPPUNIT_ASSERT(n3 == -1); } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(TestString); } -NOADDITIONAL; +//NOADDITIONAL; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/qa/test_weakbag.cxx b/comphelper/qa/test_weakbag.cxx index acb6e56..774260e 100644 --- a/comphelper/qa/test_weakbag.cxx +++ b/comphelper/qa/test_weakbag.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,7 +33,9 @@ #include "com/sun/star/uno/XInterface.hpp" #include "comphelper/weakbag.hxx" #include "cppuhelper/weak.hxx" -#include "testshl/simpleheader.hxx" +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> namespace { @@ -64,10 +66,10 @@ public: CPPUNIT_TEST_SUITE_END(); }; -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/comphelper/qa/version.map b/comphelper/qa/version.map index f313c44..65c1057 100644 --- a/comphelper/qa/version.map +++ b/comphelper/qa/version.map @@ -27,8 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; - + cppunitTestPlugIn; local: *; }; -- 1.7.0.4
>From f1e8215386f96f0de28d5178c8829bcb0d871128 Mon Sep 17 00:00:00 2001 From: Wilhelm Pflueger <wilhelm.pflue...@web.de> Date: Sat, 5 Feb 2011 23:02:36 +0100 Subject: [PATCH 2/2] Removed odd line. --- comphelper/qa/test_string.cxx | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/comphelper/qa/test_string.cxx b/comphelper/qa/test_string.cxx index 3a631d9..c525d31 100644 --- a/comphelper/qa/test_string.cxx +++ b/comphelper/qa/test_string.cxx @@ -82,6 +82,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(TestString); } -//NOADDITIONAL; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- 1.7.0.4
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice