diff options
author | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-10 14:48:53 +0200 |
---|---|---|
committer | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-15 13:42:17 +0200 |
commit | d2ab20971b8c0eb64676dd13216a89af0ca9e7d0 (patch) | |
tree | b70765ee57025d4b66ebb76d4cdf1ac2edb667d4 /sax | |
parent | d54174970b926a2ecfb2981447ee11e30fca581d (diff) |
'percent to string' test covered
Change-Id: I6966191a3adde0af318021ce8eec910763c42585
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
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); |