From 74e9456c6d7c43739c3e57640e52b3f851c4f558 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 21 Apr 2016 19:02:48 +0200 Subject: [PATCH] unit test 'C' locale shall map to 'en-US' Change-Id: Id4772b087add703537b588c961283466436f10c1 --- i18nlangtag/qa/cppunit/test_languagetag.cxx | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx index 766de5affea3..a5d40f9afb0b 100644 --- a/i18nlangtag/qa/cppunit/test_languagetag.cxx +++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx @@ -562,6 +562,30 @@ void TestLanguageTag::testAllTags() CPPUNIT_ASSERT( joker.getLanguageType() == LANGUAGE_USER_PRIV_JOKER ); } + // 'C' locale shall map to 'en-US' + { + LanguageTag aTag( "C" ); + CPPUNIT_ASSERT( aTag.getLanguage() == "en" ); + CPPUNIT_ASSERT( aTag.getCountry() == "US" ); + lang::Locale aLocale = aTag.getLocale(); + CPPUNIT_ASSERT( aTag.getBcp47() == "en-US" ); + CPPUNIT_ASSERT( aLocale.Language == "en" ); + CPPUNIT_ASSERT( aLocale.Country == "US" ); + CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); + CPPUNIT_ASSERT( aTag.getLanguageType() == LANGUAGE_ENGLISH_US ); + } + { + LanguageTag aTag( lang::Locale("C","","") ); + CPPUNIT_ASSERT( aTag.getLanguage() == "en" ); + CPPUNIT_ASSERT( aTag.getCountry() == "US" ); + lang::Locale aLocale = aTag.getLocale(); + CPPUNIT_ASSERT( aTag.getBcp47() == "en-US" ); + CPPUNIT_ASSERT( aLocale.Language == "en" ); + CPPUNIT_ASSERT( aLocale.Country == "US" ); + CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); + CPPUNIT_ASSERT( aTag.getLanguageType() == LANGUAGE_ENGLISH_US ); + } + // test reset() methods { LanguageTag aTag( LANGUAGE_DONTKNOW );