Search in sources :

Example 1 with PageItemRecord

use of org.apache.poi.hssf.record.pivottable.PageItemRecord in project poi by apache.

the class TestPageItemRecord method confirmSerialize.

private static PageItemRecord confirmSerialize(String hexDump) {
    byte[] data = HexRead.readFromString(hexDump);
    RecordInputStream in = TestcaseRecordInputStream.create(PageItemRecord.sid, data);
    PageItemRecord rec = new PageItemRecord(in);
    assertEquals(0, in.remaining());
    assertEquals(4 + data.length, rec.getRecordSize());
    byte[] data2 = rec.serialize();
    TestcaseRecordInputStream.confirmRecordEncoding(PageItemRecord.sid, data, data2);
    return rec;
}
Also used : PageItemRecord(org.apache.poi.hssf.record.pivottable.PageItemRecord) RecordInputStream(org.apache.poi.hssf.record.RecordInputStream) TestcaseRecordInputStream(org.apache.poi.hssf.record.TestcaseRecordInputStream)

Example 2 with PageItemRecord

use of org.apache.poi.hssf.record.pivottable.PageItemRecord in project poi by apache.

the class TestPageItemRecord method testMoreThanOneInfoItem_bug46917.

public void testMoreThanOneInfoItem_bug46917() {
    byte[] data = HexRead.readFromString("01 02 03 04 05 06 07 08 09 0A 0B 0C");
    RecordInputStream in = TestcaseRecordInputStream.create(PageItemRecord.sid, data);
    PageItemRecord rec = new PageItemRecord(in);
    if (in.remaining() == 6) {
        throw new AssertionFailedError("Identified bug 46917");
    }
    assertEquals(0, in.remaining());
    assertEquals(4 + data.length, rec.getRecordSize());
}
Also used : PageItemRecord(org.apache.poi.hssf.record.pivottable.PageItemRecord) AssertionFailedError(junit.framework.AssertionFailedError) RecordInputStream(org.apache.poi.hssf.record.RecordInputStream) TestcaseRecordInputStream(org.apache.poi.hssf.record.TestcaseRecordInputStream)

Aggregations

RecordInputStream (org.apache.poi.hssf.record.RecordInputStream)2 TestcaseRecordInputStream (org.apache.poi.hssf.record.TestcaseRecordInputStream)2 PageItemRecord (org.apache.poi.hssf.record.pivottable.PageItemRecord)2 AssertionFailedError (junit.framework.AssertionFailedError)1