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

TestFontBasisRecord

public class TestFontBasisRecord extends TestCase
Tests the serialization and deserialization of the FontBasisRecord 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 TestFontBasisRecord(String name)


      
    
        super(name);
    
Methods Summary
public voidtestLoad()


        FontBasisRecord record = new FontBasisRecord(new TestcaseRecordInputStream((short)0x1060, (short)data.length, data));
        assertEquals( 0x1a28, record.getXBasis());
        assertEquals( 0x0f9c, record.getYBasis());
        assertEquals( 0xc8, record.getHeightBasis());
        assertEquals( 0x00, record.getScale());
        assertEquals( 0x05, record.getIndexToFontTable());


        assertEquals( 14, record.getRecordSize() );

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

        FontBasisRecord record = new FontBasisRecord();
        record.setXBasis( (short)0x1a28 );
        record.setYBasis( (short)0x0f9c );
        record.setHeightBasis( (short)0xc8 );
        record.setScale( (short)0x00 );
        record.setIndexToFontTable( (short)0x05 );

        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]);