From 257e6197ca24fba97c5fe8e7637ab1278b9b59e8 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Thu, 22 Sep 2016 04:24:22 +0000 Subject: [PATCH] add failing unit test for bug 55076: collapsing column groups only hides the first column git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761846 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/TestXSSFBugs.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) 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 e695f385f..fea0262c4 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -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(); + } }