aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
diff options
context:
space:
mode:
authorJason Height <jheight@apache.org>2006-01-05 07:29:36 +0000
committerJason Height <jheight@apache.org>2006-01-05 07:29:36 +0000
commit64ea72b8952865137f35d32e7e98dec62e8b87d4 (patch)
tree31071cdf294fce1fda858d69db892f66b17b68f4 /src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
parent507017df2bfa3ba354faf58dac12d566efe49b8b (diff)
downloadpoi-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.java18
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