Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4481)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java

Issue 2281913002: Currency code exceeding 6 chars will be ellipsized. (Closed)
Patch Set: formatCurrency() Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java
index a0b227e3c4227e2cc36596e23ae22854fbba3853..0a936f637d05b621c0120961bafc7d5ce444a6c1 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java
@@ -13,6 +13,11 @@ import java.util.Locale;
* A lightweight integration test for CurrencyStringFormatter to run on an Android device.
*/
public class CurrencyStringFormatterTest extends InstrumentationTestCase {
+ /**
+ * Unicode for ellipsis.
+ */
+ private static final String ELLIPSIS = "\u2026";
+
@SmallTest
public void testCad() throws Exception {
CurrencyStringFormatter formatter = new CurrencyStringFormatter("CAD", new Locale("en-US"));
@@ -84,4 +89,24 @@ public class CurrencyStringFormatterTest extends InstrumentationTestCase {
CurrencyStringFormatter formatter = new CurrencyStringFormatter("PKR", new Locale("en-US"));
assertEquals("5", formatter.format("5"));
}
+
+ @SmallTest
+ public void testCurrency6Chars() throws Exception {
+ CurrencyStringFormatter formatter =
+ new CurrencyStringFormatter("ABCDEF", new Locale("en-US"));
+ assertEquals("ABCDEF", formatter.formatCurrency("ABCDEF"));
+ }
+
+ @SmallTest
+ public void testCurrencyEllipsized() throws Exception {
+ CurrencyStringFormatter formatter =
+ new CurrencyStringFormatter("ABCDEFG", new Locale("en-US"));
+ assertEquals("ABCDE" + ELLIPSIS, formatter.formatCurrency("ABCDEFG"));
please use gerrit instead 2016/09/02 17:30:55 Use use the ELLIPSIS only once here., so it's fewe
pals 2016/09/06 06:09:00 Done.
+ }
+
+ @SmallTest
+ public void testCurrencyEmpty() throws Exception {
+ CurrencyStringFormatter formatter = new CurrencyStringFormatter("", new Locale("en-US"));
+ assertEquals("", formatter.formatCurrency(""));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698