]> source.dussan.org Git - poi.git/commitdiff
add failing unit test for bug 55076: collapsing column groups only hides the first...
authorJaven O'Neal <onealj@apache.org>
Thu, 22 Sep 2016 04:24:22 +0000 (04:24 +0000)
committerJaven O'Neal <onealj@apache.org>
Thu, 22 Sep 2016 04:24:22 +0000 (04:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761846 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index e695f385f9babe1498f0ebaca3a01e94bdb4e26a..fea0262c41e554365089cd10e2247aa437ced7c5 100644 (file)
@@ -3091,4 +3091,35 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
 
         assertEquals("09 Mar 2016", result);
     }
+    
+    // This bug is currently open. When this bug is fixed, it should not throw an AssertionError
+    @Test(expected=AssertionError.class)
+    public void test55076_collapseColumnGroups() throws Exception {
+        Workbook wb = new XSSFWorkbook();
+        Sheet sheet = wb.createSheet();
+        
+        // this column collapsing bug only occurs when the grouped columns are different widths
+        sheet.setColumnWidth(1, 400);
+        sheet.setColumnWidth(2, 600);
+        sheet.setColumnWidth(3, 800);
+        
+        assertEquals(400, sheet.getColumnWidth(1));
+        assertEquals(600, sheet.getColumnWidth(2));
+        assertEquals(800, sheet.getColumnWidth(3));
+        
+        sheet.groupColumn(1, 3);
+        sheet.setColumnGroupCollapsed(1, true);
+        
+        assertEquals(400, sheet.getColumnWidth(1));
+        assertEquals(600, sheet.getColumnWidth(2));
+        assertEquals(800, sheet.getColumnWidth(3));
+        
+        // none of the columns should be hidden
+        // column group collapsing is a different concept
+        for (int c=0; c<5; c++) {
+            assertFalse("Column " + c, sheet.isColumnHidden(c));
+        }
+        
+        wb.close();
+    }
 }