FileDocCategorySizeDatePackage
TestCommonObjectDataSubRecord.javaAPI DocApache Poi 3.0.13366Mon Jan 01 12:39:46 GMT 2007org.apache.poi.hssf.record

TestCommonObjectDataSubRecord

public class TestCommonObjectDataSubRecord extends TestCase
Tests the serialization and deserialization of the CommonObjectDataSubRecord class works correctly. Test data taken directly from a real Excel file.
author
Glen Stampoultzis (glens at apache.org)

Fields Summary
byte[]
data
Constructors Summary
public TestCommonObjectDataSubRecord(String name)


      
    
        super(name);
    
Methods Summary
public voidtestLoad()

        CommonObjectDataSubRecord record = new CommonObjectDataSubRecord(new TestcaseRecordInputStream((short)0x15, (short)data.length, data));
        

        assertEquals( CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX, record.getObjectType());
        assertEquals( (short)1, record.getObjectId());
        assertEquals( (short)1, record.getOption());
        assertEquals( true , record.isLocked() );
        assertEquals( false, record.isPrintable() );
        assertEquals( false, record.isAutofill() );
        assertEquals( false, record.isAutoline() );
        assertEquals( (int)24593, record.getReserved1());
        assertEquals( (int)218103808, record.getReserved2());
        assertEquals( (int)294, record.getReserved3());
        assertEquals( 22 , record.getRecordSize() );

        record.validateSid((short)0x15);
    
public voidtestStore()

        CommonObjectDataSubRecord record = new CommonObjectDataSubRecord();

        record.setObjectType( CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX );
        record.setObjectId( (short) 1);
        record.setOption( (short) 1);
        record.setLocked( true );
        record.setPrintable( false );
        record.setAutofill( false );
        record.setAutoline( false );
        record.setReserved1( (int) 24593);
        record.setReserved2( (int) 218103808);
        record.setReserved3( (int) 294);

        byte [] recordBytes = record.serialize();
        assertEquals(recordBytes.length - 4, data.length);
        for (int i = 0; i < data.length; i++)
            assertEquals("At offset " + i, data[i], recordBytes[i+4]);