summaryrefslogtreecommitdiff
path: root/sax/qa/cppunit/test_converter.cxx
diff options
context:
space:
mode:
authorArtur Dorda <artur.dorda+libo@gmail.com>2012-08-09 01:09:25 +0200
committerArtur Dorda <artur.dorda+libo@gmail.com>2012-08-15 13:42:14 +0200
commit22f295551c7371e742b97557a6aa6bc1bc6a0c9e (patch)
tree261efaa0b566b8dd9b7f626312b49abd131fb9fb /sax/qa/cppunit/test_converter.cxx
parentea6184c588eb9f00ec660738773b89813a6dd2ea (diff)
Started testing measures in converter test, first: string to measure
Change-Id: I96296b75d7c1f131a96add9dd17dfbffa079e343
Diffstat (limited to 'sax/qa/cppunit/test_converter.cxx')
-rw-r--r--sax/qa/cppunit/test_converter.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 1a33915873d4..aca997660d25 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -50,11 +50,13 @@ public:
void testDuration();
void testDateTime();
void testDouble();
+ void testMeasure();
CPPUNIT_TEST_SUITE(ConverterTest);
CPPUNIT_TEST(testDuration);
CPPUNIT_TEST(testDateTime);
CPPUNIT_TEST(testDouble);
+ CPPUNIT_TEST(testMeasure);
CPPUNIT_TEST_SUITE_END();
private:
@@ -310,6 +312,20 @@ void ConverterTest::testDouble()
doTestDouble("700", 70.0, MeasureUnit::MM_100TH, MeasureUnit::MM_10TH);
}
+void doTestStringToMeasure(sal_Int32 rValue, char const*const pis, sal_Int16 nTargetUnit, sal_Int32 nMin, sal_Int32 nMax)
+{
+ ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis));
+ sal_Int32 nVal;
+ bool bSuccess(Converter::convertMeasure(nVal, is, nTargetUnit, nMin, nMax));
+ OSL_TRACE("%i", nVal);
+ CPPUNIT_ASSERT(bSuccess);
+ CPPUNIT_ASSERT_EQUAL(rValue, nVal);
+}
+
+void ConverterTest::testMeasure()
+{
+ doTestStringToMeasure(1000, "10mm", MeasureUnit::MM_100TH, 1, 4321);
+}
CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
}