diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-07-22 22:08:33 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-07-22 22:08:33 +0000 |
commit | c0f99416047be7c3b7e5413d7a0187a21022a02b (patch) | |
tree | 4c0861aa3dc9634684a8048b855426276eebb96b /src/testcases | |
parent | 800da8b29095a06283380f9adb2c1202a23ee57e (diff) | |
download | poi-c0f99416047be7c3b7e5413d7a0187a21022a02b.tar.gz poi-c0f99416047be7c3b7e5413d7a0187a21022a02b.zip |
#64411 - Provide JigSaw modules
- use classpath-build for Java 8, otherwise use modulepath
- save module-info classes to source, when using Java 9+ environment
- rename example packages - otherwise package clashes occured in the tests
- move agile encryption from ooxml to main.
remove EncryptionInfo XmlBeans and schema and use custom xml marshalling
- move ooxml test classes which reside in the same package as their tested main class
- rename base test classes to "BaseTest..." - temporarily I've used a light version of the main test classes to test scratchpad / ooxml
- build.xml - fixed the Rhino javascript errors of the dependency-macros
- DrawTextParagraph - fixed StringIndexOutOfBounds when logging set to debug level
- use JigSaw provider interface (= Java ServiceLoader), i.e. it wasn't possible (without openening everything), to access ooxml factory classes from main factory stub
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880164 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
33 files changed, 504 insertions, 127 deletions
diff --git a/src/testcases/org/apache/poi/TestJDK12.java b/src/testcases/org/apache/poi/TestJDK12.java new file mode 100644 index 0000000000..dfac092f04 --- /dev/null +++ b/src/testcases/org/apache/poi/TestJDK12.java @@ -0,0 +1,53 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi; + +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.font.TextLayout; +import java.awt.image.BufferedImage; +import java.text.AttributedString; + +import org.junit.Test; + +/** + * Minimal Test-Class found when running the Apache POI regression tests. + * + * This reproduces a crash introduced in JDK 12-ea+28 and JDK 13-ea+4 + * + * This works in recent JDK 8, JDK 11 and at least up to JDK 12-ea+20 + * + * https://bugs.openjdk.java.net/browse/JDK-8217768 + * + * Should be fixed in JDK 12-ea+29 and JDK 13-ea+5 + */ +public class TestJDK12 { + @Test + public void test() throws Exception { + BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); + Graphics2D graphics = img.createGraphics(); + graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + graphics.scale(200, 1); + + new TextLayout(new AttributedString("agriculture").getIterator(), graphics.getFontRenderContext()); + + graphics.dispose(); + img.flush(); + } + +} diff --git a/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java b/src/testcases/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java index d57583aeb9..a8b30a001c 100644 --- a/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java +++ b/src/testcases/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java @@ -41,16 +41,16 @@ import org.junit.runners.Parameterized.Parameters; /** * Base class for integration-style tests which iterate over all test-files * and execute the same action to find out if any change breaks these applications. - * + * * This test uses {@link Parameterized} to run the test for each file separatedely. */ @RunWith(Parameterized.class) -public abstract class BaseXLSIteratingTest { +public abstract class BaseTestIteratingXLS { protected static final OutputStream NULL_OUTPUT_STREAM = new NullOutputStream(); @Rule public ExpectedException thrown = ExpectedException.none(); - + protected static final Map<String,Class<? extends Throwable>> EXCLUDED = new HashMap<>(); @@ -64,30 +64,30 @@ public abstract class BaseXLSIteratingTest { List<Object[]> files = new ArrayList<>(); findFile(files, dataDirName + "/spreadsheet"); findFile(files, dataDirName + "/hpsf"); - + return files; } - + private static void findFile(List<Object[]> list, String dir) { String[] files = new File(dir).list((arg0, arg1) -> arg1.toLowerCase(Locale.ROOT).endsWith(".xls")); - + assertNotNull("Did not find any xls files in directory " + dir, files); - + for(String file : files) { list.add(new Object[] { new File(dir, file) }); } } - + @Parameter public File file; - + @Test public void testMain() throws Exception { String fileName = file.getName(); if (EXCLUDED.containsKey(fileName)) { thrown.expect(EXCLUDED.get(fileName)); } - + try { runOneFile(file); } catch (Exception e) { @@ -95,7 +95,7 @@ public abstract class BaseXLSIteratingTest { try (FileInputStream stream = new FileInputStream(file); HSSFWorkbook wb = new HSSFWorkbook(stream)) { assertNotNull(wb); } - + throw e; } } diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java index 17b43f0da1..12d7c6fbaf 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java @@ -26,7 +26,7 @@ import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.util.RecordFormatException; import org.junit.BeforeClass; -public class TestBiffDrawingToXml extends BaseXLSIteratingTest { +public class TestBiffDrawingToXml extends BaseTestIteratingXLS { @BeforeClass public static void setup() { EXCLUDED.clear(); diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java index 82a46327b9..d4fd62fa99 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -33,7 +33,7 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -public class TestBiffViewer extends BaseXLSIteratingTest { +public class TestBiffViewer extends BaseTestIteratingXLS { @BeforeClass public static void setup() { EXCLUDED.clear(); diff --git a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java index a24b4967f7..d32e0b71eb 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.RecordFormatException; import org.junit.BeforeClass; -public class TestEFBiffViewer extends BaseXLSIteratingTest { +public class TestEFBiffViewer extends BaseTestIteratingXLS { @BeforeClass public static void setup() { EXCLUDED.clear(); diff --git a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java index ec69abb4cb..b922230994 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.RecordFormatException; import org.junit.BeforeClass; -public class TestFormulaViewer extends BaseXLSIteratingTest { +public class TestFormulaViewer extends BaseTestIteratingXLS { @BeforeClass public static void setup() { EXCLUDED.clear(); diff --git a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java index 97b84e21ac..890ef1e837 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java @@ -31,7 +31,7 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -public class TestReSave extends BaseXLSIteratingTest { +public class TestReSave extends BaseTestIteratingXLS { @BeforeClass public static void setup() { EXCLUDED.clear(); diff --git a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java index f15801390b..934eb5b89d 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java @@ -25,7 +25,7 @@ import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.RecordFormatException; import org.junit.BeforeClass; -public class TestRecordLister extends BaseXLSIteratingTest { +public class TestRecordLister extends BaseTestIteratingXLS { @BeforeClass public static void setup() { EXCLUDED.clear(); @@ -40,7 +40,7 @@ public class TestRecordLister extends BaseXLSIteratingTest { EXCLUDED.put("61300.xls", RecordFormatException.class); EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5 } - + @Override void runOneFile(File fileIn) throws IOException { PrintStream save = System.out; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java new file mode 100644 index 0000000000..987741f4ca --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java @@ -0,0 +1,273 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.usermodel; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; + +import java.io.IOException; + +import org.apache.poi.hssf.HSSFITestDataProvider; +import org.apache.poi.hssf.HSSFTestDataSamples; +import org.apache.poi.hssf.record.chart.SeriesRecord; +import org.apache.poi.hssf.usermodel.HSSFChart.HSSFSeries; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellRangeAddressBase; +import org.junit.Test; + +/** + * Tests for {@link HSSFChart} + */ +public final class TestHSSFChart { + + @Test + public void testSingleChart() { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithChart.xls"); + + HSSFSheet s1 = wb.getSheetAt(0); + HSSFSheet s2 = wb.getSheetAt(1); + HSSFSheet s3 = wb.getSheetAt(2); + + assertEquals(0, HSSFChart.getSheetCharts(s1).length); + assertEquals(1, HSSFChart.getSheetCharts(s2).length); + assertEquals(0, HSSFChart.getSheetCharts(s3).length); + + HSSFChart[] charts; + + // Check the chart on the 2nd sheet + charts = HSSFChart.getSheetCharts(s2); + assertEquals(1, charts.length); + + assertEquals(2, charts[0].getSeries().length); + assertEquals("1st Column", charts[0].getSeries()[0].getSeriesTitle()); + assertEquals("2nd Column", charts[0].getSeries()[1].getSeriesTitle()); + assertNull(charts[0].getChartTitle()); + + // Check x, y, width, height + assertEquals(0, charts[0].getChartX()); + assertEquals(0, charts[0].getChartY()); + assertEquals(26492928, charts[0].getChartWidth()); + assertEquals(15040512, charts[0].getChartHeight()); + } + + @Test + public void testTwoCharts() { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithTwoCharts.xls"); + + HSSFSheet s1 = wb.getSheetAt(0); + HSSFSheet s2 = wb.getSheetAt(1); + HSSFSheet s3 = wb.getSheetAt(2); + + assertEquals(0, HSSFChart.getSheetCharts(s1).length); + assertEquals(1, HSSFChart.getSheetCharts(s2).length); + assertEquals(1, HSSFChart.getSheetCharts(s3).length); + + HSSFChart[] charts; + + // Check the chart on the 2nd sheet + charts = HSSFChart.getSheetCharts(s2); + assertEquals(1, charts.length); + + assertEquals(2, charts[0].getSeries().length); + assertEquals("1st Column", charts[0].getSeries()[0].getSeriesTitle()); + assertEquals("2nd Column", charts[0].getSeries()[1].getSeriesTitle()); + assertNull(charts[0].getChartTitle()); + + // And the third sheet + charts = HSSFChart.getSheetCharts(s3); + assertEquals(1, charts.length); + + assertEquals(2, charts[0].getSeries().length); + assertEquals("Squares", charts[0].getSeries()[0].getSeriesTitle()); + assertEquals("Base Numbers", charts[0].getSeries()[1].getSeriesTitle()); + assertNull(charts[0].getChartTitle()); + } + + @Test + public void testThreeCharts() { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithThreeCharts.xls"); + + HSSFSheet s1 = wb.getSheetAt(0); + HSSFSheet s2 = wb.getSheetAt(1); + HSSFSheet s3 = wb.getSheetAt(2); + + assertEquals(0, HSSFChart.getSheetCharts(s1).length); + assertEquals(2, HSSFChart.getSheetCharts(s2).length); + assertEquals(1, HSSFChart.getSheetCharts(s3).length); + + HSSFChart[] charts; + + // Check the charts on the 2nd sheet + charts = HSSFChart.getSheetCharts(s2); + assertEquals(2, charts.length); + + assertEquals(2, charts[0].getSeries().length); + assertEquals("1st Column", charts[0].getSeries()[0].getSeriesTitle()); + assertEquals("2nd Column", charts[0].getSeries()[1].getSeriesTitle()); + assertEquals(6, charts[0].getSeries()[0].getNumValues()); + assertEquals(6, charts[0].getSeries()[1].getNumValues()); + assertEquals(SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, charts[0].getSeries()[0].getValueType()); + assertEquals(SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, charts[0].getSeries()[1].getValueType()); + assertNull(charts[0].getChartTitle()); + + assertEquals(1, charts[1].getSeries().length); + assertNull(charts[1].getSeries()[0].getSeriesTitle()); + assertEquals("Pie Chart Title Thingy", charts[1].getChartTitle()); + + // And the third sheet + charts = HSSFChart.getSheetCharts(s3); + assertEquals(1, charts.length); + + assertEquals(2, charts[0].getSeries().length); + assertEquals("Squares", charts[0].getSeries()[0].getSeriesTitle()); + assertEquals("Base Numbers", charts[0].getSeries()[1].getSeriesTitle()); + assertEquals("Sheet 3 Chart with Title", charts[0].getChartTitle()); + } + + @Test + public void testExistingSheet3() throws Exception { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls"); + + HSSFSheet sheet = wb.getSheetAt( 2 ) ; + HSSFChart[] charts = HSSFChart.getSheetCharts( sheet ) ; + assertEquals(1, charts.length); + + for ( HSSFChart chart : charts ) { + for ( HSSFSeries series : chart.getSeries() ) { + chart.removeSeries( series ) ; + } + } + + // Save and re-check + wb = HSSFITestDataProvider.instance.writeOutAndReadBack(wb); + sheet = wb.getSheetAt( 2 ) ; + assertEquals(1, HSSFChart.getSheetCharts(sheet).length); + + HSSFChart c = HSSFChart.getSheetCharts(sheet)[0]; + assertEquals(0, c.getSeries().length); + } + + @Test + public void testExistingSheet2() throws Exception { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls"); + HSSFSheet sheet = wb.getSheetAt( 1 ) ; + HSSFChart[] charts = HSSFChart.getSheetCharts( sheet ) ; + + assertEquals(1, charts.length); + for ( HSSFChart chart : charts ) { + HSSFSeries series ; + + // Starts with one + assertEquals(1, chart.getSeries().length); + + // Add two more + series = chart.createSeries() ; + series.setCategoryLabelsCellRange( new CellRangeAddress( 3, 4, 0, 0 ) ) ; + series.setValuesCellRange( new CellRangeAddress( 3, 4, 1, 1 ) ) ; + + series = chart.createSeries() ; + series.setCategoryLabelsCellRange( new CellRangeAddress( 6, 7, 0, 0 ) ) ; + series.setValuesCellRange( new CellRangeAddress( 6, 7, 1, 1 ) ) ; + } + + // Save and re-check + wb = HSSFITestDataProvider.instance.writeOutAndReadBack(wb); + sheet = wb.getSheetAt( 1 ) ; + assertEquals(1, HSSFChart.getSheetCharts(sheet).length); + + HSSFChart c = HSSFChart.getSheetCharts(sheet)[0]; + assertEquals(3, c.getSeries().length); + } + + @Test + public void testExistingSheet1() throws Exception { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls"); + HSSFSheet sheet = wb.getSheetAt( 0 ) ; + HSSFChart[] charts = HSSFChart.getSheetCharts( sheet ) ; + + for ( HSSFChart chart : charts ) { + //System.out.println( chart.getType() ) ; + HSSFSeries[] seriesArray = chart.getSeries() ; + //System.out.println( "seriesArray.length=" + seriesArray.length ) ; + for ( HSSFSeries series : seriesArray ) + { + //System.out.println( "serie.getNumValues()=" + series.getNumValues() ) ; + CellRangeAddressBase range ; + + range = series.getValuesCellRange() ; + //System.out.println( range.toString() ) ; + range.setLastRow( range.getLastRow() + 1 ) ; + series.setValuesCellRange( range ) ; + + range = series.getCategoryLabelsCellRange() ; + //System.out.println( range.toString() ) ; + range.setLastRow( range.getLastRow() + 1 ) ; + series.setCategoryLabelsCellRange( range ) ; + } + + for ( int id = 0 ; id < 2 ; id++ ) + { + HSSFSeries newSeries = chart.createSeries() ; + newSeries.setValuesCellRange( new CellRangeAddress( 1 + id, 4, 3, 3 ) ) ; + String oldSeriesTitle = newSeries.getSeriesTitle() ; + if ( oldSeriesTitle != null ) + { + //System.out.println( "old series title: " + oldSeriesTitle ) ; + newSeries.setSeriesTitle( "new series" ) ; + } + } + } + + HSSFChart chart = charts[ 2 ] ; + chart.removeSeries( chart.getSeries()[ 0 ] ) ; + } + + /** + * Bug 26862: HSSFWorkbook.cloneSheet copies charts + */ + @Test + public void test26862() throws IOException, Exception { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("SimpleChart.xls"); + HSSFSheet srcSheet = wb.getSheetAt(0); + HSSFChart[] srcCharts = HSSFChart.getSheetCharts(srcSheet); + assertEquals(1, srcCharts.length); + HSSFChart srcChart = srcCharts[0]; + + // Clone the sheet + HSSFSheet clonedSheet = wb.cloneSheet(0); + + // Verify the chart was copied + HSSFChart[] clonedCharts = HSSFChart.getSheetCharts(clonedSheet); + assertEquals(1, clonedCharts.length); + HSSFChart clonedChart = clonedCharts[0]; + assertNotSame(srcChart, clonedChart); //refer to different objects + assertEquals(srcChart.getType(), clonedChart.getType()); + assertEquals(srcChart.getChartTitle(), clonedChart.getChartTitle()); + assertEquals(srcChart.getChartWidth(), clonedChart.getChartWidth()); + assertEquals(srcChart.getChartHeight(), clonedChart.getChartHeight()); + assertEquals(srcChart.getChartX(), clonedChart.getChartX()); + assertEquals(srcChart.getChartY(), clonedChart.getChartY()); + + // Check if chart was shallow copied or deep copied + clonedChart.setChartWidth(clonedChart.getChartWidth()+10); + assertEquals(srcChart.getChartWidth()+10, clonedChart.getChartWidth()); + + wb.close(); + } +} diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRangeCopier.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRangeCopier.java index 8d685fc68d..07f37d8e4a 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRangeCopier.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRangeCopier.java @@ -21,10 +21,10 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.ss.usermodel.TestRangeCopier; +import org.apache.poi.ss.usermodel.BaseTestRangeCopier; import org.junit.Before; -public class TestHSSFRangeCopier extends TestRangeCopier { +public class TestHSSFRangeCopier extends BaseTestRangeCopier { public TestHSSFRangeCopier() { super(); diff --git a/src/testcases/org/apache/poi/sl/TestCommonSL.java b/src/testcases/org/apache/poi/sl/TestCommonSL.java deleted file mode 100644 index 2911b12e42..0000000000 --- a/src/testcases/org/apache/poi/sl/TestCommonSL.java +++ /dev/null @@ -1,38 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ -package org.apache.poi.sl; - -import java.awt.Color; - -import org.apache.poi.sl.draw.DrawPaint; -import org.apache.poi.sl.usermodel.PaintStyle; -import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint; -import org.junit.Ignore; - -/** - * Currently only contains helper methods - */ -@Ignore -public class TestCommonSL { - - public static Color getColor(PaintStyle paintActual) { - return (paintActual instanceof SolidPaint) - ? DrawPaint.applyColorTransform(((SolidPaint)paintActual).getSolidColor()) - : null; - } - -} diff --git a/src/testcases/org/apache/poi/sl/draw/geom/TestFormulaParser.java b/src/testcases/org/apache/poi/sl/draw/geom/TestFormulaParser.java new file mode 100644 index 0000000000..0d82c2ad3e --- /dev/null +++ b/src/testcases/org/apache/poi/sl/draw/geom/TestFormulaParser.java @@ -0,0 +1,66 @@ +/* + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ +package org.apache.poi.sl.draw.geom; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +/** + * Date: 10/24/11 + * + * @author Yegor Kozlov + */ +public class TestFormulaParser { + @Test + public void testParse(){ + + Formula[] ops = { + newGuide("adj1", "val 100"), + newGuide("adj2", "val 200"), + newGuide("adj3", "val -1"), + newGuide("a1", "*/ adj1 2 adj2"), // a1 = 100*2 / 200 + newGuide("a2", "+- adj2 a1 adj1"), // a2 = 200 + a1 - 100 + newGuide("a3", "+/ adj1 adj2 adj2"), // a3 = (100 + 200) / 200 + newGuide("a4", "?: adj3 adj1 adj2"), // a4 = adj3 > 0 ? adj1 : adj2 + newGuide("a5", "abs -2"), + }; + + CustomGeometry geom = new CustomGeometry(); + Context ctx = new Context(geom, null, null); + for(Formula fmla : ops) { + ctx.evaluate(fmla); + } + + assertEquals(100.0, ctx.getValue("adj1"), 0.0); + assertEquals(200.0, ctx.getValue("adj2"), 0.0); + assertEquals(1.0, ctx.getValue("a1"), 0.0); + assertEquals(101.0, ctx.getValue("a2"), 0.0); + assertEquals(1.5, ctx.getValue("a3"), 0.0); + assertEquals(200.0, ctx.getValue("a4"), 0.0); + assertEquals(2.0, ctx.getValue("a5"), 0.0); + } + + private static Guide newGuide(String name, String fmla) { + Guide gd = new Guide(); + gd.setName(name); + gd.setFmla(fmla); + return gd; + } +} diff --git a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java index c12c96559f..5d53b4bd62 100644 --- a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java +++ b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java @@ -31,6 +31,7 @@ import java.util.List; import org.apache.poi.POIDataSamples; import org.apache.poi.common.usermodel.fonts.FontInfo; +import org.apache.poi.sl.draw.DrawPaint; import org.apache.poi.sl.usermodel.PictureData.PictureType; import org.apache.poi.sl.usermodel.TabStop.TabStopType; import org.junit.Test; @@ -40,24 +41,24 @@ public abstract class BaseTestSlideShow< P extends TextParagraph<S,P,? extends TextRun> > { protected static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance(); - + public abstract SlideShow<S,P> createSlideShow(); public abstract SlideShow<S,P> reopen(SlideShow<S,P> show); - + @Test public void addPicture_File() throws IOException { SlideShow<S,P> show = createSlideShow(); File f = slTests.getFile("clock.jpg"); - + assertEquals(0, show.getPictureData().size()); PictureData picture = show.addPicture(f, PictureType.JPEG); assertEquals(1, show.getPictureData().size()); assertSame(picture, show.getPictureData().get(0)); - + show.close(); } - + @Test public void addPicture_Stream() throws IOException { try (SlideShow<S,P> show = createSlideShow(); @@ -68,34 +69,34 @@ public abstract class BaseTestSlideShow< assertSame(picture, show.getPictureData().get(0)); } } - + @Test public void addPicture_ByteArray() throws IOException { SlideShow<S,P> show = createSlideShow(); byte[] data = slTests.readFile("clock.jpg"); - + assertEquals(0, show.getPictureData().size()); PictureData picture = show.addPicture(data, PictureType.JPEG); assertEquals(1, show.getPictureData().size()); assertSame(picture, show.getPictureData().get(0)); - + show.close(); } - + @Test public void findPicture() throws IOException { SlideShow<S,P> show = createSlideShow(); byte[] data = slTests.readFile("clock.jpg"); - + assertNull(show.findPictureData(data)); PictureData picture = show.addPicture(data, PictureType.JPEG); PictureData found = show.findPictureData(data); assertNotNull(found); assertEquals(picture, found); - + show.close(); } - + @Test public void addTabStops() throws IOException { try (final SlideShow<S,P> show1 = createSlideShow()) { @@ -109,7 +110,7 @@ public abstract class BaseTestSlideShow< master1_tp.addTabStops(10+i1*10, tst); i1++; } - + // then set it on a normal slide final Slide<S,P> slide1 = show1.createSlide(); final AutoShape<S,P> slide1_as = slide1.createAutoShape(); @@ -123,7 +124,7 @@ public abstract class BaseTestSlideShow< slide1_tp.addTabStops(15+i2*5, tst); i2++; } - + try (final SlideShow<S,P> show2 = reopen(show1)) { final MasterSheet<S,P> master2 = show2.getSlideMasters().get(0); final AutoShape<S,P> master2_as = (AutoShape<S,P>)master2.getPlaceholder(Placeholder.BODY); @@ -137,8 +138,8 @@ public abstract class BaseTestSlideShow< assertEquals(tst, ts.getType()); i3++; } - - + + final Slide<S,P> slide2 = show2.getSlides().get(0); @SuppressWarnings("unchecked") final AutoShape<S,P> slide2_as = (AutoShape<S,P>)slide2.getShapes().get(0); @@ -153,7 +154,7 @@ public abstract class BaseTestSlideShow< i4++; } } - } + } } @Test @@ -191,4 +192,11 @@ public abstract class BaseTestSlideShow< } } } + + public static Color getColor(PaintStyle paintActual) { + return (paintActual instanceof PaintStyle.SolidPaint) + ? DrawPaint.applyColorTransform(((PaintStyle.SolidPaint)paintActual).getSolidColor()) + : null; + } + } diff --git a/src/testcases/org/apache/poi/ss/format/TestCellFormat.java b/src/testcases/org/apache/poi/ss/format/TestCellFormat.java index 8234a93e4a..fa24171b9e 100644 --- a/src/testcases/org/apache/poi/ss/format/TestCellFormat.java +++ b/src/testcases/org/apache/poi/ss/format/TestCellFormat.java @@ -16,7 +16,9 @@ ==================================================================== */ package org.apache.poi.ss.format; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.text.ParseException; @@ -24,10 +26,12 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; +import java.util.stream.Stream; import javax.swing.JLabel; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.Row; @@ -35,6 +39,7 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.util.LocaleUtil; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -1013,4 +1018,12 @@ public class TestCellFormat { CellFormat cf = CellFormat.getInstance("\"ca. \"0"); assertEquals("ca. 5", cf.apply((double) 5).text); } + + @Test + public void testNamedColors() { + assertTrue(CellFormatPart.NAMED_COLORS.size() >= HSSFColor.HSSFColorPredefined.values().length); + Stream.of("GREEN", "Green", "RED", "Red", "BLUE", "Blue", "YELLOW", "Yellow") + .map(CellFormatPart.NAMED_COLORS::get) + .forEach(Assert::assertNotNull); + } } diff --git a/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java b/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java index 59631017d2..14427df5d4 100644 --- a/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java +++ b/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java @@ -17,7 +17,7 @@ package org.apache.poi.ss.formula; -import org.apache.poi.ss.formula.eval.forked.TestForkedEvaluator; +import org.apache.poi.ss.formula.eval.forked.BaseTestForkedEvaluator; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -29,7 +29,7 @@ import org.junit.runners.Suite; TestCellCacheEntry.class, TestEvaluationCache.class, TestWorkbookEvaluator.class, - TestForkedEvaluator.class + BaseTestForkedEvaluator.class }) public class AllSSFormulaTests { } diff --git a/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java b/src/testcases/org/apache/poi/ss/formula/BaseTestMissingWorkbook.java index 1093e541a9..9cb755cf27 100644 --- a/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java +++ b/src/testcases/org/apache/poi/ss/formula/BaseTestMissingWorkbook.java @@ -19,6 +19,15 @@ package org.apache.poi.ss.formula; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.HashMap; +import java.util.Map; + import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; @@ -30,39 +39,30 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class TestMissingWorkbook { +public class BaseTestMissingWorkbook { protected Workbook mainWorkbook; protected Workbook sourceWorkbook; - + protected final String MAIN_WORKBOOK_FILENAME; protected final String SOURCE_DUMMY_WORKBOOK_FILENAME; protected final String SOURCE_WORKBOOK_FILENAME; - - public TestMissingWorkbook() { + + public BaseTestMissingWorkbook() { this("52575_main.xls", "source_dummy.xls", "52575_source.xls"); } - protected TestMissingWorkbook(String MAIN_WORKBOOK_FILENAME, - String SOURCE_DUMMY_WORKBOOK_FILENAME, String SOURCE_WORKBOOK_FILENAME) { - this.MAIN_WORKBOOK_FILENAME = MAIN_WORKBOOK_FILENAME; + protected BaseTestMissingWorkbook(String MAIN_WORKBOOK_FILENAME, + String SOURCE_DUMMY_WORKBOOK_FILENAME, String SOURCE_WORKBOOK_FILENAME) { + this.MAIN_WORKBOOK_FILENAME = MAIN_WORKBOOK_FILENAME; this.SOURCE_DUMMY_WORKBOOK_FILENAME = SOURCE_DUMMY_WORKBOOK_FILENAME; this.SOURCE_WORKBOOK_FILENAME = SOURCE_WORKBOOK_FILENAME; } - + @Before public void setUp() throws Exception { mainWorkbook = HSSFTestDataSamples.openSampleWorkbook(MAIN_WORKBOOK_FILENAME); sourceWorkbook = HSSFTestDataSamples.openSampleWorkbook(SOURCE_WORKBOOK_FILENAME); - + assertNotNull(mainWorkbook); assertNotNull(sourceWorkbook); } @@ -81,11 +81,11 @@ public class TestMissingWorkbook { @Test public void testMissingWorkbookMissing() { FormulaEvaluator evaluator = mainWorkbook.getCreationHelper().createFormulaEvaluator(); - + Sheet lSheet = mainWorkbook.getSheetAt(0); Row lARow = lSheet.getRow(0); Cell lA1Cell = lARow.getCell(0); - + assertEquals(CellType.FORMULA, lA1Cell.getCellType()); try { evaluator.evaluateFormulaCell(lA1Cell); @@ -101,7 +101,7 @@ public class TestMissingWorkbook { Cell lA1Cell = lSheet.getRow(0).getCell(0); Cell lB1Cell = lSheet.getRow(1).getCell(0); Cell lC1Cell = lSheet.getRow(2).getCell(0); - + assertEquals(CellType.FORMULA, lA1Cell.getCellType()); assertEquals(CellType.FORMULA, lB1Cell.getCellType()); assertEquals(CellType.FORMULA, lC1Cell.getCellType()); @@ -110,7 +110,7 @@ public class TestMissingWorkbook { assertEquals(10.0d, lA1Cell.getNumericCellValue(), 0.00001d); assertEquals("POI rocks!", lB1Cell.getStringCellValue()); assertTrue(lC1Cell.getBooleanCellValue()); - + // Evaluate FormulaEvaluator evaluator = mainWorkbook.getCreationHelper().createFormulaEvaluator(); evaluator.setIgnoreMissingWorkbooks(true); @@ -130,7 +130,7 @@ public class TestMissingWorkbook { Cell lA1Cell = lSheet.getRow(0).getCell(0); Cell lB1Cell = lSheet.getRow(1).getCell(0); Cell lC1Cell = lSheet.getRow(2).getCell(0); - + assertEquals(CellType.FORMULA, lA1Cell.getCellType()); assertEquals(CellType.FORMULA, lB1Cell.getCellType()); assertEquals(CellType.FORMULA, lC1Cell.getCellType()); @@ -141,7 +141,7 @@ public class TestMissingWorkbook { workbooks.put(MAIN_WORKBOOK_FILENAME, lMainWorkbookEvaluator); workbooks.put(SOURCE_DUMMY_WORKBOOK_FILENAME, lSourceEvaluator); lMainWorkbookEvaluator.setupReferencedWorkbooks(workbooks); - + assertEquals(CellType.NUMERIC, lMainWorkbookEvaluator.evaluateFormulaCell(lA1Cell)); assertEquals(CellType.STRING, lMainWorkbookEvaluator.evaluateFormulaCell(lB1Cell)); assertEquals(CellType.BOOLEAN, lMainWorkbookEvaluator.evaluateFormulaCell(lC1Cell)); diff --git a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java b/src/testcases/org/apache/poi/ss/formula/eval/forked/BaseTestForkedEvaluator.java index e27499ce39..578452fe50 100644 --- a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java +++ b/src/testcases/org/apache/poi/ss/formula/eval/forked/BaseTestForkedEvaluator.java @@ -32,15 +32,15 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -public class TestForkedEvaluator { - +public class BaseTestForkedEvaluator { + @Rule public ExpectedException expectedEx = ExpectedException.none(); - + protected Workbook newWorkbook() { return new HSSFWorkbook(); } - + /** * set up a calculation workbook with input cells nicely segregated on a * sheet called "Inputs" @@ -92,7 +92,7 @@ public class TestForkedEvaluator { eval1 = (NumberEval) fe1.evaluate("Calculations", 0, 0); assertNotNull(eval1); assertEquals(13.9, eval1.getNumberValue(), 0.0); - + wb.close(); } diff --git a/src/testcases/org/apache/poi/ss/formula/functions/AbstractNumericTestCase.java b/src/testcases/org/apache/poi/ss/formula/functions/BaseTestNumeric.java index 7d0fd5e7ad..ea1055cf7a 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/AbstractNumericTestCase.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/BaseTestNumeric.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertTrue; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -public abstract class AbstractNumericTestCase { +public abstract class BaseTestNumeric { public static final double POS_ZERO = 1E-4; public static final double DIFF_TOLERANCE_FACTOR = 1E-8; diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java index 212c8acc62..2e08083ca2 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java @@ -27,7 +27,7 @@ import org.junit.Test; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -public class TestFinanceLib extends AbstractNumericTestCase { +public class TestFinanceLib extends BaseTestNumeric { @Test public void testFv() { diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java b/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java index 43a7d48cc9..22506bd00e 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java @@ -30,7 +30,7 @@ import org.junit.Test; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -public class TestMathX extends AbstractNumericTestCase { +public class TestMathX extends BaseTestNumeric { @Test public void testAcosh() { diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java b/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java index b489cdcb4b..bb8b8e62bb 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java @@ -29,7 +29,7 @@ import org.junit.Ignore; import org.junit.Test; -public class TestStatsLib extends AbstractNumericTestCase { +public class TestStatsLib extends BaseTestNumeric { @Test public void testDevsq() { diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java b/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java index b11fd45ad2..a501435616 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java @@ -29,7 +29,7 @@ import org.junit.Test; * * @author Stephen Wolke (smwolke at geistig.com) */ -public final class TestTrunc extends AbstractNumericTestCase { +public final class TestTrunc extends BaseTestNumeric { private static final NumericFunction F = null; @Test diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java b/src/testcases/org/apache/poi/ss/formula/ptg/BaseTestPtg.java index d03a4e269a..8e566bf929 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/BaseTestPtg.java @@ -24,7 +24,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; * Convenient abstract class to reduce the amount of boilerplate code needed * in ptg-related unit tests. */ -public abstract class AbstractPtgTestCase { +public abstract class BaseTestPtg { /** * Loads a workbook from the given filename in the test data dir. diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java index c06f7f7b35..481d7c5051 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for Area3DPtg */ -public final class TestArea3DPtg extends AbstractPtgTestCase { +public final class TestArea3DPtg extends BaseTestPtg { /** * confirms that sheet names get properly escaped diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java index 028ed03d3f..3d04da1db5 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java @@ -27,7 +27,7 @@ import org.junit.Test; /** * Tests for {@link AreaErrPtg}. */ -public final class TestAreaErrPtg extends AbstractPtgTestCase { +public final class TestAreaErrPtg extends BaseTestPtg { /** * Tests reading a file containing this ptg. */ diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java index b7b058007a..d957a956aa 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java @@ -27,7 +27,7 @@ import org.junit.Test; /** * Tests for {@link AttrPtg}. */ -public final class TestAttrPtg extends AbstractPtgTestCase { +public final class TestAttrPtg extends BaseTestPtg { /** * Fix for bug visible around svn r706772. diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java index 5f9af47846..0ff6ad78b6 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for {@link ErrPtg}. */ -public final class TestErrPtg extends AbstractPtgTestCase { +public final class TestErrPtg extends BaseTestPtg { /** * Tests reading a file containing this ptg. */ diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java index c13bf638a9..729920cb8a 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for {@link IntersectionPtg}. */ -public final class TestIntersectionPtg extends AbstractPtgTestCase { +public final class TestIntersectionPtg extends BaseTestPtg { /** * Tests reading a file containing this ptg. */ diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java index 84ede5baa6..4b69d0743b 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for {@link PercentPtg}. */ -public final class TestPercentPtg extends AbstractPtgTestCase { +public final class TestPercentPtg extends BaseTestPtg { /** * Tests reading a file containing this ptg. */ diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java index 55438777fa..5389538ab2 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for {@link RangePtg}. */ -public final class TestRangePtg extends AbstractPtgTestCase { +public final class TestRangePtg extends BaseTestPtg { /** * Tests reading a file containing this ptg. */ diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java index 2bea126dab..04de2cb6e3 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for Ref3DPtg */ -public final class TestRef3DPtg extends AbstractPtgTestCase { +public final class TestRef3DPtg extends BaseTestPtg { @Test public void testToFormulaString() throws IOException { diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java index 7d6fc3151c..446700f78d 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java @@ -28,7 +28,7 @@ import org.junit.Test; /** * Tests for {@link UnionPtg}. */ -public final class TestUnionPtg extends AbstractPtgTestCase { +public final class TestUnionPtg extends BaseTestPtg { /** * Tests reading a file containing this ptg. */ diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestRangeCopier.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestRangeCopier.java index 929abc35d4..f044b6f0b7 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/TestRangeCopier.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestRangeCopier.java @@ -19,16 +19,18 @@ package org.apache.poi.ss.usermodel; -import org.junit.Ignore; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellReference; - -import static org.junit.Assert.*; +import org.junit.Ignore; +import org.junit.Test; @Ignore -public abstract class TestRangeCopier { +public abstract class BaseTestRangeCopier { protected Sheet sheet1; protected Sheet sheet2; protected Workbook workbook; |