mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-13567 make Arabic number formatting tests work with both native & ASCII digits
X-SVN-Rev: 40988
This commit is contained in:
parent
595e9e61c4
commit
66eb21ec58
9 changed files with 20 additions and 20 deletions
|
@ -2372,7 +2372,7 @@ static const NumSysTestItem numSysTestItems[] = {
|
|||
{ "en", "latn", 10, FALSE, latnDesc },
|
||||
{ "en@numbers=roman", "roman", 10, TRUE, romanDesc },
|
||||
{ "en@numbers=finance", "latn", 10, FALSE, latnDesc },
|
||||
{ "ar", "arab", 10, FALSE, arabDesc },
|
||||
{ "ar-EG", "arab", 10, FALSE, arabDesc },
|
||||
{ "fa", "arabext", 10, FALSE, arabextDesc },
|
||||
{ "zh_Hans@numbers=hanidec", "hanidec", 10, FALSE, hanidecDesc },
|
||||
{ "zh_Hant@numbers=traditional", "hant", 10, TRUE, hantDesc },
|
||||
|
|
|
@ -279,7 +279,7 @@ void CompactDecimalFormatTest::TestSwahiliShortNegative() {
|
|||
}
|
||||
|
||||
void CompactDecimalFormatTest::TestArabicLong() {
|
||||
CheckLocale("ar", UNUM_LONG, kArabicLong, UPRV_LENGTHOF(kArabicLong));
|
||||
CheckLocale("ar-EG", UNUM_LONG, kArabicLong, UPRV_LENGTHOF(kArabicLong));
|
||||
}
|
||||
|
||||
void CompactDecimalFormatTest::TestSignificantDigits() {
|
||||
|
|
|
@ -1355,18 +1355,18 @@ DateFormatTest::TestLocaleDateFormat() // Bug 495
|
|||
void
|
||||
DateFormatTest::TestFormattingLocaleTimeSeparator()
|
||||
{
|
||||
// This test not as useful is it once was, since timeSeparator
|
||||
// in the Arabic is changed back to ":" in CLDR 28.
|
||||
// This test not as useful as it once was, since timeSeparator
|
||||
// in the Arabic locale is changed back to ":" in CLDR 28.
|
||||
const UDate testDate = 874266720000.; // Sun Sep 14 21:52:00 CET 1997
|
||||
logln((UnicodeString)"Date set to : " + dateToString(testDate));
|
||||
|
||||
const LocalPointer<const TimeZone> tz(TimeZone::createTimeZone("CET"));
|
||||
|
||||
const LocalPointer<DateFormat> dfArab(DateFormat::createTimeInstance(
|
||||
DateFormat::SHORT, Locale("ar")));
|
||||
DateFormat::SHORT, Locale("ar", "EG")));
|
||||
|
||||
const LocalPointer<DateFormat> dfLatn(DateFormat::createTimeInstance(
|
||||
DateFormat::SHORT, Locale("ar", NULL, NULL, "numbers=latn")));
|
||||
DateFormat::SHORT, Locale("ar", "EG", NULL, "numbers=latn")));
|
||||
|
||||
if (dfLatn.isNull() || dfArab.isNull()) {
|
||||
dataerrln("Error calling DateFormat::createTimeInstance()");
|
||||
|
|
|
@ -1486,9 +1486,9 @@ void NumberFormatterApiTest::symbols() {
|
|||
u"US$ 12,345.67");
|
||||
|
||||
assertFormatSingle(
|
||||
u"Currency symbol should follow number in ar with NS arab",
|
||||
u"Currency symbol should follow number in ar-EG with NS arab",
|
||||
NumberFormatter::with().unit(USD),
|
||||
Locale("ar"),
|
||||
Locale("ar-EG"),
|
||||
12345.67,
|
||||
u"١٢٬٣٤٥٫٦٧ US$");
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// https://docs.google.com/document/d/1T2P0p953_Lh1pRwo-5CuPVrHlIBa_wcXElG-Hhg_WHM/edit?usp=sharing
|
||||
|
||||
test plus sign
|
||||
set locale ar
|
||||
set locale ar-EG
|
||||
set pattern +0;-#
|
||||
begin
|
||||
format output breaks
|
||||
|
|
|
@ -393,7 +393,7 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
|||
@Test
|
||||
public void TestArabicLongStyle() {
|
||||
NumberFormat cdf =
|
||||
CompactDecimalFormat.getInstance(new Locale("ar"), CompactStyle.LONG);
|
||||
CompactDecimalFormat.getInstance(new Locale("ar-EG"), CompactStyle.LONG);
|
||||
assertEquals("Arabic Long", "\u061C-\u0665\u066B\u0663 \u0623\u0644\u0641", cdf.format(-5300));
|
||||
}
|
||||
|
||||
|
@ -690,17 +690,17 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
|||
assertEquals("CDF should correctly format 43000 in 'ar'", "٤٣ ألف", result);
|
||||
|
||||
// Bug #12449
|
||||
cdf = CompactDecimalFormat.getInstance(new ULocale("ar"), CompactDecimalFormat.CompactStyle.SHORT);
|
||||
cdf = CompactDecimalFormat.getInstance(new ULocale("ar-EG"), CompactDecimalFormat.CompactStyle.SHORT);
|
||||
cdf.setMaximumSignificantDigits(3);
|
||||
result = cdf.format(1234);
|
||||
assertEquals("CDF should correctly format 1234 with 3 significant digits in 'ar'", "١٫٢٣ ألف", result);
|
||||
assertEquals("CDF should correctly format 1234 with 3 significant digits in 'ar-EG'", "١٫٢٣ ألف", result);
|
||||
|
||||
// Check currency formatting as well
|
||||
cdf = CompactDecimalFormat.getInstance(new ULocale("ar"), CompactDecimalFormat.CompactStyle.SHORT);
|
||||
cdf = CompactDecimalFormat.getInstance(new ULocale("ar-EG"), CompactDecimalFormat.CompactStyle.SHORT);
|
||||
result = cdf.format(new CurrencyAmount(43000f, Currency.getInstance("USD")));
|
||||
assertEquals("CDF should correctly format 43000 with currency in 'ar'", "US$ ٤٣ ألف", result);
|
||||
assertEquals("CDF should correctly format 43000 with currency in 'ar-EG'", "US$ ٤٣ ألف", result);
|
||||
result = cdf.format(new CurrencyAmount(-43000f, Currency.getInstance("USD")));
|
||||
assertEquals("CDF should correctly format -43000 with currency in 'ar'", "-US$ ٤٣ ألف", result);
|
||||
assertEquals("CDF should correctly format -43000 with currency in 'ar-EG'", "-US$ ٤٣ ألف", result);
|
||||
|
||||
// Extra locale with different positive/negative formats
|
||||
cdf = CompactDecimalFormat.getInstance(new ULocale("fi"), CompactDecimalFormat.CompactStyle.SHORT);
|
||||
|
|
|
@ -2067,8 +2067,8 @@ public class DateFormatTest extends TestFmwk {
|
|||
Date date = new Date(874266720000L); // Sun Sep 14 21:52:00 CET 1997
|
||||
TimeZone tz = TimeZone.getTimeZone("CET");
|
||||
|
||||
DateFormat dfArab = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar"));
|
||||
DateFormat dfLatn = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar-u-nu-latn"));
|
||||
DateFormat dfArab = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar-EG"));
|
||||
DateFormat dfLatn = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar-EG-u-nu-latn"));
|
||||
|
||||
dfArab.setTimeZone(tz);
|
||||
dfLatn.setTimeZone(tz);
|
||||
|
|
|
@ -109,7 +109,7 @@ p: - "1 234,56" 1234.56
|
|||
p: - "1,234,56" 1.234
|
||||
p: - "1。234、56" 1234.56
|
||||
|
||||
loc= "ar"
|
||||
loc= "ar-EG"
|
||||
p: - "1234٫56" 1234.56
|
||||
p: - "1234،56" 1234.56
|
||||
p: - "1234،56" 1234.56
|
||||
|
|
|
@ -1579,10 +1579,10 @@ public class NumberFormatterApiTest {
|
|||
"US$ 12,345.67");
|
||||
|
||||
assertFormatSingle(
|
||||
"Currency symbol should follow number in ar with NS arab",
|
||||
"Currency symbol should follow number in ar-EG with NS arab",
|
||||
"",
|
||||
NumberFormatter.with().unit(USD),
|
||||
new ULocale("ar"),
|
||||
new ULocale("ar-EG"),
|
||||
12345.67,
|
||||
"١٢٬٣٤٥٫٦٧ US$");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue