diff options
-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); } |