diff options
author | Nick Burch <nick@apache.org> | 2008-01-09 10:59:04 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-01-09 10:59:04 +0000 |
commit | 7b605f32e11d44af4af9f12f0e33ea511c433507 (patch) | |
tree | e1d586d8887f3e94664fac5fc5c749caa4004d08 /src/testcases | |
parent | f97d12c2d52203774d579fac08be27759b9ae4dd (diff) | |
download | poi-7b605f32e11d44af4af9f12f0e33ea511c433507.tar.gz poi-7b605f32e11d44af4af9f12f0e33ea511c433507.zip |
Add clone methods to DrawingRecord and AbstractEscherHolderRecord, which allows cloning of some sheets with drawing objects on them. Fixes bug #31795
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@610336 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/data/SheetWithDrawing.xls | bin | 0 -> 17408 bytes | |||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java | 20 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/data/SheetWithDrawing.xls b/src/testcases/org/apache/poi/hssf/data/SheetWithDrawing.xls Binary files differnew file mode 100644 index 0000000000..e1395291b0 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/data/SheetWithDrawing.xls diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index 8a83abde64..6d5afca114 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -109,4 +109,24 @@ public class TestHSSFWorkbook extends TestCase assertEquals(b.getSelectedTab(), 1); assertEquals(b.getDisplayedTab(), 1); } + + public void testSheetClone() throws Exception { + // First up, try a simple file + HSSFWorkbook b = new HSSFWorkbook(); + assertEquals(0, b.getNumberOfSheets()); + b.createSheet("Sheet One"); + b.createSheet("Sheet Two"); + + assertEquals(2, b.getNumberOfSheets()); + b.cloneSheet(0); + assertEquals(3, b.getNumberOfSheets()); + + // Now try a problem one with drawing records in it + b = new HSSFWorkbook( + new FileInputStream(new File(filename,"SheetWithDrawing.xls")) + ); + assertEquals(1, b.getNumberOfSheets()); + b.cloneSheet(0); + assertEquals(2, b.getNumberOfSheets()); + } }
\ No newline at end of file |