aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/extractor
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-11-30 14:22:06 +0000
committerNick Burch <nick@apache.org>2014-11-30 14:22:06 +0000
commit37f001274abe9cf19683a7005912d81766878b78 (patch)
tree5f5434c41641157dad735f0ca03e7941904154f0 /src/testcases/org/apache/poi/hssf/extractor
parent63fd48d501df365e277e5779475c769edeea9bf0 (diff)
downloadpoi-37f001274abe9cf19683a7005912d81766878b78.tar.gz
poi-37f001274abe9cf19683a7005912d81766878b78.zip
Begin adding Excel 5 support to OldExcelExtractor for TIKA-1490
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1642548 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/extractor')
-rw-r--r--src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
index f6c36e16c1..8c58f9e4f3 100644
--- a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
+++ b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
@@ -24,7 +24,8 @@ import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
/**
- * Unit tests for the Excel 4 (and older) text extractor
+ * Unit tests for the Excel 5/95 and Excel 4 (and older) text
+ * extractor
*/
public final class TestOldExcelExtractor extends TestCase {
private static OldExcelExtractor createExtractor(String sampleFileName) {
@@ -37,7 +38,7 @@ public final class TestOldExcelExtractor extends TestCase {
}
}
- public void testSimple() {
+ public void testSimpleExcel4() {
OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
// Check we can call getText without error
@@ -51,6 +52,22 @@ public final class TestOldExcelExtractor extends TestCase {
assertTrue(text, text.contains("11"));
assertTrue(text, text.contains("784"));
}
+ public void DISABLEDtestSimpleExcel5() {
+ for (String ver : new String[] {"5", "95"}) {
+ OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".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("Sample Excel"));
+ assertTrue(text, text.contains("Written and saved"));
+
+ // Check we find a few numbers we expect in there
+ assertTrue(text, text.contains("15"));
+ assertTrue(text, text.contains("169"));
+ }
+ }
public void testStrings() {
OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
@@ -71,7 +88,7 @@ public final class TestOldExcelExtractor extends TestCase {
// TODO Find some then test
}
- public void testFormattedNumbers() {
+ public void testFormattedNumbersExcel4() {
OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
String text = extractor.getText();
@@ -88,4 +105,17 @@ public final class TestOldExcelExtractor extends TestCase {
// assertTrue(text, text.contains("55,624"));
// assertTrue(text, text.contains("11,743,477"));
}
+ public void DISABLEDtestFormattedNumbersExcel5() {
+ for (String ver : new String[] {"5", "95"}) {
+ OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls");
+ String text = extractor.getText();
+
+ // Simple numbers
+ assertTrue(text, text.contains("1"));
+
+ // Numbers which come from formulas
+ assertTrue(text, text.contains("13"));
+ assertTrue(text, text.contains("169"));
+ }
+ }
}