*/
public int getCharWidth( char c )
{
- Integer widthInteger = (Integer)(charWidths.get(new Character(c)));
+ Integer widthInteger = charWidths.get(new Character(c));
if (widthInteger == null && c != 'W') {
return getCharWidth('W');
}
Cell c1 = r.createCell(0);
c1.setCellFormula("1+5");
- assertEquals(0.0, c1.getNumericCellValue() );
+ assertEquals(0.0, c1.getNumericCellValue(), 0.0);
Cell c2 = r.createCell(1);
c2.setCellFormula("10/2");
- assertEquals(0.0, c2.getNumericCellValue() );
+ assertEquals(0.0, c2.getNumericCellValue(), 0.0);
FormulaEvaluator fe = new XSSFFormulaEvaluator(wb);
Cell c1 = r.createCell(0);
c1.setCellFormula("SUM(A1:B1)");
- assertEquals(0.0, c1.getNumericCellValue() );
+ assertEquals(0.0, c1.getNumericCellValue(), 0.0);
Cell c2 = r.createCell(1);
c2.setCellFormula("SUM(A1:E1)");
- assertEquals(0.0, c2.getNumericCellValue() );
+ assertEquals(0.0, c2.getNumericCellValue(), 0.0);
Cell c3 = r.createCell(2);
c3.setCellFormula("COUNT(A1:A1)");
- assertEquals(0.0, c3.getNumericCellValue() );
+ assertEquals(0.0, c3.getNumericCellValue(), 0.0);
Cell c4 = r.createCell(3);
c4.setCellFormula("COUNTA(A1:E1)");
- assertEquals(0.0, c4.getNumericCellValue() );
+ assertEquals(0.0, c4.getNumericCellValue(), 0.0);
// Evaluate and test
row.createCell(2).setCellFormula("sales_1*3");
XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb);
- assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue());
- assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue());
+ assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue(), 0.0);
+ assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue(), 0.0);
- assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue());
- assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue());
+ assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue(), 0.0);
+ assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue(), 0.0);
}
-
}
count = countColumns(worksheet);
assertEquals(16375, count);
// Remember - POI column 0 == OOXML column 1
- assertEquals((double) 88, helper.getColumn(0, false).getWidth());
+ assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
assertTrue(helper.getColumn(0, false).getHidden());
- assertEquals((double)0, helper.getColumn(1, false).getWidth());
+ assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
assertFalse(helper.getColumn(1, false).getHidden());
}
assertEquals(2, newCol.getMin());
assertEquals(8, newCol.getMax());
assertTrue(newCol.getHidden());
- assertEquals(13.4, newCol.getWidth());
+ assertEquals(13.4, newCol.getWidth(), 0.0);
}
public void testAddCleanColIntoCols() {
ColumnHelper helper = new ColumnHelper(worksheet);
assertNotNull(helper.getColumn(0, false));
assertNotNull(helper.getColumn(1, false));
- assertEquals((double) 88, helper.getColumn(0, false).getWidth());
- assertEquals((double) 0, helper.getColumn(1, false).getWidth());
+ assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
+ assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
assertTrue(helper.getColumn(0, false).getHidden());
assertFalse(helper.getColumn(1, false).getHidden());
assertNull(helper.getColumn(99, false));
col.setWidth(12);
col.setHidden(true);
CTCol newCol = CTCol.Factory.newInstance();
- assertEquals((double) 0, newCol.getWidth());
+ assertEquals(0.0, newCol.getWidth(), 0.0);
assertFalse(newCol.getHidden());
ColumnHelper helper = new ColumnHelper(CTWorksheet.Factory
.newInstance());
helper.setColumnAttributes(col, newCol);
- assertEquals((double) 12, newCol.getWidth());
+ assertEquals(12.0, newCol.getWidth(), 0.0);
assertTrue(newCol.getHidden());
}
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("Sheet 1");
ColumnHelper columnHelper = sheet.getColumnHelper();
-
+
// Check POI 0 based, OOXML 1 based
CTCol col = columnHelper.getOrCreateColumn1Based(3, false);
assertNotNull(col);
assertNotNull(columnHelper.getColumn1Based(30, false));
assertNull(columnHelper.getColumn(30, false));
}
-
+
public void testGetSetColDefaultStyle() {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet();
CTWorksheet ctWorksheet = sheet.getCTWorksheet();
ColumnHelper columnHelper = sheet.getColumnHelper();
-
+
// POI column 3, OOXML column 4
CTCol col = columnHelper.getOrCreateColumn1Based(4, false);
-
+
assertNotNull(col);
assertNotNull(columnHelper.getColumn(3, false));
columnHelper.setColDefaultStyle(3, 2);
Map<Integer, String> formats = BuiltinFormats.getBuiltinFormats();
for (int idx : formats.keySet()) {
- String fmt = formats.get(idx);
+ String fmt = formats.get(new Integer(idx));
assertEquals(idx, df.getFormat(fmt));
}
sheet.setDefaultRowHeightInPoints(20);
row1.setHeight((short)-1); //reset the row height
- assertEquals(20.0f, row1.getHeightInPoints());
+ assertEquals(20.0f, row1.getHeightInPoints(), 0F);
assertEquals(20*20, row1.getHeight());
Row row2 = sheet.createRow(1);
row2.setHeight((short)310);
assertEquals(310, row2.getHeight());
- assertEquals((float)310/20, row2.getHeightInPoints());
+ assertEquals(310F/20, row2.getHeightInPoints(), 0F);
Row row3 = sheet.createRow(2);
row3.setHeightInPoints(25.5f);
assertEquals((short)(25.5f*20), row3.getHeight());
- assertEquals(25.5f, row3.getHeightInPoints());
+ assertEquals(25.5f, row3.getHeightInPoints(), 0F);
Row row4 = sheet.createRow(3);
assertFalse(row4.getZeroHeight());
row2 = sheet.getRow(1);
row3 = sheet.getRow(2);
row4 = sheet.getRow(3);
- assertEquals(20.0f, row1.getHeightInPoints());
+ assertEquals(20.0f, row1.getHeightInPoints(), 0F);
assertEquals(20*20, row1.getHeight());
assertEquals(310, row2.getHeight());
- assertEquals((float)310/20, row2.getHeightInPoints());
+ assertEquals(310F/20, row2.getHeightInPoints(), 0F);
assertEquals((short)(25.5f*20), row3.getHeight());
- assertEquals(25.5f, row3.getHeightInPoints());
+ assertEquals(25.5f, row3.getHeightInPoints(), 0F);
assertFalse(row1.getZeroHeight());
assertFalse(row2.getZeroHeight());
assertTrue(cell2 == it.next());
assertEquals(Cell.CELL_TYPE_STRING, cell5.getCellType());
}
-
-
-}
\ No newline at end of file
+}