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

TestAreaFormatRecord

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


      
    
        super(name);
    
Methods Summary
public voidtestLoad()


        AreaFormatRecord record = new AreaFormatRecord(new TestcaseRecordInputStream((short)0x100a, (short)data.length, data));
        assertEquals( 0xFFFFFF, record.getForegroundColor());
        assertEquals( 0x000000, record.getBackgroundColor());
        assertEquals( 1, record.getPattern());
        assertEquals( 1, record.getFormatFlags());
        assertEquals( true, record.isAutomatic() );
        assertEquals( false, record.isInvert() );
        assertEquals( 0x4e, record.getForecolorIndex());
        assertEquals( 0x4d, record.getBackcolorIndex());


        assertEquals( 20, record.getRecordSize() );

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

        AreaFormatRecord record = new AreaFormatRecord();
        record.setForegroundColor( 0xFFFFFF );
        record.setBackgroundColor( 0x000000 );
        record.setPattern( (short)1 );
        record.setAutomatic( true );
        record.setInvert( false );
        record.setForecolorIndex( (short)0x4e );
        record.setBackcolorIndex( (short)0x4d );


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