diff options
author | Nick Burch <nick@apache.org> | 2011-12-20 07:20:44 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2011-12-20 07:20:44 +0000 |
commit | ca282069711d42202b47620c9f7907ec54c17d3b (patch) | |
tree | da35b1572e93f8c1ff05f4ee2e72353ead9cc0c7 /src/testcases/org/apache/poi | |
parent | b3709bbd36fb91e1680db0ac01c473e9502e8c45 (diff) | |
download | poi-ca282069711d42202b47620c9f7907ec54c17d3b.tar.gz poi-ca282069711d42202b47620c9f7907ec54c17d3b.zip |
Inspired by bug #52349 - Merge the logic between the TEXT function and DataFormatter
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1221126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java | 12 |
1 files changed, 12 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 c54829ffa6..e11ab2d60f 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java +++ b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java @@ -162,6 +162,18 @@ public class TestDataFormatter extends TestCase { } /** + * Test that we correctly handle fractions in the + * format string, eg # #/# + */ + public void testFractions() { + DataFormatter dfUS = new DataFormatter(Locale.US); + + assertEquals("321 1/3", dfUS.formatRawCellContents(321.321, -1, "# #/#")); + assertEquals("321 26/81", dfUS.formatRawCellContents(321.321, -1, "# #/##")); + assertEquals("26027/81", dfUS.formatRawCellContents(321.321, -1, "#/##")); + } + + /** * Test that _x (blank with the space taken by "x") * and *x (fill to the column width with "x"s) are * correctly ignored by us. |