Examples of HPBFDocument


Examples of org.apache.poi.hpbf.HPBFDocument

  /**
   * Test that the hyperlink extraction stuff works as well
   *  as we can hope it to.
   */
  public void testWithHyperlinks() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("LinkAt10.pub")
    );

    PublisherTextExtractor ext =
      new PublisherTextExtractor(doc);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

public final class TestEscherParts extends TestCase {
    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();

  public void testBasics() throws Exception {
    HPBFDocument doc = new HPBFDocument(
        _samples.openResourceAsStream("Sample.pub")
    );

    EscherStm es = doc.getEscherStm();
    EscherDelayStm eds = doc.getEscherDelayStm();

    assertNotNull(es);
    assertNotNull(eds);

    assertEquals(13, es.getEscherRecords().length);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    // TODO - check the contents
  }

  public void testComplex() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("SampleBrochure.pub")
    );

    EscherStm es = doc.getEscherStm();
    EscherDelayStm eds = doc.getEscherDelayStm();

    assertNotNull(es);
    assertNotNull(eds);

    assertEquals(30, es.getEscherRecords().length);
    assertEquals(19, eds.getEscherRecords().length);

    // TODO - check contents


    // Now do another complex file
    doc = new HPBFDocument(
                _samples.openResourceAsStream("SampleNewsletter.pub")
    );

    es = doc.getEscherStm();
    eds = doc.getEscherDelayStm();

    assertNotNull(es);
    assertNotNull(eds);

    assertEquals(51, es.getEscherRecords().length);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

public final class TestQuillContents extends TestCase {
    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();

  public void testBasics() throws Exception {
    HPBFDocument doc = new HPBFDocument(
        _samples.openResourceAsStream("Sample.pub")
    );

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);
    for(int i=0; i<19; i++) {
      assertNotNull(qc.getBits()[i]);
    }
    // Last one is blank
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    assertEquals("STSH", qc.getBits()[3].getBitType());
    assertEquals(2, qc.getBits()[3].getOptA());
  }

  public void testText() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("Sample.pub")
    );

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    QCTextBit text = (QCTextBit)qc.getBits()[0];
    String t = text.getText();
    assertTrue(t.startsWith("This is some text on the first page"));
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    assertTrue(t.startsWith("This is some text on the first page"));
    assertTrue(t.endsWith("Within doc to page 1\r"));
  }

  public void testPLC() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("Simple.pub")
    );

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    assertTrue(qc.getBits()[9] instanceof Type4);
    assertTrue(qc.getBits()[10] instanceof Type4);
    assertTrue(qc.getBits()[12] instanceof Type8);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    assertEquals(0x05, plc12.getPlcValA()[1]);
    assertEquals(0x04, plc12.getPlcValB()[1]);
  }

  public void testComplexPLC() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("Sample.pub")
    );

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    assertTrue(qc.getBits()[10] instanceof Type4);
    assertTrue(qc.getBits()[11] instanceof Type4);
    assertTrue(qc.getBits()[13] instanceof Type0);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    assertEquals(0x000004, plc16.getPlcValA()[5]);
    assertEquals(0x000004, plc16.getPlcValB()[5]);
  }

  public void testNoHyperlinks() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("SampleNewsletter.pub")
    );

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    Type12 plc18 = (Type12)qc.getBits()[18];

    assertEquals(1, plc18.getNumberOfPLCs());
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    assertEquals(0, plc18.getTextStartAt(0));
    assertEquals(601, plc18.getAllTextEndAt());
  }

  public void testSimpleHyperlink() throws Exception {
    HPBFDocument doc;
    QuillContents qc;
    Type12 hlBit;

    // Link at 10
    doc = new HPBFDocument(
                _samples.openResourceAsStream("LinkAt10.pub")
    );
    qc = doc.getQuillContents();

    hlBit = (Type12)qc.getBits()[12];
    assertEquals(1, hlBit.getNumberOfPLCs());
    assertEquals(1, hlBit.getNumberOfHyperlinks());

    assertEquals(10, hlBit.getTextStartAt(0));
    assertEquals(15, hlBit.getAllTextEndAt());
    assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));

    // Longer link at 10
    doc = new HPBFDocument(
                _samples.openResourceAsStream("LinkAt10Longer.pub")
    );
    qc = doc.getQuillContents();

    hlBit = (Type12)qc.getBits()[12];
    assertEquals(1, hlBit.getNumberOfPLCs());
    assertEquals(1, hlBit.getNumberOfHyperlinks());

    assertEquals(10, hlBit.getTextStartAt(0));
    assertEquals(15, hlBit.getAllTextEndAt());
    assertEquals("http://poi.apache.org/hpbf/", hlBit.getHyperlink(0));

    // Link at 20
    doc = new HPBFDocument(
                _samples.openResourceAsStream("LinkAt20.pub")
    );
    qc = doc.getQuillContents();

    hlBit = (Type12)qc.getBits()[12];
    assertEquals(1, hlBit.getNumberOfPLCs());
    assertEquals(1, hlBit.getNumberOfHyperlinks());
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    assertEquals(25, hlBit.getAllTextEndAt());
    assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));
  }

  public void testManyHyperlinks() throws Exception {
    HPBFDocument doc;
    QuillContents qc;
    Type12 hlBit;

    // Link at 10
    doc = new HPBFDocument(
                _samples.openResourceAsStream("LinkAt10.pub")
    );
    qc = doc.getQuillContents();

    hlBit = (Type12)qc.getBits()[12];
    assertEquals(1, hlBit.getNumberOfPLCs());
    assertEquals(1, hlBit.getNumberOfHyperlinks());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.