Home | History | Annotate | Download | only in tests

Lines Matching defs:ULocale

15 import com.ibm.icu.util.ULocale;
16 import com.ibm.icu.util.ULocale.Category;
23 private ULocale longULocale;
36 longULocale = new ULocale(longULocaleName);
37 sampleLocale = new ULocale(sampleName).toLocale();
41 * Test method for 'com.ibm.icu.x.util.ULocale.hashCode()'
44 ULocale obj = ULocale.GERMANY;
45 ULocale eq = new ULocale("de_DE");
46 ULocale neq = new ULocale("de_DE_FRENCH");
52 * Test method for 'com.ibm.icu.x.util.ULocale.forLocale(Locale)'
55 assertEquals(ULocale.GERMANY, ULocale.forLocale(Locale.GERMANY));
59 * Test method for 'com.ibm.icu.x.util.ULocale.ULocale(String)'
62 assertEquals(ULocale.GERMAN, new ULocale("de"));
66 * Test method for 'com.ibm.icu.x.util.ULocale.ULocale(String, String)'
69 assertEquals(ULocale.GERMANY, new ULocale("de", "DE"));
73 * Test method for 'com.ibm.icu.x.util.ULocale.ULocale(String, String, String)'
76 assertEquals(sampleLocale, new ULocale("ll", "cc", "VVVV").toLocale());
80 * Test method for 'com.ibm.icu.x.util.ULocale.createCanonical(String)'
83 ULocale result = ULocale.createCanonical("de__PHONEBOOK");
84 assertEquals(new ULocale("de@collation=phonebook"), result);
88 * Test method for 'com.ibm.icu.x.util.ULocale.toLocale()'
91 assertEquals(sampleLocale, new ULocale("ll", "cc", "VVVV").toLocale());
95 * Test method for 'com.ibm.icu.x.util.ULocale.getDefault()'
98 assertEquals(Locale.getDefault(), ULocale.getDefault().toLocale());
102 * Test method for 'com.ibm.icu.x.util.ULocale.setDefault(ULocale)'
106 ULocale oldULocale = ULocale.getDefault();
108 ULocale.setDefault(longULocale);
110 ICUTestCase.assertNotEqual(ULocale.getDefault(), oldULocale);
111 assertEquals(longULocale, ULocale.getDefault());
115 ULocale.setDefault(oldULocale);
121 * Test method for 'com.ibm.icu.x.util.ULocale.clone()'
128 * Test method for 'com.ibm.icu.x.util.ULocale.equals(Object)'
135 * Test method for 'com.ibm.icu.x.util.ULocale.getAvailableLocales()'
138 ULocale[] ulocales = ULocale.getAvailableLocales();
149 * Test method for 'com.ibm.icu.x.util.ULocale.getISOCountries()'
152 String[] ucountries = ULocale.getISOCountries();
165 * Test method for 'com.ibm.icu.x.util.ULocale.getISOLanguages()'
168 String[] ulanguages = ULocale.getISOLanguages();
181 * Test method for 'com.ibm.icu.x.util.ULocale.getLanguage()'
189 * Test method for 'com.ibm.icu.x.util.ULocale.getLanguage(String)'
192 assertEquals("ll", ULocale.getLanguage(longULocale.getName()));
196 * Test method for 'com.ibm.icu.x.util.ULocale.getScript()'
203 * Test method for 'com.ibm.icu.x.util.ULocale.getScript(String)'
206 assertEquals("Ssss", ULocale.getScript(longULocale.getName()));
210 * Test method for 'com.ibm.icu.x.util.ULocale.getCountry()'
218 * Test method for 'com.ibm.icu.x.util.ULocale.getCountry(String)'
221 assertEquals("CC", ULocale.getCountry(longULocale.getName()));
225 * Test method for 'com.ibm.icu.x.util.ULocale.getVariant()'
233 * Test method for 'com.ibm.icu.x.util.ULocale.getVariant(String)'
236 assertEquals("VVVV", ULocale.getVariant(longULocale.getName()));
240 * Test method for 'com.ibm.icu.x.util.ULocale.getFallback(String)'
243 assertEquals(ULocale.GERMAN, ULocale.getFallback(ULocale.GERMANY.getName()));
247 * Test method for 'com.ibm.icu.x.util.ULocale.getFallback()'
250 assertEquals(ULocale.GERMAN, ULocale.GERMANY.getFallback());
254 * Test method for 'com.ibm.icu.x.util.ULocale.getBaseName()'
261 * Test method for 'com.ibm.icu.x.util.ULocale.getBaseName(String)'
268 * Test method for 'com.ibm.icu.x.util.ULocale.getName()'
275 * Test method for 'com.ibm.icu.x.util.ULocale.getName(String)'
278 assertEquals(longULocaleName, ULocale.getName(nonNormalizedName));
282 * Test method for 'com.ibm.icu.x.util.ULocale.toString()'
289 * Test method for 'com.ibm.icu.x.util.ULocale.getKeywords()'
299 * Test method for 'com.ibm.icu.x.util.ULocale.getKeywords(String)'
302 Iterator<String> iter = ULocale.getKeywords(nonNormalizedName);
309 * Test method for 'com.ibm.icu.x.util.ULocale.getKeywordValue(String)'
318 * Test method for 'com.ibm.icu.x.util.ULocale.getKeywordValue(String, String)'
321 assertEquals("value", ULocale.getKeywordValue(longULocaleName, "key"));
322 assertEquals("phonebook", ULocale.getKeywordValue(longULocaleName, "collation"));
323 assertNull(ULocale.getKeywordValue(longULocaleName, "zzyzx"));
328 * Test method for 'com.ibm.icu.x.util.ULocale.canonicalize(String)'
331 assertEquals("de@collation=phonebook", ULocale.canonicalize("de__PHONEBOOK"));
335 * Test method for 'com.ibm.icu.x.util.ULocale.setKeywordValue(String, String)'
338 ULocale munged = longULocale.setKeywordValue("key", "C#");
345 * Test method for 'com.ibm.icu.x.util.ULocale.setKeywordValue(String, String, String)'
348 String munged = ULocale.setKeywordValue(longULocaleName, "key", "C#");
349 assertEquals("C#", ULocale.getKeywordValue(munged, "key"));
350 munged = ULocale.setKeywordValue(munged, "zzyzx", "grue");
351 assertEquals("grue", ULocale.getKeywordValue(munged, "zzyzx"));
355 * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Language()'
358 String il = ULocale.GERMANY.getISO3Language();
364 * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Language(String)'
367 String il = ULocale.getISO3Language(ULocale.GERMANY.getName());
373 * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Country()'
376 String ic = ULocale.GERMANY.getISO3Country();
382 * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Country(String)'
385 String ic = ULocale.getISO3Country(ULocale.GERMANY.getName());
391 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage()'
394 String idl = ULocale.GERMANY.getDisplayLanguage();
400 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage(ULocale)'
403 String idl = ULocale.GERMANY.getDisplayLanguage(ULocale.GERMANY);
409 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage(String, String)'
412 String idl = ULocale.getDisplayLanguage(ULocale.GERMANY.getName(), "de_DE");
418 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage(String, ULocale)'
421 String idl = ULocale.getDisplayLanguage(ULocale.GERMANY.getName(), ULocale.GERMANY);
427 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript()'
430 String is = ULocale.TRADITIONAL_CHINESE.getDisplayScript();
439 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript(ULocale)'
442 String is = ULocale.TRADITIONAL_CHINESE.getDisplayScript(ULocale.GERMANY);
452 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript(String, String)'
455 String is = ULocale.getDisplayScript("zh_Hant", "de_DE");
465 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript(String, ULocale)'
468 String is = ULocale.getDisplayScript("zh_Hant", ULocale.GERMANY);
478 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry()'
481 String idc = ULocale.GERMANY.getDisplayCountry();
487 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry(ULocale)'
490 String idc = ULocale.GERMANY.getDisplayCountry(ULocale.GERMANY);
496 * Test method for 'com.ibm.icu.x.util.ULocale
499 String idc = ULocale.getDisplayCountry("de_DE", "de_DE");
505 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry(String, ULocale)'
508 String idc = ULocale.getDisplayCountry("de_DE", ULocale.GERMANY);
514 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant()'
517 String idv = new ULocale("de_DE_PHONEBOOK").getDisplayVariant();
523 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(ULocale)'
526 String idv = new ULocale("de_DE_PHONEBOOK").getDisplayVariant(ULocale.GERMANY);
532 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(String, String)'
535 String idv = ULocale.getDisplayVariant("de_DE_PHONEBOOK", "de_DE");
541 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(String, ULocale)'
544 String idv = ULocale.getDisplayVariant("de_DE_PHONEBOOK", ULocale.GERMANY);
550 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeyword(String)'
553 String idk = ULocale.getDisplayKeyword("collation");
558 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeyword(String, String)'
561 String idk = ULocale.getDisplayKeyword("collation", "de_DE");
571 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeyword(String, ULocale)'
574 String idk = ULocale.getDisplayKeyword("collation", ULocale.GERMANY);
584 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String)'
587 ULocale ul = new ULocale("de_DE@collation=phonebook");
598 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, ULocale)'
601 ULocale ul = new ULocale("de_DE@collation=phonebook");
602 String idk = ul.getDisplayKeywordValue("collation", ULocale.GERMANY);
612 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, String, String)'
615 String idk = ULocale.getDisplayKeywordValue("de_DE@collation=phonebook", "collation", "de_DE");
625 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, String, ULocale)'
628 String idk = ULocale.getDisplayKeywordValue("de_DE@collation=phonebook", "collation", ULocale.GERMANY);
638 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName()'
641 String idn = ULocale.GERMANY.getDisplayName();
647 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName(ULocale)'
650 String idn = ULocale.GERMANY.getDisplayName(ULocale.GERMANY);
656 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName(String, String)'
659 String idn = ULocale.getDisplayName("de_DE", "de_DE");
665 * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName(String, ULocale)'
668 String idn = ULocale.getDisplayName("de_DE", ULocale.GERMANY);
674 * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(String, ULocale[], boolean[])'
678 ULocale[] locales = {
679 new ULocale("en_CA"),
680 new ULocale("es_US"),
682 ULocale result = ULocale.acceptLanguage("en-US, en-GB, en-CA, es-US", locales, fallback);
683 assertEquals(new ULocale("en_CA"), result);
685 result = ULocale.acceptLanguage("en-US, en-GB, es-US-NEWMEXICO", locales, fallback);
686 assertEquals(new ULocale("es_US"), result);
691 * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(ULocale[], ULocale[], boolean[])'
695 ULocale[] locales = {
696 new ULocale("en_CA"),
697 new ULocale("es_US"),
699 ULocale[] accept_locales = {
700 new ULocale("en_US"),
701 new ULocale("en_GB"),
702 new ULocale("en_CA"),
703 new ULocale("es_US"),
705 ULocale[] accept_locales2 = {
706 new ULocale("en_US"),
707 new ULocale("en_GB"),
708 new ULocale("es_US_NEWMEXICO"),
710 ULocale result = ULocale.acceptLanguage(accept_locales, locales, fallback);
711 assertEquals(new ULocale("en_CA"), result);
713 result = ULocale.acceptLanguage(accept_locales2, locales, fallback);
714 assertEquals(new ULocale("es_US"), result);
719 * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(String, boolean[])'
723 ULocale result = ULocale.acceptLanguage("en-CA, en-GB, es-US", fallback);
724 assertEquals(new ULocale("en_CA"), result);
726 result = ULocale.acceptLanguage("es-US-NEWMEXICO", fallback);
732 * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(ULocale[], boolean[])'
736 ULocale[] accept_locales = {
737 new ULocale("en_CA"),
738 new ULocale("en_GB"),
739 new ULocale("es_US"),
741 ULocale[] accept_locales2 = {
742 new ULocale("es_US_NEWMEXICO"),
744 ULocale result = ULocale.acceptLanguage(accept_locales, fallback);
745 assertEquals(new ULocale("en_CA"), result);
747 result = ULocale.acceptLanguage(accept_locales2, fallback);
753 * Test method for 'com.ibm.icu.x.util.ULocale.toLanguageTag()'
756 ULocale[] test_ulocales = {
757 new ULocale("en_US"),
758 new ULocale(""),
759 new ULocale("de_DE@collation=phonebook"),
760 new ULocale("en_Latn_US_POSIX"),
761 new ULocale("th_TH@numbers=thai;calendar=buddhist"),
762 new ULocale("und_CN@timezone=PRC"),
763 new ULocale("iw_IL"),
783 * Test method for 'com.ibm.icu.x.util.ULocale.forLanguageTag()'
793 ULocale[] expected = {
794 new ULocale("en_US"),
795 new ULocale("und_US"),
796 new ULocale("ja_JP@calendar=japanese"),
797 new ULocale("fr_FR@calendar=gregorian;timezone=Europe/Paris"),
801 ULocale result = ULocale.forLanguageTag(test_tags[i]);
807 * Test method for 'com.ibm.icu.x.util.ULocale.getDefault(Category)'
810 ULocale dispLoc = ULocale.getDefault(Category.DISPLAY);
812 ULocale formLoc = ULocale.getDefault(Category.FORMAT);
817 * Test method for 'com.ibm.icu.x.util.ULocale.setDefault(Category, ULocale)'
820 ULocale orgDefault = ULocale.getDefault();
821 ULocale orgDisplay = ULocale.getDefault(Category.DISPLAY);
822 ULocale orgFormat = ULocale.getDefault(Category.FORMAT);
824 ULocale jaUS = new ULocale("ja_US");
825 ULocale.setDefault(jaUS);
827 // setDefault(ULocale) updates category defaults
828 assertEquals(ULocale.getDefault(), jaUS);
829 assertEquals(ULocale.getDefault(Category.DISPLAY), jaUS);
830 assertEquals(ULocale.getDefault(Category.FORMAT), jaUS);
832 ULocale frDE = new ULocale("fr_DE");
833 ULocale.setDefault(Category.DISPLAY, frDE);
835 // setDefault(Category, ULocale) only updates the category default
836 assertEquals(ULocale.getDefault(), jaUS);
837 assertEquals(ULocale.getDefault(Category.DISPLAY), frDE);
838 assertEquals(ULocale.getDefault(Category.FORMAT), jaUS);
841 ULocale.setDefault(orgDefault);
842 ULocale.setDefault(Category.DISPLAY, orgDisplay);
843 ULocale.setDefault(Category.FORMAT, orgFormat);
845 assertEquals(ULocale.getDefault(), orgDefault);
846 assertEquals(ULocale.getDefault(Category.DISPLAY), orgDisplay);
847 assertEquals(ULocale.getDefault(Category.FORMAT), orgFormat);