Package org.apache.poi.hssf.record

Examples of org.apache.poi.hssf.record.TestcaseRecordInputStream


       
        bytes = bof.serialize();
        nbytes = new byte[bytes.length - 4];
        System.arraycopy(bytes,4,nbytes,0,nbytes.length);
           
        records = factory.createRecord(new TestcaseRecordInputStream(bof.getSid(),(short)nbytes.length,nbytes));
       
        assertTrue("record.length must be 1, was ="+records.length,records.length == 1);
        assertTrue("record is the same", compareRec(bof,records[0]));
       
    }
View Full Code Here


       
        byte[] bytes = bof.serialize();
        byte[] nbytes = new byte[bytes.length - 4];
        System.arraycopy(bytes,4,nbytes,0,nbytes.length);
           
        Record[] records = RecordFactory.createRecord(new TestcaseRecordInputStream(bof.getSid(),(short)nbytes.length,nbytes));
       
        assertTrue("record.length must be 1, was ="+records.length,records.length == 1);
        assertTrue("record is the same", compareRec(bof,records[0]));
       
    }
View Full Code Here

  /**
   * Lots of problems with ArrayPtg's encoding of
   */
  public void testReadWriteTokenValueBytes() {
   
    ArrayPtg ptg = new ArrayPtg(new TestcaseRecordInputStream(ArrayPtg.sid, ENCODED_PTG_DATA));
   
    ptg.readTokenValues(new TestcaseRecordInputStream(0, ENCODED_CONSTANT_DATA));
    assertEquals(3, ptg.getColumnCount());
    assertEquals(2, ptg.getRowCount());
    Object[][] values = ptg.getTokenArrayValues();
    assertEquals(2, values.length);
   
View Full Code Here

  /**
   * Excel stores array elements column by column.  This test makes sure POI does the same.
   */
  public void testElementOrdering() {
    ArrayPtg ptg = new ArrayPtg(new TestcaseRecordInputStream(ArrayPtg.sid, ENCODED_PTG_DATA));
    ptg.readTokenValues(new TestcaseRecordInputStream(0, ENCODED_CONSTANT_DATA));
    assertEquals(3, ptg.getColumnCount());
    assertEquals(2, ptg.getRowCount());
   
    assertEquals(0, ptg.getValueIndex(0, 0));
    assertEquals(1, ptg.getValueIndex(1, 0));
View Full Code Here

    }
    assertEquals("SUM({1.0,2.0,3.0,4.0,5.0;6.0,7.0,8.0,9.0,10.0;11.0,12.0,13.0,14.0,15.0})", formula);
  }

  public void testToFormulaString() {
    ArrayPtg ptg = new ArrayPtg(new TestcaseRecordInputStream(ArrayPtg.sid, ENCODED_PTG_DATA));
   
    ptg.readTokenValues(new TestcaseRecordInputStream(0, ENCODED_CONSTANT_DATA));
   
    String actualFormula;
    try {
      actualFormula = ptg.toFormulaString();
    } catch (IllegalArgumentException e) {
View Full Code Here

    System.arraycopy(ENCODED_CONSTANT_DATA, 0, fullData, ENCODED_PTG_DATA.length, ENCODED_CONSTANT_DATA.length);

    // Force encoded operand class for tArray
    fullData[0] = (byte) (ArrayPtg.sid + operandClass);
   
    RecordInputStream in = new TestcaseRecordInputStream(ArrayPtg.sid, fullData);
   
    Ptg[] ptgs = Ptg.readTokens(ENCODED_PTG_DATA.length, in);
    assertEquals(1, ptgs.length);
    ArrayPtg aPtg = (ArrayPtg) ptgs[0];
    assertEquals(operandClass, aPtg.getPtgClass());
View Full Code Here

    }
    private static final byte[] tRefN_data = {
      0x2C, 33, 44, 55, 66,
    };
    public void testReadWrite_tRefN_bug45091() {
        TestcaseRecordInputStream in = new TestcaseRecordInputStream(-1, tRefN_data);
        Stack ptgs = Ptg.createParsedExpressionTokens((short)tRefN_data.length, in);
        byte[] outData = new byte[5];
        Ptg.serializePtgStack(ptgs, outData, 0);
        if (outData[0] == 0x24) {
            throw new AssertionFailedError("Identified bug 45091");
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.TestcaseRecordInputStream

Copyright © 2018 www.massapicom. 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.