aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"));
-
}