aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-11-30 00:16:23 +0000
committerNick Burch <nick@apache.org>2014-11-30 00:16:23 +0000
commit73bd034c79196d325f9b16716ff634a2430748da (patch)
tree4aba8ead2c7faac6e7dbf6cfbff3bbb149e9e192 /src/testcases/org
parent5d3db739dba09f12de275755859b6ea4296bd92d (diff)
downloadpoi-73bd034c79196d325f9b16716ff634a2430748da.tar.gz
poi-73bd034c79196d325f9b16716ff634a2430748da.zip
Start on a Text Extractor for the pre-OLE2 Excel formats like Excel 4, for TIKA-1490
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1642490 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r--src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java1
-rw-r--r--src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java52
2 files changed, 53 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
index ff8e18937e..b7013c1503 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
@@ -38,6 +38,7 @@ public class TestBiffViewer extends BaseXLSIteratingTest {
SILENT_EXCLUDED.add("46904.xls");
SILENT_EXCLUDED.add("35897-type4.xls"); // unsupported crypto api header
SILENT_EXCLUDED.add("xor-encryption-abc.xls"); // unsupported XOR-encryption
+ SILENT_EXCLUDED.add("testEXCEL_4.xls"); // Biff 4 / Excel 4, pre-OLE2
}
@Override
diff --git a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
new file mode 100644
index 0000000000..a5c7dbedc2
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
@@ -0,0 +1,52 @@
+/* ====================================================================
+ 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.extractor;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.poi.hssf.HSSFTestDataSamples;
+
+/**
+ * Unit tests for the Excel 4 (and older) text extractor
+ */
+public final class TestOldExcelExtractor extends TestCase {
+ private static OldExcelExtractor createExtractor(String sampleFileName) {
+ InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleFileName);
+
+ try {
+ return new OldExcelExtractor(is);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testSimple() {
+ OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
+
+ // Check we can call getText without error
+ String text = extractor.getText();
+
+ // Check we find a few words we expect in there
+ assertTrue(text, text.contains("Size"));
+ assertTrue(text, text.contains("Returns"));
+ }
+
+ // TODO Rest of the tests
+}