[Libreoffice-commits] .: sal/qa
David Tardon
dtardon at kemper.freedesktop.org
Mon Feb 7 01:17:16 PST 2011
sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx | 31 +++++++++++------------
1 file changed, 16 insertions(+), 15 deletions(-)
New commits:
commit 5f0c9a113b4b582ac236a0590fba044bba048907
Author: David Tardon <dtardon at redhat.com>
Date: Mon Feb 7 10:17:10 2011 +0100
use rtl::OStringBuffer for message
diff --git a/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx
index 0c94f4c..1c2e238 100644
--- a/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx
+++ b/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx
@@ -32,6 +32,7 @@
#include <cppunit/TestFixture.h>
#include <cppunit/TestAssert.h>
#include <cppunit/extensions/HelperMacros.h>
+#include "rtl/strbuf.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
@@ -56,33 +57,33 @@ CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::Utf32);
namespace {
-void appendString(rtl::OUStringBuffer & buffer, rtl::OUString const & string) {
- buffer.append(static_cast< sal_Unicode >('"'));
+void appendString(rtl::OStringBuffer & buffer, rtl::OUString const & string) {
+ buffer.append('"');
for (int i = 0; i < string.getLength(); ++i) {
- buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\\u"));
+ buffer.append(RTL_CONSTASCII_STRINGPARAM("\\u"));
sal_Unicode c = string[i];
if (c < 0x1000) {
- buffer.append(static_cast< sal_Unicode >('0'));
+ buffer.append('0');
if (c < 0x100) {
- buffer.append(static_cast< sal_Unicode >('0'));
+ buffer.append('0');
if (c < 0x10) {
- buffer.append(static_cast< sal_Unicode >('0'));
+ buffer.append('0');
}
}
}
buffer.append(
static_cast< sal_Int32 >(c), static_cast< sal_Int16 >(16));
}
- buffer.append(static_cast< sal_Unicode >('"'));
+ buffer.append('"');
}
void createMessage(
- rtl::OUStringBuffer & message, rtl::OUString const & string1,
+ rtl::OStringBuffer & message, rtl::OUString const & string1,
rtl::OUString const & string2)
{
message.setLength(0);
appendString(message, string1);
- message.appendAscii(RTL_CONSTASCII_STRINGPARAM(" vs. "));
+ message.append(RTL_CONSTASCII_STRINGPARAM(" vs. "));
appendString(message, string2);
}
@@ -95,19 +96,19 @@ void test::oustringbuffer::Utf32::appendUtf32() {
sal_Unicode const str2[str2Len] = { 'a', 'b', 'c', 'd' };
int const str3Len = 6;
sal_Unicode const str3[str3Len] = { 'a', 'b', 'c', 'd', 0xD800, 0xDC00 };
- rtl::OUStringBuffer message;
+ rtl::OStringBuffer message;
rtl::OUStringBuffer buf1(rtl::OUString(str1, str1Len));
buf1.appendUtf32('d');
rtl::OUString res1(buf1.makeStringAndClear());
createMessage(message, res1, rtl::OUString(str2, str2Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
+ message.getStr(), res1 == rtl::OUString(str2, str2Len));
rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
buf2.appendUtf32(0x10000);
rtl::OUString res2(buf2.makeStringAndClear());
createMessage(message, res2, rtl::OUString(str3, str3Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *)message.getStr(), res2 == rtl::OUString(str3, str3Len));
+ message.getStr(), res2 == rtl::OUString(str3, str3Len));
}
void test::oustringbuffer::Utf32::insertUtf32() {
@@ -117,19 +118,19 @@ void test::oustringbuffer::Utf32::insertUtf32() {
sal_Unicode const str2[str2Len] = { 'a', 'b', 'd', 'c' };
int const str3Len = 6;
sal_Unicode const str3[str3Len] = { 'a', 'b', 0xDBFF, 0xDFFF, 'd', 'c' };
- rtl::OUStringBuffer message;
+ rtl::OStringBuffer message;
rtl::OUStringBuffer buf1(rtl::OUString(str1, str1Len));
buf1.insertUtf32(2, 'd');
rtl::OUString res1(buf1.makeStringAndClear());
createMessage(message, res1, rtl::OUString(str2, str2Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
+ message.getStr(), res1 == rtl::OUString(str2, str2Len));
rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
buf2.insertUtf32(2, 0x10FFFF);
rtl::OUString res2(buf2.makeStringAndClear());
createMessage(message, res2, rtl::OUString(str3, str3Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res2 == rtl::OUString(str3, str3Len));
+ message.getStr(), res2 == rtl::OUString(str3, str3Len));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list