poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r987256 - in /poi/trunk: src/documentation/content/xdocs/status.xml src/java/org/apache/poi/hssf/model/InternalWorkbook.java src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java test-data/spreadsheet/49751.xls
Date Thu, 19 Aug 2010 18:08:55 GMT
Author: yegor
Date: Thu Aug 19 18:08:54 2010
New Revision: 987256

URL: http://svn.apache.org/viewvc?rev=987256&view=rev
Log:
fixed fetching names of user defined styles, see Bugzila 49751

Added:
    poi/trunk/test-data/spreadsheet/49751.xls   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=987256&r1=987255&r2=987256&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Thu Aug 19 18:08:54 2010
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-beta3" date="2010-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">49751 - fixed fetching names of
user defined styles in HSSFCellStyle.getUserStyleName()</action>
            <action dev="POI-DEVELOPERS" type="add">48900 - support for protecting a
XSSF workbook</action>
            <action dev="POI-DEVELOPERS" type="fix">49725 - fixed FormulaParser to correctly
process defined names with underscore</action>
            <action dev="POI-DEVELOPERS" type="add">48526 - added implementation for
RANDBETWEEN()</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java?rev=987256&r1=987255&r2=987256&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java Thu Aug 19 18:08:54
2010
@@ -871,7 +871,7 @@ public final class InternalWorkbook {
                 continue;
             }
             if(!(r instanceof StyleRecord)) {
-                return null;
+                continue;
             }
             StyleRecord sr = (StyleRecord)r;
             if(sr.getXFIndex() == xfIndex) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=987256&r1=987255&r2=987256&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Thu Aug 19 18:08:54
2010
@@ -22,9 +22,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 import junit.framework.AssertionFailedError;
 
@@ -1837,4 +1835,28 @@ if(1==2) {
        assertEquals("Testing 2", wb.getCellStyleAt((short)22).getUserStyleName());
        assertEquals("Testing 3", wb.getCellStyleAt((short)23).getUserStyleName());
     }
+
+    public void test49751() {
+        HSSFWorkbook wb = openSample("49751.xls");
+        short numCellStyles = wb.getNumCellStyles();
+        List<String> namedStyles = Arrays.asList(
+                "20% - Accent1", "20% - Accent2", "20% - Accent3", "20% - Accent4", "20%
- Accent5",
+                "20% - Accent6", "40% - Accent1", "40% - Accent2", "40% - Accent3", "40%
- Accent4", 
+                "40% - Accent5", "40% - Accent6", "60% - Accent1", "60% - Accent2", "60%
- Accent3",
+                "60% - Accent4", "60% - Accent5", "60% - Accent6", "Accent1", "Accent2",
"Accent3",
+                "Accent4", "Accent5", "Accent6", "Bad", "Calculation", "Check Cell", "Explanatory
Text",
+                "Good", "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Input", "Linked
Cell",
+                "Neutral", "Note", "Output", "Title", "Total", "Warning Text");
+
+        List<String> collecteddStyles = new ArrayList<String>();
+        for (short i = 0; i < numCellStyles; i++) {
+            HSSFCellStyle cellStyle = wb.getCellStyleAt(i);
+            String styleName = cellStyle.getUserStyleName();
+            if (styleName != null) {
+                collecteddStyles.add(styleName);
+            }
+        }
+        assertTrue(namedStyles.containsAll(collecteddStyles));
+
+    }    
 }

Added: poi/trunk/test-data/spreadsheet/49751.xls
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/49751.xls?rev=987256&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/49751.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



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


Mime
View raw message