Author: [email protected]
Date: Fri May 29 12:15:37 2009
New Revision: 5476
Modified:
trunk/user/src/com/google/gwt/i18n/client/NumberFormat.java
trunk/user/test/com/google/gwt/i18n/client/NumberFormat_en_Test.java
trunk/user/test/com/google/gwt/i18n/client/NumberFormat_fr_Test.java
Log:
Fix typo in r5450 (period rather than comma in LOCLAIZED_COMMA_EQUIVALENTS)
and added tests that would have caught it.
Patch by: jat
Review by: andreasst (TBR)
Modified: trunk/user/src/com/google/gwt/i18n/client/NumberFormat.java
==============================================================================
--- trunk/user/src/com/google/gwt/i18n/client/NumberFormat.java (original)
+++ trunk/user/src/com/google/gwt/i18n/client/NumberFormat.java Fri May 29
12:15:37 2009
@@ -327,7 +327,7 @@
// Localized characters for dot and comma in number patterns, used to
produce
// the latin mapping for arbitrary locales. Any separator not in either
of
// these strings will be mapped to non-breaking space (U+00A0).
- private static final String LOCALIZED_COMMA_EQUIVALENTS
= ".\u060C\u066B\u3001\uFE10\uFE11\uFE50\uFE51\uFF0C\uFF64";
+ private static final String LOCALIZED_COMMA_EQUIVALENTS
= ",\u060C\u066B\u3001\uFE10\uFE11\uFE50\uFE51\uFF0C\uFF64";
private static final String LOCALIZED_DOT_EQUIVALENTS
= ".\u2024\u3002\uFE12\uFE52\uFF0E\uFF61";
// Constants for characters used in programmatic (unlocalized) patterns.
Modified:
trunk/user/test/com/google/gwt/i18n/client/NumberFormat_en_Test.java
==============================================================================
--- trunk/user/test/com/google/gwt/i18n/client/NumberFormat_en_Test.java
(original)
+++ trunk/user/test/com/google/gwt/i18n/client/NumberFormat_en_Test.java
Fri May 29 12:15:37 2009
@@ -245,6 +245,20 @@
assertEquals("1234567890", str);
}
+ public void testForceLatin() {
+ assertFalse(NumberFormat.forcedLatinDigits());
+ NumberFormat.setForcedLatinDigits(true);
+ assertTrue(NumberFormat.forcedLatinDigits());
+ NumberFormat decLatin = NumberFormat.getDecimalFormat();
+ assertEquals("1,003.14", decLatin.format(1003.14));
+ assertEquals("-1,003.14", decLatin.format(-1003.14));
+ NumberFormat.setForcedLatinDigits(false);
+ assertFalse(NumberFormat.forcedLatinDigits());
+ assertEquals("3.14", decLatin.format(3.14));
+ NumberFormat unforced = NumberFormat.getDecimalFormat();
+ assertEquals("3.14", unforced.format(3.14));
+ }
+
public void testNegative() {
String str;
Modified:
trunk/user/test/com/google/gwt/i18n/client/NumberFormat_fr_Test.java
==============================================================================
--- trunk/user/test/com/google/gwt/i18n/client/NumberFormat_fr_Test.java
(original)
+++ trunk/user/test/com/google/gwt/i18n/client/NumberFormat_fr_Test.java
Fri May 29 12:15:37 2009
@@ -201,6 +201,20 @@
assertEquals("1234567890", str);
}
+ public void testForceLatin() {
+ assertFalse(NumberFormat.forcedLatinDigits());
+ NumberFormat.setForcedLatinDigits(true);
+ assertTrue(NumberFormat.forcedLatinDigits());
+ NumberFormat decLatin = NumberFormat.getDecimalFormat();
+ assertEquals("1\u00A0003,14", decLatin.format(1003.14));
+ assertEquals("-1\u00A0003,14", decLatin.format(-1003.14));
+ NumberFormat.setForcedLatinDigits(false);
+ assertFalse(NumberFormat.forcedLatinDigits());
+ assertEquals("3,14", decLatin.format(3.14));
+ NumberFormat unforced = NumberFormat.getDecimalFormat();
+ assertEquals("3,14", unforced.format(3.14));
+ }
+
public void testPerMill() {
String str;
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---