Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java?rev=1711171&r1=1711170&r2=1711171&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java Thu Oct 29 01:05:27 2015 @@ -91,7 +91,7 @@ public final class TestShapes { java.awt.Rectangle lineAnchor = new java.awt.Rectangle(100, 200, 50, 60); line.setAnchor(lineAnchor); line.setLineWidth(3); - line.setLineDashing(LineDash.DASH); + line.setLineDash(LineDash.DASH); line.setLineColor(Color.red); slide.addShape(line); @@ -99,7 +99,7 @@ public final class TestShapes { java.awt.Rectangle ellipseAnchor = new Rectangle(320, 154, 55, 111); ellipse.setAnchor(ellipseAnchor); ellipse.setLineWidth(2); - ellipse.setLineDashing(LineDash.SOLID); + ellipse.setLineDash(LineDash.SOLID); ellipse.setLineColor(Color.green); ellipse.setFillColor(Color.lightGray); slide.addShape(ellipse);
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=1711171&r1=1711170&r2=1711171&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Thu Oct 29 01:05:27 2015 @@ -57,15 +57,15 @@ public final class TestTable { HSLFSlide slide = ppt.createSlide(); - HSLFTable tbl = new HSLFTable(2, 5); - slide.addShape(tbl); + HSLFTable tbl = slide.createTable(2, 5); HSLFTableCell cell = tbl.getCell(0, 0); //table cells have type=TextHeaderAtom.OTHER_TYPE, see bug #46033 assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextParagraphs().get(0).getRunType()); - assertTrue(slide.getShapes().get(0) instanceof HSLFTable); - HSLFTable tbl2 = (HSLFTable)slide.getShapes().get(0); + HSLFShape tblSh = slide.getShapes().get(0); + assertTrue(tblSh instanceof HSLFTable); + HSLFTable tbl2 = (HSLFTable)tblSh; assertEquals(tbl.getNumberOfColumns(), tbl2.getNumberOfColumns()); assertEquals(tbl.getNumberOfRows(), tbl2.getNumberOfRows()); @@ -89,10 +89,9 @@ public final class TestTable { HSLFSlideShow ppt = new HSLFSlideShow(); HSLFSlide slide = ppt.createSlide(); List<HSLFShape> shapes; - HSLFTable tbl1 = new HSLFTable(1, 5); + HSLFTable tbl1 = slide.createTable(1, 5); assertEquals(5, tbl1.getNumberOfColumns()); assertEquals(1, tbl1.getNumberOfRows()); - slide.addShape(tbl1); shapes = slide.getShapes(); assertEquals(1, shapes.size()); @@ -106,14 +105,16 @@ public final class TestTable { @Test public void testIllegalCOnstruction(){ + HSLFSlideShow ppt = new HSLFSlideShow(); + HSLFSlide slide = ppt.createSlide(); try { - new HSLFTable(0, 5); + slide.createTable(0, 5); fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1"); } catch (IllegalArgumentException e){ } try { - new HSLFTable(5, 0); + slide.createTable(5, 0); fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1"); } catch (IllegalArgumentException e){ Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java?rev=1711171&r1=1711170&r2=1711171&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java Thu Oct 29 01:05:27 2015 @@ -19,23 +19,50 @@ package org.apache.poi.hslf.usermodel; -import static org.junit.Assert.*; +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 java.awt.Color; +import java.awt.Rectangle; import java.util.List; import org.apache.poi.POIDataSamples; +import org.apache.poi.sl.draw.DrawTableShape; +import org.apache.poi.sl.usermodel.StrokeStyle; import org.junit.Test; /** - * Test that checks numbered list functionality. - * - * @author Alex Nikiforov [mailto:[email protected]] + * Table related tests */ public class TestTable { private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance(); @Test + public void moveTable() throws Exception { + HSLFSlideShow ppt = new HSLFSlideShow(); + HSLFSlide slide = ppt.createSlide(); + int rows = 3, cols = 5; + HSLFTable table = slide.createTable(rows, cols); + for (int row=0; row<rows; row++) { + for (int col=0; col<cols; col++) { + HSLFTableCell c = table.getCell(row, col); + c.setText("r"+row+"c"+col); + } + } + + new DrawTableShape(table).setAllBorders(1.0, Color.black, StrokeStyle.LineDash.DASH_DOT); + + table.setAnchor(new Rectangle(100, 100, 400, 400)); + + Rectangle rectExp = new Rectangle(420,367,80,133); + Rectangle rectAct = table.getCell(rows-1, cols-1).getAnchor(); + assertEquals(rectExp, rectAct); + } + + @Test public void testTable() throws Exception { HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("54111.ppt")); assertTrue("No Exceptions while reading file", true); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java?rev=1711171&r1=1711170&r2=1711171&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java Thu Oct 29 01:05:27 2015 @@ -571,4 +571,13 @@ public final class TestTextRun { } } + @Test + public void testAppendEmpty() throws IOException { + HSLFSlideShow ppt = new HSLFSlideShow(); + HSLFSlide s = ppt.createSlide(); + HSLFTextBox title = s.addTitle(); + title.setText(""); + title.appendText("\n", true); + title.appendText("para", true); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
