poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r951446 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
Date Fri, 04 Jun 2010 15:33:47 GMT
Author: nick
Date: Fri Jun  4 15:33:47 2010
New Revision: 951446

URL: http://svn.apache.org/viewvc?rev=951446&view=rev
Log:
Add unit test to verify that bug #47490 no longer exists

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=951446&r1=951445&r2=951446&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Fri Jun
 4 15:33:47 2010
@@ -26,6 +26,7 @@ import org.apache.poi.openxml4j.opc.Pack
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
 import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.usermodel.Font;
 import org.apache.poi.ss.usermodel.Name;
 import org.apache.poi.ss.usermodel.Row;
@@ -297,4 +298,36 @@ public final class TestXSSFBugs extends 
           assertEquals(startingFonts+3, wb.getNumberOfFonts());
        }
     }
+    
+    /**
+     * Ensure General and @ format are working properly
+     *  for integers 
+     */
+    public void test47490() throws Exception {
+       XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("GeneralFormatTests.xlsx");
+       Sheet s = wb.getSheetAt(1);
+       Row r;
+       DataFormatter df = new DataFormatter();
+       
+       r = s.getRow(1);
+       assertEquals(1.0, r.getCell(2).getNumericCellValue());
+       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
+       assertEquals("1", df.formatCellValue(r.getCell(2)));
+       assertEquals("1", df.formatRawCellContents(1.0, -1, "@"));
+       assertEquals("1", df.formatRawCellContents(1.0, -1, "General"));
+              
+       r = s.getRow(2);
+       assertEquals(12.0, r.getCell(2).getNumericCellValue());
+       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
+       assertEquals("12", df.formatCellValue(r.getCell(2)));
+       assertEquals("12", df.formatRawCellContents(12.0, -1, "@"));
+       assertEquals("12", df.formatRawCellContents(12.0, -1, "General"));
+       
+       r = s.getRow(3);
+       assertEquals(123.0, r.getCell(2).getNumericCellValue());
+       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
+       assertEquals("123", df.formatCellValue(r.getCell(2)));
+       assertEquals("123", df.formatRawCellContents(123.0, -1, "@"));
+       assertEquals("123", df.formatRawCellContents(123.0, -1, "General"));
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message