summaryrefslogtreecommitdiff
path: root/sax/qa/cppunit/test_converter.cxx
diff options
context:
space:
mode:
authorArtur Dorda <artur.dorda+libo@gmail.com>2012-08-09 13:12:44 +0200
committerArtur Dorda <artur.dorda+libo@gmail.com>2012-08-15 13:42:15 +0200
commit72001879877f85e27982b9c17d7346bbcfe0e033 (patch)
tree9321315b22eeb59b16622931a120dc3bcfecc7f6 /sax/qa/cppunit/test_converter.cxx
parent978c6b87a35c6ca0d7c2396ba389958cfdf550e3 (diff)
Added testing 'measure to string' function
Change-Id: I36de98025ec72230cd960191ab47ab39ce965cc5
Diffstat (limited to 'sax/qa/cppunit/test_converter.cxx')
-rw-r--r--sax/qa/cppunit/test_converter.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 55d3749a4b66..a95d1be9a61a 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -322,6 +322,15 @@ void doTestStringToMeasure(sal_Int32 rValue, char const*const pis, sal_Int16 nTa
CPPUNIT_ASSERT_EQUAL(rValue, nVal);
}
+void doTestMeasureToString(char const*const pis, sal_Int32 nMeasure, sal_Int16 const nSourceUnit, sal_Int16 const nTargetUnit)
+{
+ ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis));
+ ::rtl::OUStringBuffer buf;
+ Converter::convertMeasure(buf, nMeasure, nSourceUnit, nTargetUnit);
+ OSL_TRACE("%s", ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr());
+ CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
+}
+
void ConverterTest::testMeasure()
{
doTestStringToMeasure(1000, "10mm", MeasureUnit::MM_100TH, -1, 4321);
@@ -344,6 +353,7 @@ void ConverterTest::testMeasure()
doTestStringToMeasure(600, "600px", MeasureUnit::PIXEL, 10, 4321);
doTestStringToMeasure(777, "777", MeasureUnit::APPFONT, 10, 4321);
doTestStringToMeasure(80000, "80000", MeasureUnit::SYSFONT, 10, 432100);
+ doTestMeasureToString("60mm", 6000, MeasureUnit::MM_100TH, MeasureUnit::MM_10TH);
}
CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);