]> source.dussan.org Git - poi.git/commitdiff
Test to show that bug #45544 is incorrect
authorNick Burch <nick@apache.org>
Tue, 5 Aug 2008 16:03:51 +0000 (16:03 +0000)
committerNick Burch <nick@apache.org>
Tue, 5 Aug 2008 16:03:51 +0000 (16:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@682769 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java
src/testcases/org/apache/poi/hssf/data/45544.xlsx [new file with mode: 0644]

index 70773ad54c7b8196f4623b497070be3a2022f651..b00d5228a4e25a6f2bd4056ed389bd41a2739aaf 100644 (file)
@@ -212,4 +212,29 @@ public class TestXSSFExcelExtractor extends TestCase {
                assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase")); 
                }
        }
+
+       /**
+        * From bug #45544
+        */
+       public void testComments() throws Exception {
+               File xml = new File(
+                               System.getProperty("HSSF.testdata.path") +
+                               File.separator + "45544.xlsx"
+               );
+               assertTrue(xml.exists());
+               
+               XSSFExcelExtractor extractor = 
+                       new XSSFExcelExtractor(new XSSFWorkbook(xml.toString()));
+               String text = extractor.getText();
+
+               // No comments there yet
+               assertFalse("Unable to find expected word in text\n" + text, text.contains("testdoc"));
+               assertFalse("Unable to find expected word in text\n" + text, text.contains("test phrase"));
+
+               // Turn on comment extraction, will then be
+               extractor.setIncludeCellComments(true);
+               text = extractor.getText();
+               assertTrue("Unable to find expected word in text\n" + text, text.contains("testdoc"));
+               assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase"));
+       }
 }
diff --git a/src/testcases/org/apache/poi/hssf/data/45544.xlsx b/src/testcases/org/apache/poi/hssf/data/45544.xlsx
new file mode 100644 (file)
index 0000000..2390e6d
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/45544.xlsx differ