diff options
author | Nick Burch <nick@apache.org> | 2011-12-28 05:16:36 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2011-12-28 05:16:36 +0000 |
commit | 11602850730af2d8d4039ff9f900cf4974d71dbc (patch) | |
tree | 88ae41aa421b0b7401f30b00d262e4d563ce9ac6 /src | |
parent | 05bfb7c0c95e5c0634d79f5fdfd3b93afc090c1d (diff) | |
download | poi-11602850730af2d8d4039ff9f900cf4974d71dbc.tar.gz poi-11602850730af2d8d4039ff9f900cf4974d71dbc.zip |
Add AM/PM DataFormatter tests for bug #52389 (already working properly)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1225095 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java index 874725aad2..c8c4cdbe6f 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java +++ b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java @@ -246,6 +246,22 @@ public class TestDataFormatter extends TestCase { } /** + * Tests that we do AM/PM handling properly + */ + public void testAMPM() { + DataFormatter dfUS = new DataFormatter(Locale.US); + + assertEquals("06:00", dfUS.formatRawCellContents(0.25, -1, "hh:mm")); + assertEquals("18:00", dfUS.formatRawCellContents(0.75, -1, "hh:mm")); + + assertEquals("06:00 AM", dfUS.formatRawCellContents(0.25, -1, "hh:mm AM/PM")); + assertEquals("06:00 PM", dfUS.formatRawCellContents(0.75, -1, "hh:mm AM/PM")); + + assertEquals("1904-01-01 06:00:00 AM", dfUS.formatRawCellContents(0.25, -1, "yyyy-mm-dd hh:mm:ss AM/PM", true)); + assertEquals("1904-01-01 06:00:00 PM", dfUS.formatRawCellContents(0.75, -1, "yyyy-mm-dd hh:mm:ss AM/PM", true)); + } + + /** * Test that we can handle elapsed time, * eg formatting 1 day 4 hours as 28 hours */ |