diff options
author | Radu Ioan <ioan.radu.g@gmail.com> | 2012-09-09 09:07:19 +0300 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-09-11 12:47:46 +0000 |
commit | 48c3b4e835bc413aa7f83eeab0b3183bf4f8dff6 (patch) | |
tree | b1d7462e0929c2735cb74e2c7141a228eba254ac /sal | |
parent | 1ebed7b6c9aad8148ba22072c17f1a3fd9a1f3fe (diff) |
fdo#39625 Make existing cppunittests work
Make sal_rtl_uri cppunittest work
- removed call to simpleheader.hxx
- added call in Module_sal.mk for sal_rtl_uri
- created mk for cppunittest for sal_rtl_uri
- removed duplicate include
- change from t_print to printf
Change-Id: I928ade62eb51ba1cb0a74e347411b344d57e97d0
Reviewed-on: https://gerrit.libreoffice.org/590
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Tested-by: Luboš Luňák <l.lunak@suse.cz>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/CppunitTest_sal_rtl_uri.mk | 28 | ||||
-rw-r--r-- | sal/Module_sal.mk | 1 | ||||
-rw-r--r-- | sal/qa/rtl/uri/rtl_Uri.cxx | 29 | ||||
-rw-r--r-- | sal/qa/rtl/uri/rtl_testuri.cxx | 12 |
4 files changed, 49 insertions, 21 deletions
diff --git a/sal/CppunitTest_sal_rtl_uri.mk b/sal/CppunitTest_sal_rtl_uri.mk new file mode 100644 index 000000000000..125265c74869 --- /dev/null +++ b/sal/CppunitTest_sal_rtl_uri.mk @@ -0,0 +1,28 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Major Contributor(s): +# Copyright (C) 2012 Radu Ioan <ioan.radu.g@gmail.com> (initial developer) +# +# All Rights Reserved. +# +# For minor contributions see the git repository. + +$(eval $(call gb_CppunitTest_CppunitTest,sal_rtl_uri)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sal_rtl_uri,\ + sal/qa/rtl/uri/rtl_Uri \ + sal/qa/rtl/uri/rtl_testuri \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sal_rtl_uri,\ + sal \ + $(gb_STDLIBS) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sal/Module_sal.mk b/sal/Module_sal.mk index ec6545dfd30e..a144b3c268dc 100644 --- a/sal/Module_sal.mk +++ b/sal/Module_sal.mk @@ -70,6 +70,7 @@ $(eval $(call gb_Module_add_check_targets,sal,\ CppunitTest_sal_rtl_ostringbuffer \ CppunitTest_sal_rtl_oustringbuffer \ CppunitTest_sal_rtl_strings \ + CppunitTest_sal_rtl_uri \ CppunitTest_sal_rtl_uuid \ CppunitTest_sal_tcwf \ CppunitTest_sal_types \ diff --git a/sal/qa/rtl/uri/rtl_Uri.cxx b/sal/qa/rtl/uri/rtl_Uri.cxx index 1799e6f3c79c..486974e75fc2 100644 --- a/sal/qa/rtl/uri/rtl_Uri.cxx +++ b/sal/qa/rtl/uri/rtl_Uri.cxx @@ -28,13 +28,14 @@ #include <stdlib.h> -#include <rtl/ustring.hxx> #include <rtl/strbuf.hxx> #include <rtl/uri.hxx> #include <osl/thread.h> #include <osl/file.hxx> -#include <testshl/simpleheader.hxx> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> // ----------------------------------------------------------------------------- @@ -82,7 +83,7 @@ namespace Stringtest rtl::OString toUTF8(rtl::OUString const& _suStr) { rtl::OString sStrAsUTF8 = rtl::OUStringToOString(_suStr, RTL_TEXTENCODING_UTF8); - t_print("%s\n", escapeString(sStrAsUTF8).getStr()); + printf("%s\n", escapeString(sStrAsUTF8).getStr()); return sStrAsUTF8; } */ @@ -100,7 +101,7 @@ namespace Stringtest void showContent(rtl::OUString const& _suStr) { rtl::OString sStr = convertToOString(_suStr); - t_print("%s\n", sStr.getStr()); + printf("%s\n", sStr.getStr()); } void toUTF8_mech(rtl::OUString const& _suStr, rtl_UriEncodeMechanism _eMechanism) @@ -126,15 +127,15 @@ namespace Stringtest void toUTF8(rtl::OUString const& _suStr) { - t_print("rtl_UriEncodeIgnoreEscapes \n"); + printf("rtl_UriEncodeIgnoreEscapes \n"); toUTF8_mech(_suStr, rtl_UriEncodeIgnoreEscapes); - t_print("\n"); - t_print("# rtl_UriEncodeKeepEscapes\n"); + printf("\n"); + printf("# rtl_UriEncodeKeepEscapes\n"); toUTF8_mech(_suStr, rtl_UriEncodeKeepEscapes); - t_print("\n"); - t_print("# rtl_UriEncodeCheckEscapes\n"); + printf("\n"); + printf("# rtl_UriEncodeCheckEscapes\n"); toUTF8_mech(_suStr, rtl_UriEncodeCheckEscapes); - t_print("\n"); + printf("\n"); } void test_FromUTF8_001() @@ -244,7 +245,7 @@ namespace Stringtest rtl::OUString suStrUTF8 = rtl::Uri::encode(suFilename, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8); rtl::OString sStrUTF8 = convertToOString(suStrUTF8); - t_print("Type: '%s' file name '%s'\n", sType.getStr(), sStrUTF8.getStr()); + printf("Type: '%s' file name '%s'\n", sType.getStr(), sStrUTF8.getStr()); } } aDir.close(); @@ -253,7 +254,7 @@ namespace Stringtest { rtl::OString sStr; sStr = rtl::OUStringToOString(suDirURL, osl_getThreadTextEncoding()); - t_print("can't open dir:'%s'\n", sStr.getStr()); + printf("can't open dir:'%s'\n", sStr.getStr()); } } @@ -289,10 +290,10 @@ namespace Stringtest } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( Stringtest::Convert, "Stringtest" ); +CPPUNIT_TEST_SUITE_REGISTRATION( Stringtest::Convert ); // LLA: doku anpassen!!! -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/rtl/uri/rtl_testuri.cxx b/sal/qa/rtl/uri/rtl_testuri.cxx index e86fe89600ac..93e864112a0b 100644 --- a/sal/qa/rtl/uri/rtl_testuri.cxx +++ b/sal/qa/rtl/uri/rtl_testuri.cxx @@ -28,14 +28,12 @@ #include "rtl/strbuf.hxx" -#include "rtl/textenc.h" -#include "rtl/uri.h" #include "rtl/uri.hxx" #include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "testshl/simpleheader.hxx" +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> #include <cstddef> #include <stdio.h> @@ -540,7 +538,7 @@ void Test::test_Uri() { } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "rtl_testuri"); -NOADDITIONAL; +CPPUNIT_TEST_SUITE_REGISTRATION(Test); +// NOADDITIONAL; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |