aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2015-11-04 18:23:17 +0000
committerNick Burch <nick@apache.org>2015-11-04 18:23:17 +0000
commitd1ea6125fa915719d4515837d0f54c46bb7cdad9 (patch)
treee64e3b921edf1bdfeb068716f588591db3a6f02b /src/testcases/org/apache
parent3febf6600a6a221bda2255b68e3d36ba0fa3bea7 (diff)
downloadpoi-d1ea6125fa915719d4515837d0f54c46bb7cdad9.tar.gz
poi-d1ea6125fa915719d4515837d0f54c46bb7cdad9.zip
Bug #55265 - DataFormatter correct support for alternate number grouping characters, eg 1234 + #'##0 = 1'234 not 1,234
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1712605 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
index 0fd26ed7c1..03a3631a37 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
@@ -165,4 +165,40 @@ public abstract class BaseTestDataFormat extends TestCase {
// TODO Fix this to not have an extra 0 at the end
//assertEquals(pound+" - ", formatter.formatCellValue(zero));
}
+
+ /**
+ * Using a single quote (') instead of a comma (,) as
+ * a number separator, eg 1000 -> 1'000
+ */
+ public final void test55265() {
+ Workbook wb = _testDataProvider.createWorkbook();
+ DataFormatter formatter = new DataFormatter();
+ DataFormat fmt = wb.createDataFormat();
+ Sheet sheet = wb.createSheet();
+ Row r = sheet.createRow(0);
+
+ CellStyle cs = wb.createCellStyle();
+ cs.setDataFormat(fmt.getFormat("#'##0"));
+
+ Cell zero = r.createCell(0);
+ zero.setCellValue(0);
+ zero.setCellStyle(cs);
+
+ Cell sml = r.createCell(1);
+ sml.setCellValue(12);
+ sml.setCellStyle(cs);
+
+ Cell med = r.createCell(2);
+ med.setCellValue(1234);
+ med.setCellStyle(cs);
+
+ Cell lge = r.createCell(3);
+ lge.setCellValue(12345678);
+ lge.setCellStyle(cs);
+
+ assertEquals("0", formatter.formatCellValue(zero));
+ assertEquals("12", formatter.formatCellValue(sml));
+ assertEquals("1'234", formatter.formatCellValue(med));
+ assertEquals("12'345'678", formatter.formatCellValue(lge));
+ }
}