diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-06-01 18:51:45 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-06-02 00:14:44 +0200 |
commit | 12e30adf9daf337084aba2249218d3e56bfe4ea3 (patch) | |
tree | 48c4421697d9536b8c776ef107185cbad5d83082 /svl/qa/unit | |
parent | 278e2b36d28ab3c78d285688c78996d92d92727f (diff) |
add initial IsNumberFormat test
Change-Id: Idfd51360bfe8d857838ee522b8a9d3d3de06952b
Diffstat (limited to 'svl/qa/unit')
-rw-r--r-- | svl/qa/unit/svl.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index d3bf59bb2cd0..edfd536273ef 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -60,6 +60,7 @@ public: void testFdo60915(); void testI116701(); void testDateInput(); + void testIsNumberFormat(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testNumberFormat); @@ -69,6 +70,7 @@ public: CPPUNIT_TEST(testFdo60915); CPPUNIT_TEST(testI116701); CPPUNIT_TEST(testDateInput); + CPPUNIT_TEST(testIsNumberFormat); CPPUNIT_TEST_SUITE_END(); private: @@ -1018,6 +1020,36 @@ void Test::checkDateInput( SvNumberFormatter& rFormatter, const char* pTimezone, CPPUNIT_ASSERT_EQUAL( aDate, aOutString); } +void Test::testIsNumberFormat() +{ + LanguageType eLang = LANGUAGE_THAI; + SvNumberFormatter aFormatter(m_xContext, eLang); + + struct NumberFormatData + { + const char* pFormat; + bool bIsNumber; + } aTests[] = { + { "20.3", true }, + { "2", true }, + { "test", false }, + { "Jan1", false } + // { "Jan1 2000", true }, + // { "Jan 1", true }, + // { "Jan 1 2000", true} + }; + + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + { + sal_uInt32 nIndex; + double nNumber; + OUString aString = OUString::createFromAscii(aTests[i].pFormat); + bool bIsNumber = aFormatter.IsNumberFormat(aString, nIndex, nNumber); + CPPUNIT_ASSERT_EQUAL(aTests[i].bIsNumber, bIsNumber); + + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } |