diff options
author | Jason Height <jheight@apache.org> | 2006-01-05 07:29:36 +0000 |
---|---|---|
committer | Jason Height <jheight@apache.org> | 2006-01-05 07:29:36 +0000 |
commit | 64ea72b8952865137f35d32e7e98dec62e8b87d4 (patch) | |
tree | 31071cdf294fce1fda858d69db892f66b17b68f4 /src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java | |
parent | 507017df2bfa3ba354faf58dac12d566efe49b8b (diff) | |
download | poi-64ea72b8952865137f35d32e7e98dec62e8b87d4.tar.gz poi-64ea72b8952865137f35d32e7e98dec62e8b87d4.zip |
Multiple clone of same sheet now generates unique sheet name BUG 37416 fixed.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@366110 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index a603c27532..e21bacdfc3 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -204,6 +204,24 @@ public class TestHSSFSheet cell.setCellValue("Difference Check"); assertEquals(cloned.getRow((short)0).getCell((short)0).getStringCellValue(), "clone_test"); } + + /** tests that the sheet name for multiple clones of the same sheet is unique + * BUG 37416 + */ + public void testCloneSheetMultipleTimes() { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("Test Clone"); + HSSFRow row = sheet.createRow((short) 0); + HSSFCell cell = row.createCell((short) 0); + cell.setCellValue("clone_test"); + //Clone the sheet multiple times + workbook.cloneSheet(0); + workbook.cloneSheet(0); + + assertNotNull(workbook.getSheet("Test Clone")); + assertNotNull(workbook.getSheet("Test Clone(1)")); + assertNotNull(workbook.getSheet("Test Clone(2)")); + } /** * Test that the ProtectRecord is included when creating or cloning a sheet |