diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2015-11-05 00:15:51 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2015-11-05 00:15:51 +0000 |
commit | 91e617e369b0374daef45bd2d1242626a00bcf15 (patch) | |
tree | 79c5e34c767272f3cf258ae95eba6f17a0d16d85 /src/testcases/org/apache/poi/hssf/usermodel | |
parent | 415c4b95c8f4b546c7f7b2a118a99f588b510fb0 (diff) | |
download | poi-91e617e369b0374daef45bd2d1242626a00bcf15.tar.gz poi-91e617e369b0374daef45bd2d1242626a00bcf15.zip |
extended forbidden-apis-check to ooxml-tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1712693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFont.java | 6 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java | 80 |
2 files changed, 53 insertions, 33 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFont.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFont.java index 7f0aa7048a..81f28d81fe 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFont.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFont.java @@ -17,9 +17,12 @@ package org.apache.poi.hssf.usermodel; +import java.io.IOException; + import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.ss.usermodel.BaseTestFont; import org.apache.poi.ss.usermodel.Font; +import org.junit.Test; /** * Tests various functionality having to do with {@link org.apache.poi.ss.usermodel.Name}. @@ -32,7 +35,8 @@ public final class TestHSSFFont extends BaseTestFont { super(HSSFITestDataProvider.instance); } - public void testDefaultFont() { + @Test + public void testDefaultFont() throws IOException { baseTestDefaultFont(HSSFFont.FONT_ARIAL, (short)200, Font.COLOR_NORMAL); } } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java index d0efcb094f..a059a025f7 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java @@ -17,10 +17,10 @@ package org.apache.poi.hssf.usermodel; -import java.io.IOException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; +import java.io.IOException; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.record.RecordFormatException; @@ -31,6 +31,8 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.junit.Test; +import junit.framework.AssertionFailedError; + /** * @author aviks * @@ -40,8 +42,9 @@ import org.junit.Test; * Bugzilla id's PLEASE MOVE tests from this class to TestBugs once the bugs are * fixed, so that they are then run automatically. */ -public final class TestUnfixedBugs extends TestCase { +public final class TestUnfixedBugs { + @Test public void test43493() { // Has crazy corrupt sub-records on // a EmbeddedObjectRefSubRecord @@ -59,6 +62,7 @@ public final class TestUnfixedBugs extends TestCase { * Note - some parts of this bug have been fixed, and have been * transfered over to {@link TestBugs#bug49612_part()} */ + @Test public void test49612() throws IOException { HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49612.xls"); HSSFSheet sh = wb.getSheetAt(0); @@ -79,54 +83,65 @@ public final class TestUnfixedBugs extends TestCase { assertEquals("SUM('49612.xls'!BOB+'49612.xls'!JIM)", e1.getCellFormula()); // Problem 3 - fixed and transfered + wb.close(); } + @Test public void testFormulaRecordAggregate_1() throws Exception { // fails at formula "=MEHRFACH.OPERATIONEN(E$3;$B$5;$D4)" Workbook wb = HSSFTestDataSamples.openSampleWorkbook("44958_1.xls"); - for(int i = 0;i < wb.getNumberOfSheets();i++) { - Sheet sheet = wb.getSheetAt(i); - assertNotNull(wb.getSheet(sheet.getSheetName())); - sheet.groupColumn((short) 4, (short) 5); - sheet.setColumnGroupCollapsed(4, true); - sheet.setColumnGroupCollapsed(4, false); - - for(Row row : sheet) { - for(Cell cell : row) { - try { - cell.toString(); - } catch (Exception e) { - throw new Exception("While handling: " + sheet.getSheetName() + "/" + row.getRowNum() + "/" + cell.getColumnIndex(), e); + try { + for(int i = 0;i < wb.getNumberOfSheets();i++) { + Sheet sheet = wb.getSheetAt(i); + assertNotNull(wb.getSheet(sheet.getSheetName())); + sheet.groupColumn((short) 4, (short) 5); + sheet.setColumnGroupCollapsed(4, true); + sheet.setColumnGroupCollapsed(4, false); + + for(Row row : sheet) { + for(Cell cell : row) { + try { + cell.toString(); + } catch (Exception e) { + throw new Exception("While handling: " + sheet.getSheetName() + "/" + row.getRowNum() + "/" + cell.getColumnIndex(), e); + } } } } + } finally { + wb.close(); } } + @Test public void testFormulaRecordAggregate() throws Exception { // fails at formula "=MEHRFACH.OPERATIONEN(E$3;$B$5;$D4)" Workbook wb = HSSFTestDataSamples.openSampleWorkbook("44958.xls"); - for(int i = 0;i < wb.getNumberOfSheets();i++) { - Sheet sheet = wb.getSheetAt(i); - assertNotNull(wb.getSheet(sheet.getSheetName())); - sheet.groupColumn((short) 4, (short) 5); - sheet.setColumnGroupCollapsed(4, true); - sheet.setColumnGroupCollapsed(4, false); - - for(Row row : sheet) { - for(Cell cell : row) { - try { - cell.toString(); - } catch (Exception e) { - throw new Exception("While handling: " + sheet.getSheetName() + "/" + row.getRowNum() + "/" + cell.getColumnIndex(), e); + try { + for(int i = 0;i < wb.getNumberOfSheets();i++) { + Sheet sheet = wb.getSheetAt(i); + assertNotNull(wb.getSheet(sheet.getSheetName())); + sheet.groupColumn((short) 4, (short) 5); + sheet.setColumnGroupCollapsed(4, true); + sheet.setColumnGroupCollapsed(4, false); + + for(Row row : sheet) { + for(Cell cell : row) { + try { + cell.toString(); + } catch (Exception e) { + throw new Exception("While handling: " + sheet.getSheetName() + "/" + row.getRowNum() + "/" + cell.getColumnIndex(), e); + } } } - } + } + } finally { + wb.close(); } } @Test - public void testBug57074() { + public void testBug57074() throws IOException { Workbook wb = HSSFTestDataSamples.openSampleWorkbook("57074.xls"); Sheet sheet = wb.getSheet("Sheet1"); Row row = sheet.getRow(0); @@ -141,5 +156,6 @@ public final class TestUnfixedBugs extends TestCase { String fontColorStr = fontColor.getTriplet()[0]+", "+fontColor.getTriplet()[1]+", "+fontColor.getTriplet()[2]; //System.out.println(fontColorStr); assertEquals("0, 128, 128", fontColorStr); + wb.close(); } } |