aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2024-07-01 23:45:40 +0000
committerPJ Fanning <fanningpj@apache.org>2024-07-01 23:45:40 +0000
commit648a2e58b079840f42dfc2ed521b7695d4d196d4 (patch)
treed40db691f096a26f2952b53aeb5b7411ce7f2270
parent96fa957ef57c8c506730155c9e43d86e11feb059 (diff)
downloadpoi-648a2e58b079840f42dfc2ed521b7695d4d196d4.tar.gz
poi-648a2e58b079840f42dfc2ed521b7695d4d196d4.zip
add dataformatter tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918807 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/test/java/org/apache/poi/ss/usermodel/TestDataFormatter.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/TestDataFormatter.java b/poi/src/test/java/org/apache/poi/ss/usermodel/TestDataFormatter.java
index 8da7e05033..4ef5762ff3 100644
--- a/poi/src/test/java/org/apache/poi/ss/usermodel/TestDataFormatter.java
+++ b/poi/src/test/java/org/apache/poi/ss/usermodel/TestDataFormatter.java
@@ -110,6 +110,20 @@ class TestDataFormatter {
assertFalse(dataFormatter.useCachedValuesForFormulaCells());
}
+ @Test
+ void testDouble() {
+ DataFormatter dfUS = new DataFormatter(Locale.US);
+ assertEquals("1.005", dfUS.formatRawCellContents(1.005d, -1, "@"));
+ assertEquals("-1.005", dfUS.formatRawCellContents(-1.005d, -1, "@"));
+ }
+
+ @Test
+ void testFloat() {
+ DataFormatter dfUS = new DataFormatter(Locale.US);
+ assertEquals("1.005", dfUS.formatRawCellContents(1.005f, -1, "@"));
+ assertEquals("-1.005", dfUS.formatRawCellContents(-1.005f, -1, "@"));
+ }
+
/**
* Test that we use the specified locale when deciding
* how to format normal numbers
@@ -142,7 +156,6 @@ class TestDataFormatter {
// Regular numeric style formats
assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]##"));
assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]00"));
-
}