Package org.apache.poi.hssf.record

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


            throws Exception
    {
        byte[] header = HexRead.readData( _test_file_path + File.separator + "evencontinuation.txt", "header" );
        byte[] continueBytes = HexRead.readData( _test_file_path + File.separator + "evencontinuation.txt", "continue1" );
        continueBytes = TestcaseRecordInputStream.mergeDataAndSid(ContinueRecord.sid, (short)continueBytes.length, continueBytes);
        TestcaseRecordInputStream in = new TestcaseRecordInputStream((short)0, (short)header.length, joinArray(header, continueBytes));

        IntMapper strings = new IntMapper();
        SSTDeserializer deserializer = new SSTDeserializer( strings );
        deserializer.manufactureStrings( 2, in);
View Full Code Here


        byte[] continue2 = HexRead.readData( _test_file_path + File.separator + "stringacross2continuations.txt", "continue2" );
        continue2 = TestcaseRecordInputStream.mergeDataAndSid(ContinueRecord.sid, (short)continue2.length, continue2);
       
        byte[] bytes = joinArray(header, continue1);
        bytes = joinArray(bytes, continue2);
        TestcaseRecordInputStream in = new TestcaseRecordInputStream((short)0, (short)header.length, bytes);

        IntMapper strings = new IntMapper();
        SSTDeserializer deserializer = new SSTDeserializer( strings );
        deserializer.manufactureStrings( 2, in);
View Full Code Here

            throws Exception
    {
        byte[] header = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "rich-header" );
        byte[] continueBytes = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "rich-continue1" );
        continueBytes = TestcaseRecordInputStream.mergeDataAndSid(ContinueRecord.sid, (short)continueBytes.length, continueBytes);
        TestcaseRecordInputStream in = new TestcaseRecordInputStream((short)0, (short)header.length, joinArray(header, continueBytes));
       
        IntMapper strings = new IntMapper();
        SSTDeserializer deserializer = new SSTDeserializer( strings );
        deserializer.manufactureStrings( 1, in);

        assertEquals( "At a dinner party orAt At At ", strings.get( ) + "" );


        header = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "norich-header" );
        continueBytes = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "norich-continue1" );
        continueBytes = TestcaseRecordInputStream.mergeDataAndSid(ContinueRecord.sid, (short)continueBytes.length, continueBytes);
        in = new TestcaseRecordInputStream((short)0, (short)header.length, joinArray(header, continueBytes));
       
        strings = new IntMapper();
        deserializer = new SSTDeserializer( strings );
        deserializer.manufactureStrings( 1, in);
View Full Code Here

        byte[] fakeData = {
            0x20//function index
            0,
        };

        FuncPtg ptg = new FuncPtg( new TestcaseRecordInputStream((short)0, (short)fakeData.length, fakeData) );
        assertEquals( "Len formula index is not 32(20H)", 0x20, ptg.getFunctionIndex() );
        assertEquals( "Number of operands in the len formula", 1, ptg.getNumberOfOperands() );
        assertEquals( "Function Name", "LEN", ptg.getName() );
        assertEquals( "Ptg Size", 3, ptg.getSize() );
    }
View Full Code Here

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

  /**
   * make sure constant elements are stored row by row
   */
  public void testElementOrdering() {
    ArrayPtg ptg = new ArrayPtgV(new TestcaseRecordInputStream(ArrayPtgV.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

  /**
   * 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(6, 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(2, ptg.getValueIndex(1, 0));
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

       
        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

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.