Bug 60422 add testtestcase with current LocaleUtil workaround
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799721 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e23e4e9d8
commit
66b39c70ad
@ -851,4 +851,25 @@ public class TestDataFormatter {
|
||||
assertEquals("08:51", dfUS.formatRawCellContents(42605.368761574071, -1, "hh:mm"));
|
||||
assertEquals("51:01", dfUS.formatRawCellContents(42605.368761574071, -1, "mm:ss"));
|
||||
}
|
||||
|
||||
/**
|
||||
* bug 60422 : DataFormatter has issues with a specific NumberFormat in Germany default locale
|
||||
* Currently, this test only passes if you set LocaleUtil.setUserLocale(Locale.ROOT) or Locale.US.
|
||||
*/
|
||||
@Test
|
||||
public void testBug60422() {
|
||||
Locale defaultLocale = Locale.getDefault();
|
||||
Locale.setDefault(Locale.GERMANY);
|
||||
LocaleUtil.setUserLocale(Locale.ROOT);
|
||||
try {
|
||||
char euro = '\u20AC';
|
||||
DataFormatter df = new DataFormatter();
|
||||
String formatString = String.format(
|
||||
"_-* #,##0.00\\ \"%s\"_-;\\-* #,##0.00\\ \"%s\"_-;_-* \"-\"??\\ \"%s\"_-;_-@_-",
|
||||
euro, euro, euro);
|
||||
assertEquals("4.33 " + euro, df.formatRawCellContents(4.33, 178, formatString));
|
||||
} finally {
|
||||
Locale.setDefault(defaultLocale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user