]> source.dussan.org Git - poi.git/commitdiff
Test that shows that bug #51222 is a themes colour problem
authorNick Burch <nick@apache.org>
Fri, 20 May 2011 20:46:55 +0000 (20:46 +0000)
committerNick Burch <nick@apache.org>
Fri, 20 May 2011 20:46:55 +0000 (20:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1125559 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
test-data/spreadsheet/51222.xlsx [new file with mode: 0644]

index fca1643653f0508130b5f0089ded36809f26631c..05365a8dba0a16b3ee74b5b8059add9bae41287e 100644 (file)
@@ -1173,4 +1173,45 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
        // Complex file
        // TODO
     }
+    
+    /**
+     * Colours and styles when the list has gaps in it 
+     */
+    public void test51222() throws Exception {
+       XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("51222.xlsx");
+       XSSFSheet s = wb.getSheetAt(0);
+       
+       XSSFCell cA4_EEECE1 = s.getRow(3).getCell(0);
+       XSSFCell cA5_1F497D = s.getRow(4).getCell(0);
+       
+       // Check the text
+       assertEquals("A4", cA4_EEECE1.getRichStringCellValue().getString());
+       assertEquals("A5", cA5_1F497D.getRichStringCellValue().getString());
+       
+       // Check the styles assigned to them
+       assertEquals(4, cA4_EEECE1.getCTCell().getS());
+       assertEquals(5, cA5_1F497D.getCTCell().getS());
+       
+       // Check we look up the correct style
+       assertEquals(4, cA4_EEECE1.getCellStyle().getIndex());
+       assertEquals(5, cA5_1F497D.getCellStyle().getIndex());
+       
+       // Check the fills on them at the low level
+       assertEquals(5, cA4_EEECE1.getCellStyle().getCoreXf().getFillId());
+       assertEquals(6, cA5_1F497D.getCellStyle().getCoreXf().getFillId());
+
+       // These should reference themes 2 and 3
+       assertEquals(2, wb.getStylesSource().getFillAt(5).getCTFill().getPatternFill().getFgColor().getTheme());
+       assertEquals(3, wb.getStylesSource().getFillAt(6).getCTFill().getPatternFill().getFgColor().getTheme());
+       
+       // Ensure we get the right colours for these themes
+       // TODO fix
+//       assertEquals("FFEEECE1", wb.getTheme().getThemeColor(2).getARGBHex());
+//       assertEquals("FF1F497D", wb.getTheme().getThemeColor(3).getARGBHex());
+       
+       // Finally check the colours on the styles
+       // TODO fix
+//       assertEquals("FFEEECE1", cA4_EEECE1.getCellStyle().getFillForegroundXSSFColor().getARGBHex());
+//       assertEquals("FF1F497D", cA5_1F497D.getCellStyle().getFillForegroundXSSFColor().getARGBHex());
+    }
 }
diff --git a/test-data/spreadsheet/51222.xlsx b/test-data/spreadsheet/51222.xlsx
new file mode 100644 (file)
index 0000000..562154c
Binary files /dev/null and b/test-data/spreadsheet/51222.xlsx differ