poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1753359 - /poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
Date Tue, 19 Jul 2016 10:08:50 GMT
Author: onealj
Date: Tue Jul 19 10:08:50 2016
New Revision: 1753359

URL: http://svn.apache.org/viewvc?rev=1753359&view=rev
Log:
add test case for bug 53564

Modified:
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

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=1753359&r1=1753358&r2=1753359&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 Tue Jul 19 10:08:50
2016
@@ -74,6 +74,7 @@ import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
+import org.apache.poi.ss.usermodel.ComparisonOperator;
 import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.usermodel.FormulaEvaluator;
 import org.apache.poi.ss.usermodel.Name;
@@ -3036,4 +3037,48 @@ public final class TestBugs extends Base
         cmo = (CommonObjectDataSubRecord)shape.getObjRecord().getSubRecords().get(0);
         assertEquals(1027, cmo.getObjectId());
     }
+    
+    // As of POI 3.15 beta 2, LibreOffice does not display the diagonal border while it does
display the bottom border
+    // I have not checked Excel to know if this is a LibreOffice or a POI problem.
+    @Test
+    public void test53564() throws IOException {
+        HSSFWorkbook wb = new HSSFWorkbook();
+        HSSFSheet sheet = wb.createSheet("Page 1");
+        final short BLUE = 30;
+        
+        HSSFSheetConditionalFormatting scf = sheet.getSheetConditionalFormatting();
+        HSSFConditionalFormattingRule rule = scf.createConditionalFormattingRule(ComparisonOperator.GT,
"10");
+        
+        HSSFBorderFormatting bord = rule.createBorderFormatting();
+        bord.setBorderDiagonal(BorderStyle.THICK);
+        assertEquals(BorderStyle.THICK, bord.getBorderDiagonal());
+
+        bord.setBackwardDiagonalOn(true);
+        assertTrue(bord.isBackwardDiagonalOn());
+
+        bord.setForwardDiagonalOn(true);
+        assertTrue(bord.isForwardDiagonalOn());
+        
+        bord.setDiagonalBorderColor(BLUE);
+        assertEquals(BLUE, bord.getDiagonalBorderColor());
+
+        // Create the bottom border style so we know what a border is supposed to look like
+        bord.setBorderBottom(BorderStyle.THICK);
+        assertEquals(BorderStyle.THICK, bord.getBorderBottom());
+        bord.setBottomBorderColor(BLUE);
+        assertEquals(BLUE, bord.getBottomBorderColor());
+        
+        CellRangeAddress[] A2_D4 = {new CellRangeAddress(1, 3, 0, 3)};
+        scf.addConditionalFormatting(A2_D4, rule);
+        
+        // Set a cell value within the conditional formatting range whose rule would resolve
to True.
+        Cell C3 = sheet.createRow(2).createCell(2);
+        C3.setCellValue(30.0);
+        
+        // Manually check the output file with Excel to see if the diagonal border is present
+        //OutputStream fos = new FileOutputStream("/tmp/53564.xls");
+        //wb.write(fos);
+        //fos.close();
+        wb.close();
+    }
 }



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


Mime
View raw message