aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2007-12-05 10:51:20 +0000
committerNick Burch <nick@apache.org>2007-12-05 10:51:20 +0000
commit2644df3773441532477a94e324fae394bf36a963 (patch)
tree467480e47dce47f61eb3ae9b5b1b6bd9e2aab724 /src/testcases
parent612d99b8eba46cc7ce9a9c790082121d9849a6fb (diff)
downloadpoi-2644df3773441532477a94e324fae394bf36a963.tar.gz
poi-2644df3773441532477a94e324fae394bf36a963.zip
Stub out sheet hiding tests, so we have a framework for when sheet hiding is supported (bug #43937)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@601288 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/hssf/data/1900DateWindowing.xlsbin6144 -> 6144 bytes
-rw-r--r--src/testcases/org/apache/poi/hssf/data/1904DateWindowing.xlsbin6144 -> 6144 bytes
-rw-r--r--src/testcases/org/apache/poi/hssf/data/TwoSheetsNoneHidden.xlsbin0 -> 13824 bytes
-rw-r--r--src/testcases/org/apache/poi/hssf/data/TwoSheetsOneHidden.xlsbin0 -> 13824 bytes
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java105
5 files changed, 105 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/data/1900DateWindowing.xls b/src/testcases/org/apache/poi/hssf/data/1900DateWindowing.xls
index 33a57732ea..94fe5c1bec 100644
--- a/src/testcases/org/apache/poi/hssf/data/1900DateWindowing.xls
+++ b/src/testcases/org/apache/poi/hssf/data/1900DateWindowing.xls
Binary files differ
diff --git a/src/testcases/org/apache/poi/hssf/data/1904DateWindowing.xls b/src/testcases/org/apache/poi/hssf/data/1904DateWindowing.xls
index 7eda89e731..8c0dba1d7a 100644
--- a/src/testcases/org/apache/poi/hssf/data/1904DateWindowing.xls
+++ b/src/testcases/org/apache/poi/hssf/data/1904DateWindowing.xls
Binary files differ
diff --git a/src/testcases/org/apache/poi/hssf/data/TwoSheetsNoneHidden.xls b/src/testcases/org/apache/poi/hssf/data/TwoSheetsNoneHidden.xls
new file mode 100644
index 0000000000..969f01408e
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/data/TwoSheetsNoneHidden.xls
Binary files differ
diff --git a/src/testcases/org/apache/poi/hssf/data/TwoSheetsOneHidden.xls b/src/testcases/org/apache/poi/hssf/data/TwoSheetsOneHidden.xls
new file mode 100644
index 0000000000..940ffc0582
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/data/TwoSheetsOneHidden.xls
Binary files differ
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java b/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
new file mode 100644
index 0000000000..9628ab23e4
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
@@ -0,0 +1,105 @@
+/*
+* 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 java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for how HSSFWorkbook behaves with XLS files
+ * with a WORKBOOK directory entry (instead of the more
+ * usual, Workbook)
+ */
+public class TestSheetHiding extends TestCase {
+ private String dirPath;
+ private String xlsHidden = "TwoSheetsOneHidden.xls";
+ private String xlsShown = "TwoSheetsNoneHidden.xls";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ dirPath = System.getProperty("HSSF.testdata.path");
+ }
+
+ /**
+ * Test that we get the right number of sheets,
+ * with the right text on them, no matter what
+ * the hidden flags are
+ */
+ public void testTextSheets() throws Exception {
+ FileInputStream isH = new FileInputStream(dirPath + "/" + xlsHidden);
+ POIFSFileSystem fsH = new POIFSFileSystem(isH);
+
+ FileInputStream isU = new FileInputStream(dirPath + "/" + xlsShown);
+ POIFSFileSystem fsU = new POIFSFileSystem(isU);
+
+ HSSFWorkbook wbH = new HSSFWorkbook(fsH);
+ HSSFWorkbook wbU = new HSSFWorkbook(fsU);
+
+ // Both should have two sheets
+ assertEquals(2, wbH.sheets.size());
+ assertEquals(2, wbU.sheets.size());
+
+ // All sheets should have one row
+ assertEquals(0, wbH.getSheetAt(0).getLastRowNum());
+ assertEquals(0, wbH.getSheetAt(1).getLastRowNum());
+ assertEquals(0, wbU.getSheetAt(0).getLastRowNum());
+ assertEquals(0, wbU.getSheetAt(1).getLastRowNum());
+
+ // All rows should have one column
+ assertEquals(1, wbH.getSheetAt(0).getRow(0).getLastCellNum());
+ assertEquals(1, wbH.getSheetAt(1).getRow(0).getLastCellNum());
+ assertEquals(1, wbU.getSheetAt(0).getRow(0).getLastCellNum());
+ assertEquals(1, wbU.getSheetAt(1).getRow(0).getLastCellNum());
+
+ // Text should be sheet based
+ assertEquals("Sheet1A1", wbH.getSheetAt(0).getRow(0).getCell((short)0).getStringCellValue());
+ assertEquals("Sheet2A1", wbH.getSheetAt(1).getRow(0).getCell((short)0).getStringCellValue());
+ assertEquals("Sheet1A1", wbU.getSheetAt(0).getRow(0).getCell((short)0).getStringCellValue());
+ assertEquals("Sheet2A1", wbU.getSheetAt(1).getRow(0).getCell((short)0).getStringCellValue());
+ }
+
+ /**
+ * Check that we can get and set the hidden flags
+ * as expected
+ */
+ public void testHideUnHideFlags() throws Exception {
+ // TODO
+ }
+
+ /**
+ * Turn the sheet with none hidden into the one with
+ * one hidden
+ */
+ public void testHide() throws Exception {
+ // TODO
+ }
+
+ /**
+ * Turn the sheet with one hidden into the one with
+ * none hidden
+ */
+ public void testUnHide() throws Exception {
+ // TODO
+ }
+}