aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2010-01-26 16:21:17 +0000
committerNick Burch <nick@apache.org>2010-01-26 16:21:17 +0000
commit421505b715aa490fe7363504aea75f23694e32f4 (patch)
tree5dd56d00e42d94611b4584d9827510afe5d3abb1 /src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
parent63dc16b762dc4184dcf410525216b36987e8087d (diff)
downloadpoi-421505b715aa490fe7363504aea75f23694e32f4.tar.gz
poi-421505b715aa490fe7363504aea75f23694e32f4.zip
Add patch from Jukka from bug #48617 + test - Optionally allow the overriding of the Locale used by DataFormatter to control how the default number and date formats should look
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@903303 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java43
1 files changed, 43 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
new file mode 100644
index 0000000000..73c15e8c44
--- /dev/null
+++ b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
@@ -0,0 +1,43 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.ss.usermodel;
+
+import java.util.Locale;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests of {@link DataFormatter}
+ *
+ */
+public class TestDataFormatter extends TestCase {
+ /**
+ * Test that we use the specified locale when deciding
+ * how to format normal numbers
+ */
+ public void testLocale() {
+ DataFormatter dfUS = new DataFormatter(Locale.US);
+ DataFormatter dfFR = new DataFormatter(Locale.FRENCH);
+
+ assertEquals("1234", dfUS.formatRawCellContents(1234, -1, "@"));
+ assertEquals("1234", dfFR.formatRawCellContents(1234, -1, "@"));
+
+ assertEquals("12.34", dfUS.formatRawCellContents(12.34, -1, "@"));
+ assertEquals("12,34", dfFR.formatRawCellContents(12.34, -1, "@"));
+ }
+}