You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2015/12/28 15:19:50 UTC
svn commit: r1721923 -
/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java
Author: onealj
Date: Mon Dec 28 14:19:50 2015
New Revision: 1721923
URL: http://svn.apache.org/viewvc?rev=1721923&view=rev
Log:
bug 58775: fix a>b which should be a>=b; use shorts instead of ints to hold number format index
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java?rev=1721923&r1=1721922&r2=1721923&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java Mon Dec 28 14:19:50 2015
@@ -38,17 +38,20 @@ public final class TestXSSFDataFormat ex
public void test49928() {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49928.xlsx");
doTest49928Core(wb);
+
+ DataFormat dataFormat = wb.createDataFormat();
- // an attempt to register an existing format returns its index
- int poundFmtIdx = wb.getSheetAt(0).getRow(0).getCell(0).getCellStyle().getDataFormat();
- assertEquals(poundFmtIdx, wb.getStylesSource().putNumberFormat(poundFmt));
+ // As of 2015-12-27, there is no way to override a built-in number format with POI XSSFWorkbook
+ // 49928.xlsx has been saved with a poundFmt that overrides the default value (dollar)
+ short poundFmtIdx = wb.getSheetAt(0).getRow(0).getCell(0).getCellStyle().getDataFormat();
+ assertEquals(poundFmtIdx, dataFormat.getFormat(poundFmt));
// now create a custom format with Pound (\u00a3)
- DataFormat dataFormat = wb.createDataFormat();
+
String customFmt = "\u00a3##.00[Yellow]";
assertNotBuiltInFormat(customFmt);
short customFmtIdx = dataFormat.getFormat(customFmt);
- assertTrue(customFmtIdx > BuiltinFormats.FIRST_USER_DEFINED_FORMAT_INDEX );
+ assertTrue(customFmtIdx >= BuiltinFormats.FIRST_USER_DEFINED_FORMAT_INDEX);
assertEquals(customFmt, dataFormat.getFormat(customFmtIdx));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org