Minor clean-up in TestXSSFSheet
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@893899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c3fcf7a3c
commit
a74769efcd
@ -32,8 +32,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class TestXSSFSheet extends BaseTestSheet {
|
||||
|
||||
@ -194,7 +192,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
|
||||
XSSFComment comment = sheet.createComment();
|
||||
|
||||
Cell cell = sheet.createRow(0).createCell((short) 0);
|
||||
Cell cell = sheet.createRow(0).createCell(0);
|
||||
CommentsTable comments = sheet.getCommentsTable(false);
|
||||
CTComments ctComments = comments.getCTComments();
|
||||
|
||||
@ -279,7 +277,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
XSSFCellStyle cellStyle = new XSSFCellStyle(1, 1, stylesTable);
|
||||
assertEquals(1, cellStyle.getFontIndex());
|
||||
|
||||
sheet.setDefaultColumnStyle((short) 3, cellStyle);
|
||||
sheet.setDefaultColumnStyle(3, cellStyle);
|
||||
assertEquals(1, ctWorksheet.getColsArray(0).getColArray(0).getStyle());
|
||||
}
|
||||
|
||||
@ -289,8 +287,8 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
XSSFSheet sheet = workbook.createSheet();
|
||||
|
||||
//one level
|
||||
sheet.groupColumn((short) 2, (short) 7);
|
||||
sheet.groupColumn((short) 10, (short) 11);
|
||||
sheet.groupColumn(2, 7);
|
||||
sheet.groupColumn(10, 11);
|
||||
CTCols cols = sheet.getCTWorksheet().getColsArray(0);
|
||||
assertEquals(2, cols.sizeOfColArray());
|
||||
CTCol[] colArray = cols.getColArray();
|
||||
@ -300,27 +298,27 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
assertEquals(1, colArray[0].getOutlineLevel());
|
||||
|
||||
//two level
|
||||
sheet.groupColumn((short) 1, (short) 2);
|
||||
sheet.groupColumn(1, 2);
|
||||
cols = sheet.getCTWorksheet().getColsArray(0);
|
||||
assertEquals(4, cols.sizeOfColArray());
|
||||
colArray = cols.getColArray();
|
||||
assertEquals(2, colArray[1].getOutlineLevel());
|
||||
|
||||
//three level
|
||||
sheet.groupColumn((short) 6, (short) 8);
|
||||
sheet.groupColumn((short) 2, (short) 3);
|
||||
sheet.groupColumn(6, 8);
|
||||
sheet.groupColumn(2, 3);
|
||||
cols = sheet.getCTWorksheet().getColsArray(0);
|
||||
assertEquals(7, cols.sizeOfColArray());
|
||||
colArray = cols.getColArray();
|
||||
assertEquals(3, colArray[1].getOutlineLevel());
|
||||
assertEquals(3, sheet.getCTWorksheet().getSheetFormatPr().getOutlineLevelCol());
|
||||
|
||||
sheet.ungroupColumn((short) 8, (short) 10);
|
||||
sheet.ungroupColumn(8, 10);
|
||||
colArray = cols.getColArray();
|
||||
//assertEquals(3, colArray[1].getOutlineLevel());
|
||||
|
||||
sheet.ungroupColumn((short) 4, (short) 6);
|
||||
sheet.ungroupColumn((short) 2, (short) 2);
|
||||
sheet.ungroupColumn(4, 6);
|
||||
sheet.ungroupColumn(2, 2);
|
||||
colArray = cols.getColArray();
|
||||
assertEquals(4, colArray.length);
|
||||
assertEquals(2, sheet.getCTWorksheet().getSheetFormatPr().getOutlineLevelCol());
|
||||
@ -753,7 +751,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
assertEquals(1, col.getMin());
|
||||
assertEquals(5, col.getMax());
|
||||
double swidth = 15.77734375; //width of columns in the span
|
||||
assertEquals(swidth, col.getWidth());
|
||||
assertEquals(swidth, col.getWidth(), 0.0);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals((int)(swidth*256), sheet.getColumnWidth(i));
|
||||
@ -778,7 +776,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
assertEquals(5, cols.sizeOfColArray());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals(cw[i]*256, sheet.getColumnWidth(i));
|
||||
assertEquals((double)cw[i], cols.getColArray(i).getWidth());
|
||||
assertEquals(cw[i], cols.getColArray(i).getWidth(), 0.0);
|
||||
}
|
||||
|
||||
//serialize and check again
|
||||
@ -788,7 +786,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
assertEquals(5, cols.sizeOfColArray());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals(cw[i]*256, sheet.getColumnWidth(i));
|
||||
assertEquals((double)cw[i], cols.getColArray(i).getWidth());
|
||||
assertEquals(cw[i], cols.getColArray(i).getWidth(), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -897,7 +895,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
||||
assertSame(comment1, sheet1.getCommentsTable(true));
|
||||
}
|
||||
|
||||
public void testCreateRow(){
|
||||
public void testCreateRow() {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
XSSFSheet sheet = workbook.createSheet();
|
||||
CTWorksheet wsh = sheet.getCTWorksheet();
|
||||
|
Loading…
Reference in New Issue
Block a user