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

Side by Side 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: Added comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.test.InstrumentationTestCase; 7 import android.test.InstrumentationTestCase;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 9
10 import java.util.Locale; 10 import java.util.Locale;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 public void testEur() throws Exception { 77 public void testEur() throws Exception {
78 CurrencyStringFormatter formatter = new CurrencyStringFormatter("EUR", n ew Locale("en-US")); 78 CurrencyStringFormatter formatter = new CurrencyStringFormatter("EUR", n ew Locale("en-US"));
79 assertEquals("€5.00", formatter.format("5")); 79 assertEquals("€5.00", formatter.format("5"));
80 } 80 }
81 81
82 @SmallTest 82 @SmallTest
83 public void testPkr() throws Exception { 83 public void testPkr() throws Exception {
84 CurrencyStringFormatter formatter = new CurrencyStringFormatter("PKR", n ew Locale("en-US")); 84 CurrencyStringFormatter formatter = new CurrencyStringFormatter("PKR", n ew Locale("en-US"));
85 assertEquals("5", formatter.format("5")); 85 assertEquals("5", formatter.format("5"));
86 } 86 }
87
88 @SmallTest
89 public void testCurrency6Chars() throws Exception {
90 CurrencyStringFormatter formatter =
91 new CurrencyStringFormatter("ABCDEF", new Locale("en-US"));
92 assertEquals("ABCDEF", formatter.getFormattedCurrencyCode());
93 }
94
95 @SmallTest
96 public void testCurrencyEllipsized() throws Exception {
97 CurrencyStringFormatter formatter =
98 new CurrencyStringFormatter("ABCDEFG", new Locale("en-US"));
99 // Currency code more than 6 character is formatted to first 5 character s and ellipsis.
100 // "\u2026" is unicode for ellipsis.
101 assertEquals("ABCDE\u2026", formatter.getFormattedCurrencyCode());
102 }
103
104 @SmallTest
105 public void testCurrencyEmpty() throws Exception {
106 CurrencyStringFormatter formatter = new CurrencyStringFormatter("", new Locale("en-US"));
107 assertEquals("", formatter.getFormattedCurrencyCode());
108 }
87 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698