From 42053fcf71e262282ecb1dc264053770eba2da6c Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 13 Sep 2015 19:05:28 +0000 Subject: [PATCH] Verify that bug 55406 can be closed WORKSFORME git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1702800 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/TestXSSFBugs.java | 27 ++++++++++++++++++ .../55406_Conditional_formatting_sample.xlsx | Bin 0 -> 12646 bytes 2 files changed, 27 insertions(+) create mode 100644 test-data/spreadsheet/55406_Conditional_formatting_sample.xlsx diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index d6f573c1c..c7a5486cc 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -81,6 +81,7 @@ import org.apache.poi.ss.usermodel.Name; import org.apache.poi.ss.usermodel.PrintSetup; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.SheetConditionalFormatting; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.ss.util.AreaReference; @@ -2783,4 +2784,30 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { wb.close(); } + + @Test + public void test55406() { + Workbook wb = XSSFTestDataSamples.openSampleWorkbook("55406_Conditional_formatting_sample.xlsx"); + Sheet sheet = wb.getSheetAt(0); + Cell cellA1 = sheet.getRow(0).getCell(0); + Cell cellA2 = sheet.getRow(1).getCell(0); + + assertEquals(0, cellA1.getCellStyle().getFillForegroundColor()); + assertEquals("FFFDFDFD", ((XSSFColor)cellA1.getCellStyle().getFillForegroundColorColor()).getARGBHex()); + assertEquals(0, cellA2.getCellStyle().getFillForegroundColor()); + assertEquals("FFFDFDFD", ((XSSFColor)cellA2.getCellStyle().getFillForegroundColorColor()).getARGBHex()); + + SheetConditionalFormatting cond = sheet.getSheetConditionalFormatting(); + assertEquals(2, cond.getNumConditionalFormattings()); + + assertEquals(1, cond.getConditionalFormattingAt(0).getNumberOfRules()); + assertEquals(64, cond.getConditionalFormattingAt(0).getRule(0).getPatternFormatting().getFillForegroundColor()); + assertEquals("ISEVEN(ROW())", cond.getConditionalFormattingAt(0).getRule(0).getFormula1()); + assertNull(((XSSFColor)cond.getConditionalFormattingAt(0).getRule(0).getPatternFormatting().getFillForegroundColorColor()).getARGBHex()); + + assertEquals(1, cond.getConditionalFormattingAt(1).getNumberOfRules()); + assertEquals(64, cond.getConditionalFormattingAt(1).getRule(0).getPatternFormatting().getFillForegroundColor()); + assertEquals("ISEVEN(ROW())", cond.getConditionalFormattingAt(1).getRule(0).getFormula1()); + assertNull(((XSSFColor)cond.getConditionalFormattingAt(1).getRule(0).getPatternFormatting().getFillForegroundColorColor()).getARGBHex()); + } } diff --git a/test-data/spreadsheet/55406_Conditional_formatting_sample.xlsx b/test-data/spreadsheet/55406_Conditional_formatting_sample.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..dc3e96d62846c525a6d6cecbd876006b0750c552 GIT binary patch literal 12646 zcmeHt1ymf%7A=Gz86ZG{C0GPaaCd^cI|K+0!F6x~12b5F;I6@fOMoyq!9s9%hhQ0C zaQ#EB8aZ5as{7{RcmRq8NGGR%YD5 z<5&+!*YqFHeB1fpO!Yt|q*(c)&pt43S2O;kBHiTT zM_GF%_-#gySnXrSJ9=gJSUkI7;^6lw8e@F4?PyAJ9pjqWlhjCNMXp*QU|N2uV0Dz@ z)>d?Te%14dXG`PU@xtnu9O&+R#53Jr_-;w^xR4w1d-&@xFqrmRUDZ<=e(EBx*{aJ| z$;T}!z-P(dHd__eyB#Xf8awRid>UT#%9ORU<97WdRsG(eSoY)O4^pKcOz(cG-tXyb z&pQsyqJY0hDz#GeI~uK6y-&+5ru2{m>9x(fjx6<#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