mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-13735 Adding tests for DecimalFormat grouping getters
This commit is contained in:
parent
6ceb6ea8b5
commit
3b99d07581
3 changed files with 43 additions and 0 deletions
|
@ -241,6 +241,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
|
|||
TESTCASE_AUTO(Test20358_GroupingInPattern);
|
||||
TESTCASE_AUTO(Test13731_DefaultCurrency);
|
||||
TESTCASE_AUTO(Test20499_CurrencyVisibleDigitsPlural);
|
||||
TESTCASE_AUTO(Test13735_GroupingSizeGetter);
|
||||
TESTCASE_AUTO_END;
|
||||
}
|
||||
|
||||
|
@ -9705,4 +9706,24 @@ void NumberFormatTest::Test20499_CurrencyVisibleDigitsPlural() {
|
|||
}
|
||||
}
|
||||
|
||||
void NumberFormatTest::Test13735_GroupingSizeGetter() {
|
||||
IcuTestErrorCode status(*this, "Test13735_GroupingSizeGetter");
|
||||
{
|
||||
DecimalFormat df("0", {"en", status}, status);
|
||||
assertEquals("pat 0: ", 0, df.getGroupingSize());
|
||||
df.setGroupingUsed(false);
|
||||
assertEquals("pat 0 then disabled: ", 0, df.getGroupingSize());
|
||||
df.setGroupingUsed(true);
|
||||
assertEquals("pat 0 then enabled: ", 0, df.getGroupingSize());
|
||||
}
|
||||
{
|
||||
DecimalFormat df("#,##0", {"en", status}, status);
|
||||
assertEquals("pat #,##0: ", 3, df.getGroupingSize());
|
||||
df.setGroupingUsed(false);
|
||||
assertEquals("pat #,##0 then disabled: ", 3, df.getGroupingSize());
|
||||
df.setGroupingUsed(true);
|
||||
assertEquals("pat #,##0 then enabled: ", 3, df.getGroupingSize());
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
|
|
@ -297,6 +297,7 @@ class NumberFormatTest: public CalendarTimeZoneTest {
|
|||
void Test20358_GroupingInPattern();
|
||||
void Test13731_DefaultCurrency();
|
||||
void Test20499_CurrencyVisibleDigitsPlural();
|
||||
void Test13735_GroupingSizeGetter();
|
||||
|
||||
private:
|
||||
UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);
|
||||
|
|
|
@ -6669,4 +6669,25 @@ public class NumberFormatTest extends TestFmwk {
|
|||
assertEquals("iteration " + i, expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test13735_GroupingSizeGetter() {
|
||||
DecimalFormatSymbols EN = DecimalFormatSymbols.getInstance(ULocale.ENGLISH);
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("0", EN);
|
||||
assertEquals("pat 0: ", 0, df.getGroupingSize());
|
||||
df.setGroupingUsed(false);
|
||||
assertEquals("pat 0 then disabled: ", 0, df.getGroupingSize());
|
||||
df.setGroupingUsed(true);
|
||||
assertEquals("pat 0 then enabled: ", 0, df.getGroupingSize());
|
||||
}
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("#,##0", EN);
|
||||
assertEquals("pat #,##0: ", 3, df.getGroupingSize());
|
||||
df.setGroupingUsed(false);
|
||||
assertEquals("pat #,##0 then disabled: ", 3, df.getGroupingSize());
|
||||
df.setGroupingUsed(true);
|
||||
assertEquals("pat #,##0 then enabled: ", 3, df.getGroupingSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue