From ecb81153407d42da26c52529fd8bcb00abd03975 Mon Sep 17 00:00:00 2001 From: Artur Dorda Date: Fri, 10 Aug 2012 15:06:14 +0200 Subject: [PATCH] 'string to color' test covered Change-Id: I024296d1f71bd06837547cd8af3adc2cf2830b95 --- sax/qa/cppunit/test_converter.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 1bf1dd004709..c3cab68a32c8 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -438,6 +438,16 @@ void ConverterTest::testPercent() doTestPercentToString("1%", 00001); } +void doTestStringToColor(sal_Int32 nValue, char const*const pis) +{ + ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); + sal_Int32 nTemp; + bool bSuccess(Converter::convertColor(nTemp, is)); + OSL_TRACE("%i", nTemp); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT_EQUAL(nValue, nTemp); +} + void doTestColorToString(char const*const pis, sal_Int32 nValue) { ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); @@ -449,6 +459,10 @@ void doTestColorToString(char const*const pis, sal_Int32 nValue) void ConverterTest::testColor() { + doTestStringToColor(11259375, "#abcdef"); + doTestStringToColor(160, "#0000a0"); + doTestStringToColor(40960, "#00a000"); + doTestStringToColor(0, "#000000"); doTestColorToString("#000615", 1557); doTestColorToString("#5bcd15", 123456789); doTestColorToString("#fffac7", -1337);