diff options
author | Eike Rathke <erack@redhat.com> | 2014-05-21 14:14:56 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-05-21 14:15:24 +0200 |
commit | b8e8c9c471ba6974886dd624630144ef2edccb2c (patch) | |
tree | dee22560cdded0dc6fabe808d75161f545f4837d | |
parent | add static LanguageTag::isValidBcp47() (diff) | |
download | core-b8e8c9c471ba6974886dd624630144ef2edccb2c.tar.gz core-b8e8c9c471ba6974886dd624630144ef2edccb2c.zip |
add unit test for static isValidBcp47() method
Change-Id: Ib234fb1d14087236d337dfe351aea941945e718c
-rw-r--r-- | i18nlangtag/qa/cppunit/test_languagetag.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx index 93506fb3d598..b86e2636cc10 100644 --- a/i18nlangtag/qa/cppunit/test_languagetag.cxx +++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx @@ -586,6 +586,22 @@ void TestLanguageTag::testAllTags() CPPUNIT_ASSERT( uab.isIsoLocale() == false ); CPPUNIT_ASSERT( uab.isIsoODF() == false ); } + + // test static isValidBcp47() method + { + OUString aCanonicalized; + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized) && aCanonicalized == "en-US" ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized) && aCanonicalized == "x-foobar" ); + CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "unreg-and-bad", &aCanonicalized) ); +#if USE_LIBLANGTAG + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", &aCanonicalized) && aCanonicalized == "de-DE" ); + /* TODO: at least some (those we know) grandfathered tags should be + * recognized by the replacement code. */ + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-GB-oed", &aCanonicalized) && aCanonicalized == "en-GB-oed" ); +#else + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", &aCanonicalized) && aCanonicalized == "de-Latn-DE" ); +#endif + } } static bool checkMapping( const OUString& rStr1, const OUString& rStr2 ) |