diff options
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java | 15 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java | 57 |
2 files changed, 43 insertions, 29 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 129a74fd96..66657a0fd9 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -2902,7 +2902,12 @@ public final class TestBugs extends BaseTestBugzillaIssues { } @Test public void test63819() throws IOException { - simpleTest("63819.xls"); + LocaleUtil.setUserLocale(Locale.UK); + try { + simpleTest("63819.xls"); + } finally { + LocaleUtil.resetUserLocale(); + } } /** @@ -2961,8 +2966,12 @@ public final class TestBugs extends BaseTestBugzillaIssues { evals.add(wb.getCreationHelper().createFormulaEvaluator()); evals.addAll(SIMPLE_REFS.values()); - HSSFFormulaEvaluator.setupEnvironment( files.toArray(new String[0]), evals.toArray(new HSSFFormulaEvaluator[0]) ); - evals.get(0).evaluateAll(); + try { + HSSFFormulaEvaluator.setupEnvironment(files.toArray(new String[0]), evals.toArray(new HSSFFormulaEvaluator[0])); + evals.get(0).evaluateAll(); + } catch (RuntimeException e) { + throw new RuntimeException("While handling files " + files + " and evals " + evals, e); + } } diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java index edaa5da042..a25fa270d1 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java @@ -50,31 +50,36 @@ public final class TestDateValue { @Test public void testDateValue() { - confirmDateValue(new StringEval("2020-02-01"), 43862); - confirmDateValue(new StringEval("01-02-2020"), 43862); - confirmDateValue(new StringEval("2020-FEB-01"), 43862); - confirmDateValue(new StringEval("2020-Feb-01"), 43862); - confirmDateValue(new StringEval("2020-FEBRUARY-01"), 43862); - confirmDateValue(new StringEval("FEB-01"), 43862); - confirmDateValue(new StringEval("2/1/2020"), 43862); - confirmDateValue(new StringEval("2/1"), 43862); - confirmDateValue(new StringEval("2020/2/1"), 43862); - confirmDateValue(new StringEval("2020/FEB/1"), 43862); - confirmDateValue(new StringEval("FEB/1/2020"), 43862); - confirmDateValue(new StringEval("2020/02/01"), 43862); - - confirmDateValue(new StringEval("")); - confirmDateValue(BlankEval.instance); - - confirmDateValueError(new StringEval("non-date text")); - - // // EXCEL - confirmDateValue(new StringEval("8/22/2011"), 40777); // Serial number of a date entered as text. - confirmDateValue(new StringEval("22-MAY-2011"), 40685); // Serial number of a date entered as text. - confirmDateValue(new StringEval("2011/02/23"), 40597); // Serial number of a date entered as text. - - // LibreOffice compatibility - confirmDateValue(new StringEval("1954-07-20"), 19925); + LocaleUtil.setUserLocale(Locale.ENGLISH); + try { + confirmDateValue(new StringEval("2020-02-01"), 43862); + confirmDateValue(new StringEval("01-02-2020"), 43862); + confirmDateValue(new StringEval("2020-FEB-01"), 43862); + confirmDateValue(new StringEval("2020-Feb-01"), 43862); + confirmDateValue(new StringEval("2020-FEBRUARY-01"), 43862); + confirmDateValue(new StringEval("FEB-01"), 43862); + confirmDateValue(new StringEval("2/1/2020"), 43862); + confirmDateValue(new StringEval("2/1"), 43862); + confirmDateValue(new StringEval("2020/2/1"), 43862); + confirmDateValue(new StringEval("2020/FEB/1"), 43862); + confirmDateValue(new StringEval("FEB/1/2020"), 43862); + confirmDateValue(new StringEval("2020/02/01"), 43862); + + confirmDateValue(new StringEval("")); + confirmDateValue(BlankEval.instance); + + confirmDateValueError(new StringEval("non-date text")); + + // // EXCEL + confirmDateValue(new StringEval("8/22/2011"), 40777); // Serial number of a date entered as text. + confirmDateValue(new StringEval("22-MAY-2011"), 40685); // Serial number of a date entered as text. + confirmDateValue(new StringEval("2011/02/23"), 40597); // Serial number of a date entered as text. + + // LibreOffice compatibility + confirmDateValue(new StringEval("1954-07-20"), 19925); + } finally { + LocaleUtil.setUserLocale(null); + } } private ValueEval invokeDateValue(ValueEval text) { @@ -97,4 +102,4 @@ public final class TestDateValue { assertEquals(ErrorEval.class, result.getClass()); assertEquals(ErrorEval.VALUE_INVALID.getErrorCode(), ((ErrorEval) result).getErrorCode()); } -}
\ No newline at end of file +} |