diff options
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/rtl/oustringbuffer/makefile.mk | 49 | ||||
-rw-r--r-- | sal/qa/rtl/oustringbuffer/rtl_OUStringBuffer2.cxx | 103 | ||||
-rw-r--r-- | sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx | 36 | ||||
-rw-r--r-- | sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx | 64 | ||||
-rw-r--r-- | sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx (renamed from sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx) | 0 | ||||
-rw-r--r-- | sal/qa/rtl/strings/makefile.mk | 1 |
6 files changed, 117 insertions, 136 deletions
diff --git a/sal/qa/rtl/oustringbuffer/makefile.mk b/sal/qa/rtl/oustringbuffer/makefile.mk index 544f7b7df..9165daa11 100644 --- a/sal/qa/rtl/oustringbuffer/makefile.mk +++ b/sal/qa/rtl/oustringbuffer/makefile.mk @@ -25,46 +25,31 @@ # #************************************************************************* -PRJ=..$/..$/.. -INCPRE+= $(PRJ)$/qa$/inc +PRJ := ..$/..$/.. +PRJNAME := sal -PRJNAME=sal -TARGET=rtl_oustringbuffer2 +TARGET := qa_rtl_oustringbuffer -ENABLE_EXCEPTIONS=TRUE +ENABLE_EXCEPTIONS := TRUE -# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk -.INCLUDE : settings.mk CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) CFLAGSCXX += $(CPPUNIT_CFLAGS) -# BEGIN ---------------------------------------------------------------- -# auto generated Target:joblist by codegen.pl -SHL1OBJS= \ - $(SLO)$/rtl_OUStringBuffer2.obj - -SHL1TARGET= rtl_OUStringBuffer2 -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) - -SHL1IMPLIB= i$(SHL1TARGET) -# SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME =$(SHL1TARGET) -# DEF1EXPORTFILE= export.exp -SHL1VERSIONMAP= $(PRJ)$/qa$/export.map -# auto generated Target:joblist -# END ------------------------------------------------------------------ - -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -# SLOFILES=$(SHL1OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk +SHL1TARGET := $(TARGET) +SHL1OBJS := \ + $(SLO)$/test_oustringbuffer_utf32.obj \ + $(SLO)$/test_oustringbuffer_tostring.obj \ + $(SLO)$/test_oustringbuffer_noadditional.obj +SHL1IMPLIB := i$(SHL1TARGET) +SHL1STDLIBS := $(SALLIB) $(CPPUNITLIB) +SHL1VERSIONMAP := $(PRJ)$/qa$/export.map +DEF1NAME := $(SHL1TARGET) + +.INCLUDE: target.mk +.INCLUDE: $(PRJ)$/qa$/cppunit_local.mk diff --git a/sal/qa/rtl/oustringbuffer/rtl_OUStringBuffer2.cxx b/sal/qa/rtl/oustringbuffer/rtl_OUStringBuffer2.cxx deleted file mode 100644 index 119985aec..000000000 --- a/sal/qa/rtl/oustringbuffer/rtl_OUStringBuffer2.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sal.hxx" -#include <testshl/simpleheader.hxx> -#include "stringhelper.hxx" -#include <rtl/ustrbuf.hxx> -#include <rtl/uri.hxx> - -namespace rtl_OUStringBuffer -{ - - -class insertUtf32 : public CppUnit::TestFixture -{ -public: - // initialise your test code values here. - void setUp() - { - } - - void tearDown() - { - } - - void insertUtf32_001() - { - ::rtl::OUStringBuffer aUStrBuf(4); - aUStrBuf.insertUtf32(0,0x10ffff); - - rtl::OUString suStr = aUStrBuf.makeStringAndClear(); - rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8); - - rtl::OString sStr; - sStr <<= suStr2; - t_print("%s\n", sStr.getStr()); - - CPPUNIT_ASSERT_MESSAGE("Strings must be '%F4%8F%BF%BF'", sStr.equals(rtl::OString("%F4%8F%BF%BF")) == sal_True); - } - - void insertUtf32_002() - { - ::rtl::OUStringBuffer aUStrBuf(4); - aUStrBuf.insertUtf32(0,0x41); - aUStrBuf.insertUtf32(1,0x42); - aUStrBuf.insertUtf32(2,0x43); - - rtl::OUString suStr = aUStrBuf.makeStringAndClear(); - rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8); - - rtl::OString sStr; - sStr <<= suStr2; - t_print("%s\n", sStr.getStr()); - - CPPUNIT_ASSERT_MESSAGE("Strings must be 'ABC'", sStr.equals(rtl::OString("ABC")) == sal_True); - } - - CPPUNIT_TEST_SUITE(insertUtf32); - CPPUNIT_TEST(insertUtf32_001); - CPPUNIT_TEST(insertUtf32_002); - CPPUNIT_TEST_SUITE_END(); -}; // class getToken - -// ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUStringBuffer::insertUtf32, "rtl_OUStringBuffer"); - -} // namespace rtl_OUStringBuffer - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx new file mode 100644 index 000000000..18e8a6344 --- /dev/null +++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sal.hxx" + +#include <cppunit/plugin/TestPlugIn.h> + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx new file mode 100644 index 000000000..31aecac81 --- /dev/null +++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sal.hxx" + +#include <cppunit/TestFixture.h> +#include <cppunit/TestAssert.h> +#include <cppunit/extensions/HelperMacros.h> +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.hxx" + +namespace test { namespace oustringbuffer { + +class ToString: public CppUnit::TestFixture { +private: + void testToString(); + + CPPUNIT_TEST_SUITE(ToString); + CPPUNIT_TEST(testToString); + CPPUNIT_TEST_SUITE_END(); +}; + +} } + +CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::ToString); + +void test::oustringbuffer::ToString::testToString() { + rtl::OUStringBuffer sb(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test string"))); + rtl::OUString str = sb.toString(); + CPPUNIT_ASSERT(str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test string"))); + // returned OUString must be independent from sb + sb.append('a'); + CPPUNIT_ASSERT(str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test string"))); + sb.setLength(0); + CPPUNIT_ASSERT(str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test string"))); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx index a7609c5d4..a7609c5d4 100644 --- a/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx +++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx diff --git a/sal/qa/rtl/strings/makefile.mk b/sal/qa/rtl/strings/makefile.mk index d167c470d..2b07539e8 100644 --- a/sal/qa/rtl/strings/makefile.mk +++ b/sal/qa/rtl/strings/makefile.mk @@ -42,7 +42,6 @@ CFLAGSCXX += $(CPPUNIT_CFLAGS) SHL1TARGET := $(TARGET) SHL1OBJS := \ - $(SLO)$/test_oustringbuffer_utf32.obj \ $(SLO)$/test_oustring_compare.obj \ $(SLO)$/test_oustring_convert.obj \ $(SLO)$/test_oustring_endswith.obj \ |