}
public void testHyperlinkDifferentVersions() throws Exception {
File f;
HPBFDocument doc;
QuillContents qc;
Type12 hlBitA;
Type12 hlBitB;
// Latest version
f = new File(dir, "Sample.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
hlBitA = (Type12)qc.getBits()[14];
assertEquals(2, hlBitA.getNumberOfPLCs());
assertEquals(2, hlBitA.getNumberOfHyperlinks());
assertEquals(25, hlBitA.getTextStartAt(0));
assertEquals(72, hlBitA.getTextStartAt(1));
assertEquals(87, hlBitA.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));
hlBitB = (Type12)qc.getBits()[15];
assertEquals(3, hlBitB.getNumberOfPLCs());
assertEquals(3, hlBitB.getNumberOfHyperlinks());
assertEquals(27, hlBitB.getTextStartAt(0));
assertEquals(37, hlBitB.getTextStartAt(1));
assertEquals(54, hlBitB.getTextStartAt(2));
assertEquals(75, hlBitB.getAllTextEndAt());
assertEquals("", hlBitB.getHyperlink(0));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(1));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));
// 2000 version
f = new File(dir, "Sample2000.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
hlBitA = (Type12)qc.getBits()[13];
assertEquals(2, hlBitA.getNumberOfPLCs());
assertEquals(2, hlBitA.getNumberOfHyperlinks());
assertEquals(25, hlBitA.getTextStartAt(0));
assertEquals(72, hlBitA.getTextStartAt(1));
assertEquals(87, hlBitA.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));
hlBitB = (Type12)qc.getBits()[14];
assertEquals(3, hlBitB.getNumberOfPLCs());
assertEquals(3, hlBitB.getNumberOfHyperlinks());
assertEquals(27, hlBitB.getTextStartAt(0));
assertEquals(37, hlBitB.getTextStartAt(1));
assertEquals(54, hlBitB.getTextStartAt(2));
assertEquals(75, hlBitB.getAllTextEndAt());
assertEquals("", hlBitB.getHyperlink(0));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(1));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));
// 98 version
f = new File(dir, "Sample98.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
hlBitA = (Type12)qc.getBits()[13];
assertEquals(2, hlBitA.getNumberOfPLCs());
assertEquals(2, hlBitA.getNumberOfHyperlinks());