diff options
author | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-10 14:57:44 +0200 |
---|---|---|
committer | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-15 13:42:17 +0200 |
commit | 1edec50b9daa18c1a4088ce94051c4b415cf8a1a (patch) | |
tree | 73754d09b653c2e83cecfecdba320f77f0e1daab /sax | |
parent | d2ab20971b8c0eb64676dd13216a89af0ca9e7d0 (diff) |
'color to string' test covered
Change-Id: Ia65d1bef19ec02efbb5d7dd784d4cc48c3dd51f2
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 1efbc94dec7e..1bf1dd004709 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -53,6 +53,7 @@ public: void testMeasure(); void testBool(); void testPercent(); + void testColor(); CPPUNIT_TEST_SUITE(ConverterTest); CPPUNIT_TEST(testDuration); @@ -61,6 +62,7 @@ public: CPPUNIT_TEST(testMeasure); CPPUNIT_TEST(testBool); CPPUNIT_TEST(testPercent); + CPPUNIT_TEST(testColor); CPPUNIT_TEST_SUITE_END(); private: @@ -435,6 +437,23 @@ void ConverterTest::testPercent() doTestPercentToString("0%", 0); doTestPercentToString("1%", 00001); } + +void doTestColorToString(char const*const pis, sal_Int32 nValue) +{ + ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); + ::rtl::OUStringBuffer buf; + Converter::convertColor(buf, nValue); + OSL_TRACE("%s", ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr()); + CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear()); +} + +void ConverterTest::testColor() +{ + doTestColorToString("#000615", 1557); + doTestColorToString("#5bcd15", 123456789); + doTestColorToString("#fffac7", -1337); + doTestColorToString("#000000", 0); +} CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest); } |