diff options
author | Nick Burch <nick@apache.org> | 2008-02-01 15:41:32 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-02-01 15:41:32 +0000 |
commit | feeb8cca63644fa9da275979943748875c6dfb94 (patch) | |
tree | a3442a5b9236339f5ec522a093129a40fb51d543 /src/testcases/org/apache | |
parent | dafc074271c69a561a243e58a9f78cd9bc24bcf4 (diff) | |
download | poi-feeb8cca63644fa9da275979943748875c6dfb94.tar.gz poi-feeb8cca63644fa9da275979943748875c6dfb94.zip |
Get the Hyperlink record code so that it doesn't break any existing tests, and add in (no usermodel support yet though)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@617523 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/data/WithHyperlink.xls | bin | 0 -> 31232 bytes | |||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java | 47 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java | 6 |
3 files changed, 53 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/data/WithHyperlink.xls b/src/testcases/org/apache/poi/hssf/data/WithHyperlink.xls Binary files differnew file mode 100644 index 0000000000..7d7468495d --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/data/WithHyperlink.xls diff --git a/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java b/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java index 587548b48f..983b916015 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java @@ -56,6 +56,37 @@ public class TestHyperlinkRecord extends TestCase { 0, 110, 0, 103, 0, 115, 0, 46, 0, 99, 0, 111, 0, 109, 0, 0, 0 }; + + private byte[] data2 = new byte[] { + -72, 1, -126, 0, + // Row, col, xf, ?? + 2, 0, 2, 0, 4, 0, 4, 0, + + // ?? + -48, -55, -22, 121, -7, -70, -50, 17, + -116, -126, 0, -86, 0, 75, -87, 11, + 2, 0, 0, 0, + + // URL and Label lengths + 23, 0, 0, 0, + 15, 0, 0, 0, + + // Label + 83, 0, 116, 0, 97, 0, 99, 0, 105, 0, + 101, 0, 64, 0, 65, 0, 66, 0, 67, 0, + 46, 0, 99, 0, 111, 0, 109, 0, 0, 0, + + // ?? + -32, -55, -22, 121, -7, -70, -50, 17, + -116, -126, 0, -86, 0, 75, -87, 11, + 44, 0, 0, 0, + + // URL + 109, 0, 97, 0, 105, 0, 108, 0, 116, 0, + 111, 0, 58, 0, 83, 0, 116, 0, 97, 0, + 99, 0, 105, 0, 101, 0, 64, 0, 65, 0, + 66, 0, 67, 0, 46, 0, 99, 0, 111, 0, + 109, 0, 0, 0 }; public void testRecordParsing() throws Exception { RecordInputStream inp = new RecordInputStream( @@ -81,4 +112,20 @@ public class TestHyperlinkRecord extends TestCase { assertEquals(data[i], d[i]); } } + + public void testSecondRecord() throws Exception { + RecordInputStream inp = new RecordInputStream( + new ByteArrayInputStream(data2) + ); + inp.nextRecord(); + + HyperlinkRecord r = new HyperlinkRecord(inp); + + assertEquals(2, r.getRow()); + assertEquals(2, r.getColumn()); + assertEquals(4, r.getXFIndex()); + + assertEquals("Stacie@ABC.com", r.getLabel()); + assertEquals("mailto:Stacie@ABC.com", r.getUrlString()); + } } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java index ee3cace263..482ae7c6cd 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java @@ -310,6 +310,12 @@ extends TestCase { in.close(); } + public void testWithHyperlinks() throws Exception { + String dir = System.getProperty("HSSF.testdata.path"); + File f = new File(dir, "WithHyperlink.xls"); + HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(f)); + } + /*tests the toString() method of HSSFCell*/ public void testToString() throws Exception { HSSFWorkbook wb = new HSSFWorkbook(); |