refactor duplicated code in TestXSSFSheet#setColumnGroupCollapsed; remove unnecessary int to short casts
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1777052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
97ea611e6e
commit
b8e9fcef73
@ -451,186 +451,90 @@ public final class TestXSSFSheet extends BaseTestXSheet {
|
|||||||
CTCols cols = sheet1.getCTWorksheet().getColsArray(0);
|
CTCols cols = sheet1.getCTWorksheet().getColsArray(0);
|
||||||
assertEquals(0, cols.sizeOfColArray());
|
assertEquals(0, cols.sizeOfColArray());
|
||||||
|
|
||||||
sheet1.groupColumn( (short)4, (short)7 );
|
sheet1.groupColumn( 4, 7 );
|
||||||
sheet1.groupColumn( (short)9, (short)12 );
|
|
||||||
|
assertEquals(1, cols.sizeOfColArray());
|
||||||
|
checkColumnGroup(cols.getColArray(0), 4, 7); // false, true
|
||||||
|
|
||||||
|
sheet1.groupColumn( 9, 12 );
|
||||||
|
|
||||||
assertEquals(2, cols.sizeOfColArray());
|
assertEquals(2, cols.sizeOfColArray());
|
||||||
|
checkColumnGroup(cols.getColArray(0), 4, 7); // false, true
|
||||||
|
checkColumnGroup(cols.getColArray(1), 9, 12); // false, true
|
||||||
|
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
sheet1.groupColumn( 10, 11 );
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(1).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(1).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
|
|
||||||
sheet1.groupColumn( (short)10, (short)11 );
|
|
||||||
assertEquals(4, cols.sizeOfColArray());
|
assertEquals(4, cols.sizeOfColArray());
|
||||||
|
checkColumnGroup(cols.getColArray(0), 4, 7); // false, true
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
checkColumnGroup(cols.getColArray(1), 9, 9); // false, true
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(2), 10, 11); // false, true
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(3), 12, 12); // false, true
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(1).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(1).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
|
|
||||||
// collapse columns - 1
|
// collapse columns - 1
|
||||||
sheet1.setColumnGroupCollapsed( (short)5, true );
|
sheet1.setColumnGroupCollapsed( 5, true );
|
||||||
assertEquals(5,cols.sizeOfColArray());
|
|
||||||
|
|
||||||
assertTrue(cols.getColArray(0).isSetHidden());
|
// FIXME: we grew a column?
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
assertEquals(5, cols.sizeOfColArray());
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroupIsCollapsed(cols.getColArray(0), 4, 7); // true, true
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
checkColumnGroup(cols.getColArray(1), 8, 8); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
checkColumnGroup(cols.getColArray(2), 9, 9); // false, true
|
||||||
assertTrue(cols.getColArray(1).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(3), 10, 11); // false, true
|
||||||
assertEquals(9, cols.getColArray(1).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(4), 12, 12); // false, true
|
||||||
assertEquals(9, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(4).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(4).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(4).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(4).getMax()); // 1 based
|
|
||||||
|
|
||||||
|
|
||||||
// expand columns - 1
|
// expand columns - 1
|
||||||
sheet1.setColumnGroupCollapsed( (short)5, false );
|
sheet1.setColumnGroupCollapsed( 5, false );
|
||||||
|
assertEquals(5, cols.sizeOfColArray());
|
||||||
|
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
checkColumnGroupIsExpanded(cols.getColArray(0), 4, 7); // false, true
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(1), 8, 8, false, false);
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(2), 9, 9); // false, true
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
checkColumnGroup(cols.getColArray(3), 10, 11); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
checkColumnGroup(cols.getColArray(4), 12, 12); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetCollapsed());
|
|
||||||
assertEquals(9, cols.getColArray(1).getMin()); // 1 based
|
|
||||||
assertEquals(9, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(4).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(4).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(4).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(4).getMax()); // 1 based
|
|
||||||
|
|
||||||
|
|
||||||
//collapse - 2
|
//collapse - 2
|
||||||
sheet1.setColumnGroupCollapsed( (short)9, true );
|
sheet1.setColumnGroupCollapsed( 9, true );
|
||||||
|
// it grew again?
|
||||||
assertEquals(6, cols.sizeOfColArray());
|
assertEquals(6, cols.sizeOfColArray());
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
checkColumnGroup(cols.getColArray(0), 4, 7); // false, true
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(1), 8, 8, false, false);
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroupIsCollapsed(cols.getColArray(2), 9, 9); // true, true
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
checkColumnGroupIsCollapsed(cols.getColArray(3), 10, 11); // true, true
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
checkColumnGroupIsCollapsed(cols.getColArray(4), 12, 12); // true, true
|
||||||
assertFalse(cols.getColArray(1).isSetCollapsed());
|
// why was this column group added?
|
||||||
assertEquals(9, cols.getColArray(1).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(5), 13, 13); // false, true
|
||||||
assertEquals(9, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertTrue(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertTrue(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
assertTrue(cols.getColArray(4).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(4).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(4).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(4).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(5).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(5).isSetCollapsed());
|
|
||||||
assertEquals(14, cols.getColArray(5).getMin()); // 1 based
|
|
||||||
assertEquals(14, cols.getColArray(5).getMax()); // 1 based
|
|
||||||
|
|
||||||
|
|
||||||
//expand - 2
|
//expand - 2
|
||||||
sheet1.setColumnGroupCollapsed( (short)9, false );
|
sheet1.setColumnGroupCollapsed( 9, false );
|
||||||
assertEquals(6, cols.sizeOfColArray());
|
assertEquals(6, cols.sizeOfColArray());
|
||||||
assertEquals(14,cols.getColArray(5).getMin());
|
|
||||||
|
|
||||||
//outline level 2: the line under ==> collapsed==True
|
//outline level 2: the line under ==> collapsed==True
|
||||||
assertEquals(2, cols.getColArray(3).getOutlineLevel());
|
assertEquals(2, cols.getColArray(3).getOutlineLevel());
|
||||||
assertTrue(cols.getColArray(4).isSetCollapsed());
|
assertTrue(cols.getColArray(4).isSetCollapsed());
|
||||||
|
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
checkColumnGroup(cols.getColArray(0), 4, 7);
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(1), 8, 8, false, false);
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(2), 9, 9); // false, true
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
checkColumnGroupIsCollapsed(cols.getColArray(3), 10, 11); // true, true
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
checkColumnGroup(cols.getColArray(4), 12, 12); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(5), 13, 13, false, false);
|
||||||
assertEquals(9, cols.getColArray(1).getMin()); // 1 based
|
|
||||||
assertEquals(9, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertTrue(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(4).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(4).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(4).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(4).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(5).isSetHidden());
|
|
||||||
assertFalse(cols.getColArray(5).isSetCollapsed());
|
|
||||||
assertEquals(14, cols.getColArray(5).getMin()); // 1 based
|
|
||||||
assertEquals(14, cols.getColArray(5).getMax()); // 1 based
|
|
||||||
|
|
||||||
//DOCUMENTARE MEGLIO IL DISCORSO DEL LIVELLO
|
//DOCUMENTARE MEGLIO IL DISCORSO DEL LIVELLO
|
||||||
//collapse - 3
|
//collapse - 3
|
||||||
sheet1.setColumnGroupCollapsed( (short)10, true );
|
sheet1.setColumnGroupCollapsed( 10, true );
|
||||||
assertEquals(6, cols.sizeOfColArray());
|
assertEquals(6, cols.sizeOfColArray());
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
checkColumnGroup(cols.getColArray(0), 4, 7);
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(1), 8, 8, false, false);
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(2), 9, 9); // false, true
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
checkColumnGroupIsCollapsed(cols.getColArray(3), 10, 11); // true, true
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
checkColumnGroup(cols.getColArray(4), 12, 12); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(5), 13, 13, false, false);
|
||||||
assertEquals(9, cols.getColArray(1).getMin()); // 1 based
|
|
||||||
assertEquals(9, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertTrue(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(4).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(4).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(4).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(4).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(5).isSetHidden());
|
|
||||||
assertFalse(cols.getColArray(5).isSetCollapsed());
|
|
||||||
assertEquals(14, cols.getColArray(5).getMin()); // 1 based
|
|
||||||
assertEquals(14, cols.getColArray(5).getMax()); // 1 based
|
|
||||||
|
|
||||||
|
|
||||||
//expand - 3
|
//expand - 3
|
||||||
sheet1.setColumnGroupCollapsed( (short)10, false );
|
sheet1.setColumnGroupCollapsed( 10, false );
|
||||||
assertEquals(6, cols.sizeOfColArray());
|
assertEquals(6, cols.sizeOfColArray());
|
||||||
assertFalse(cols.getColArray(0).getHidden());
|
assertFalse(cols.getColArray(0).getHidden());
|
||||||
assertFalse(cols.getColArray(5).getHidden());
|
assertFalse(cols.getColArray(5).getHidden());
|
||||||
@ -641,36 +545,90 @@ public final class TestXSSFSheet extends BaseTestXSheet {
|
|||||||
XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1);
|
XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1);
|
||||||
wb1.close();
|
wb1.close();
|
||||||
sheet1 = wb2.getSheetAt(0);
|
sheet1 = wb2.getSheetAt(0);
|
||||||
assertEquals(6,cols.sizeOfColArray());
|
// FIXME: forgot to reassign!
|
||||||
|
//cols = sheet1.getCTWorksheet().getColsArray(0);
|
||||||
|
|
||||||
assertFalse(cols.getColArray(0).isSetHidden());
|
assertEquals(6, cols.sizeOfColArray());
|
||||||
assertTrue(cols.getColArray(0).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(0), 4, 7); // false, true
|
||||||
assertEquals(5, cols.getColArray(0).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(1), 8, 8, false, false);
|
||||||
assertEquals(8, cols.getColArray(0).getMax()); // 1 based
|
checkColumnGroup(cols.getColArray(2), 9, 9); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetHidden());
|
checkColumnGroup(cols.getColArray(3), 10, 11); // false, true
|
||||||
assertFalse(cols.getColArray(1).isSetCollapsed());
|
checkColumnGroup(cols.getColArray(4), 12, 12, false, false);
|
||||||
assertEquals(9, cols.getColArray(1).getMin()); // 1 based
|
checkColumnGroup(cols.getColArray(5), 13, 13, false, false);
|
||||||
assertEquals(9, cols.getColArray(1).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(2).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(2).isSetCollapsed());
|
|
||||||
assertEquals(10, cols.getColArray(2).getMin()); // 1 based
|
|
||||||
assertEquals(10, cols.getColArray(2).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(3).isSetHidden());
|
|
||||||
assertTrue(cols.getColArray(3).isSetCollapsed());
|
|
||||||
assertEquals(11, cols.getColArray(3).getMin()); // 1 based
|
|
||||||
assertEquals(12, cols.getColArray(3).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(4).isSetHidden());
|
|
||||||
assertFalse(cols.getColArray(4).isSetCollapsed());
|
|
||||||
assertEquals(13, cols.getColArray(4).getMin()); // 1 based
|
|
||||||
assertEquals(13, cols.getColArray(4).getMax()); // 1 based
|
|
||||||
assertFalse(cols.getColArray(5).isSetHidden());
|
|
||||||
assertFalse(cols.getColArray(5).isSetCollapsed());
|
|
||||||
assertEquals(14, cols.getColArray(5).getMin()); // 1 based
|
|
||||||
assertEquals(14, cols.getColArray(5).getMax()); // 1 based
|
|
||||||
|
|
||||||
wb2.close();
|
wb2.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that column groups were created correctly after Sheet.groupColumn
|
||||||
|
*
|
||||||
|
* @param col the column group xml bean
|
||||||
|
* @param fromColumnIndex 0-indexed
|
||||||
|
* @param toColumnIndex 0-indexed
|
||||||
|
*/
|
||||||
|
private static void checkColumnGroup(
|
||||||
|
CTCol col,
|
||||||
|
int fromColumnIndex, int toColumnIndex,
|
||||||
|
boolean isSetHidden, boolean isSetCollapsed
|
||||||
|
) {
|
||||||
|
assertEquals("from column index", fromColumnIndex, col.getMin() - 1); // 1 based
|
||||||
|
assertEquals("to column index", toColumnIndex, col.getMax() - 1); // 1 based
|
||||||
|
assertEquals("isSetHidden", isSetHidden, col.isSetHidden());
|
||||||
|
assertEquals("isSetCollapsed", isSetCollapsed, col.isSetCollapsed()); //not necessarily set
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that column groups were created correctly after Sheet.groupColumn
|
||||||
|
*
|
||||||
|
* @param col the column group xml bean
|
||||||
|
* @param fromColumnIndex 0-indexed
|
||||||
|
* @param toColumnIndex 0-indexed
|
||||||
|
*/
|
||||||
|
private static void checkColumnGroup(
|
||||||
|
CTCol col,
|
||||||
|
int fromColumnIndex, int toColumnIndex
|
||||||
|
) {
|
||||||
|
assertEquals("from column index", fromColumnIndex, col.getMin() - 1); // 1 based
|
||||||
|
assertEquals("to column index", toColumnIndex, col.getMax() - 1); // 1 based
|
||||||
|
assertFalse("isSetHidden", col.isSetHidden());
|
||||||
|
assertTrue("isSetCollapsed", col.isSetCollapsed()); //not necessarily set
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Verify that column groups were created correctly after Sheet.groupColumn
|
||||||
|
*
|
||||||
|
* @param col the column group xml bean
|
||||||
|
* @param fromColumnIndex 0-indexed
|
||||||
|
* @param toColumnIndex 0-indexed
|
||||||
|
*/
|
||||||
|
private static void checkColumnGroupIsCollapsed(
|
||||||
|
CTCol col,
|
||||||
|
int fromColumnIndex, int toColumnIndex
|
||||||
|
) {
|
||||||
|
assertEquals("from column index", fromColumnIndex, col.getMin() - 1); // 1 based
|
||||||
|
assertEquals("to column index", toColumnIndex, col.getMax() - 1); // 1 based
|
||||||
|
assertTrue("isSetHidden", col.isSetHidden());
|
||||||
|
assertTrue("isSetCollapsed", col.isSetCollapsed());
|
||||||
|
//assertTrue("getCollapsed", col.getCollapsed());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Verify that column groups were created correctly after Sheet.groupColumn
|
||||||
|
*
|
||||||
|
* @param col the column group xml bean
|
||||||
|
* @param fromColumnIndex 0-indexed
|
||||||
|
* @param toColumnIndex 0-indexed
|
||||||
|
*/
|
||||||
|
private static void checkColumnGroupIsExpanded(
|
||||||
|
CTCol col,
|
||||||
|
int fromColumnIndex, int toColumnIndex
|
||||||
|
) {
|
||||||
|
assertEquals("from column index", fromColumnIndex, col.getMin() - 1); // 1 based
|
||||||
|
assertEquals("to column index", toColumnIndex, col.getMax() - 1); // 1 based
|
||||||
|
assertFalse("isSetHidden", col.isSetHidden());
|
||||||
|
assertTrue("isSetCollapsed", col.isSetCollapsed());
|
||||||
|
//assertTrue("isSetCollapsed", !col.isSetCollapsed() || !col.getCollapsed());
|
||||||
|
//assertFalse("getCollapsed", col.getCollapsed());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO - while this is internally consistent, I'm not
|
* TODO - while this is internally consistent, I'm not
|
||||||
* completely clear in all cases what it's supposed to
|
* completely clear in all cases what it's supposed to
|
||||||
@ -1351,22 +1309,22 @@ public final class TestXSSFSheet extends BaseTestXSheet {
|
|||||||
XSSFWorkbook wb = new XSSFWorkbook();
|
XSSFWorkbook wb = new XSSFWorkbook();
|
||||||
XSSFSheet sheet = wb.createSheet();
|
XSSFSheet sheet = wb.createSheet();
|
||||||
|
|
||||||
Row row1 = sheet.createRow((short) 0);
|
Row row1 = sheet.createRow(0);
|
||||||
Cell cell = row1.createCell((short) 0);
|
Cell cell = row1.createCell(0);
|
||||||
cell.setCellValue("Names");
|
cell.setCellValue("Names");
|
||||||
Cell cell2 = row1.createCell((short) 1);
|
Cell cell2 = row1.createCell(1);
|
||||||
cell2.setCellValue("#");
|
cell2.setCellValue("#");
|
||||||
|
|
||||||
Row row2 = sheet.createRow((short) 1);
|
Row row2 = sheet.createRow(1);
|
||||||
Cell cell3 = row2.createCell((short) 0);
|
Cell cell3 = row2.createCell(0);
|
||||||
cell3.setCellValue("Jane");
|
cell3.setCellValue("Jane");
|
||||||
Cell cell4 = row2.createCell((short) 1);
|
Cell cell4 = row2.createCell(1);
|
||||||
cell4.setCellValue(3);
|
cell4.setCellValue(3);
|
||||||
|
|
||||||
Row row3 = sheet.createRow((short) 2);
|
Row row3 = sheet.createRow(2);
|
||||||
Cell cell5 = row3.createCell((short) 0);
|
Cell cell5 = row3.createCell(0);
|
||||||
cell5.setCellValue("John");
|
cell5.setCellValue("John");
|
||||||
Cell cell6 = row3.createCell((short) 1);
|
Cell cell6 = row3.createCell(1);
|
||||||
cell6.setCellValue(3);
|
cell6.setCellValue(3);
|
||||||
|
|
||||||
return wb;
|
return wb;
|
||||||
|
Loading…
Reference in New Issue
Block a user