summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-05-21 14:14:56 +0200
committerEike Rathke <erack@redhat.com>2014-05-21 14:15:24 +0200
commitb8e8c9c471ba6974886dd624630144ef2edccb2c (patch)
treedee22560cdded0dc6fabe808d75161f545f4837d
parenta6e6cc49bfbf594aa59804ee0d9751d5ff19caba (diff)
add unit test for static isValidBcp47() method
Change-Id: Ib234fb1d14087236d337dfe351aea941945e718c
-rw-r--r--i18nlangtag/qa/cppunit/test_languagetag.cxx16
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 )