You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2015/09/03 22:46:32 UTC

svn commit: r1701135 - in /poi/trunk/src: java/org/apache/poi/ss/usermodel/CellStyle.java testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java

Author: centic
Date: Thu Sep  3 20:46:32 2015
New Revision: 1701135

URL: http://svn.apache.org/r1701135
Log:
Bug 56959: Add verification unit test to show that the bug cannot be reproduced

Modified:
    poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java?rev=1701135&r1=1701134&r2=1701135&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java Thu Sep  3 20:46:32 2015
@@ -254,7 +254,7 @@ public interface CellStyle {
 
     /**
      * set the font for this style
-     * @param font  a font object created or retreived from the Workbook object
+     * @param font  a font object created or retrieved from the Workbook object
      * @see Workbook#createFont()
      * @see Workbook#getFontAt(short)
      */

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java?rev=1701135&r1=1701134&r2=1701135&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java Thu Sep  3 20:46:32 2015
@@ -28,6 +28,7 @@ import junit.framework.TestCase;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Font;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -127,7 +128,7 @@ public final class TestCellStyle extends
         assertEquals("FIRST ROW ", 0, s.getFirstRowNum());
     }
     
-    public void testHashEquals() {
+    public void testHashEquals() throws IOException {
         HSSFWorkbook     wb   = new HSSFWorkbook();
         HSSFSheet        s    = wb.createSheet();
         HSSFCellStyle    cs1  = wb.createCellStyle();
@@ -154,6 +155,8 @@ public final class TestCellStyle extends
         int hash1 = cs1.hashCode();
         cs1.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/dd/yy"));
         assertFalse(hash1 == cs1.hashCode());
+        
+        wb.close();
     }
 
     /**
@@ -467,4 +470,43 @@ public final class TestCellStyle extends
             throw threadB.getException();
         }
     }
+    
+    public void test56959() throws IOException {
+        Workbook wb = new HSSFWorkbook();
+        Sheet sheet = wb.createSheet("somesheet");
+        
+        Row row = sheet.createRow(0);
+        
+        // Create a new font and alter it.
+        Font font = wb.createFont();
+        font.setFontHeightInPoints((short)24);
+        font.setFontName("Courier New");
+        font.setItalic(true);
+        font.setStrikeout(true);
+        font.setColor(Font.COLOR_RED);
+        
+        CellStyle style = wb.createCellStyle();
+        style.setBorderBottom(CellStyle.BORDER_DOTTED);
+        style.setFont(font);
+        
+        Cell cell = row.createCell(0);
+        cell.setCellStyle(style);
+        cell.setCellValue("testtext");
+        
+        Cell newCell = row.createCell(1);
+        
+        newCell.setCellStyle(style);
+        newCell.setCellValue("2testtext2");
+
+        CellStyle newStyle = newCell.getCellStyle();
+        assertEquals(CellStyle.BORDER_DOTTED, newStyle.getBorderBottom());
+        assertEquals(Font.COLOR_RED, ((HSSFCellStyle)newStyle).getFont(wb).getColor());
+        
+//        OutputStream out = new FileOutputStream("/tmp/56959.xls");
+//        try {
+//            wb.write(out);
+//        } finally {
+//            out.close();
+//        }
+    }
 }



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