From d2ab20971b8c0eb64676dd13216a89af0ca9e7d0 Mon Sep 17 00:00:00 2001 From: Artur Dorda Date: Fri, 10 Aug 2012 14:48:53 +0200 Subject: [PATCH] 'percent to string' test covered Change-Id: I6966191a3adde0af318021ce8eec910763c42585 --- sax/qa/cppunit/test_converter.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 62e6d5d797d6..1efbc94dec7e 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -414,6 +414,15 @@ void doTestStringToPercent(sal_Int32 nValue, char const*const pis) CPPUNIT_ASSERT_EQUAL(nValue, nTemp); } +void doTestPercentToString(char const*const pis, sal_Int32 nValue) +{ + ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); + ::rtl::OUStringBuffer buf; + Converter::convertPercent(buf, nValue); + OSL_TRACE("%s", ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr()); + CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear()); +} + void ConverterTest::testPercent() { doTestStringToPercent(40, "40%"); @@ -421,6 +430,10 @@ void ConverterTest::testPercent() doTestStringToPercent(120, "120%"); doTestStringToPercent(-40, "-40%"); doTestStringToPercent(0, "0%"); + doTestPercentToString("12%", 12); + doTestPercentToString("-123%", -123); + doTestPercentToString("0%", 0); + doTestPercentToString("1%", 00001); } CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);