FileDocCategorySizeDatePackage
TestEscherSplitMenuColorsRecord.javaAPI DocApache Poi 3.0.13389Mon Jan 01 12:39:46 GMT 2007org.apache.poi.ddf

TestEscherSplitMenuColorsRecord

public class TestEscherSplitMenuColorsRecord extends TestCase

Fields Summary
Constructors Summary
Methods Summary
private org.apache.poi.ddf.EscherSplitMenuColorsRecordcreateRecord()

        EscherSplitMenuColorsRecord r = new EscherSplitMenuColorsRecord();
        r.setOptions( (short) 0x0040 );
        r.setRecordId( EscherSplitMenuColorsRecord.RECORD_ID );
        r.setColor1( 0x402  );
        r.setColor2( 0x2 );
        r.setColor3( 0x2 );
        r.setColor4( 0x1 );
        return r;
    
public voidtestFillFields()

        String hexData = "40 00 " +
                "1E F1 " +
                "10 00 00 00 " +
                "02 04 00 00 " +
                "02 00 00 00 " +
                "02 00 00 00 " +
                "01 00 00 00 ";
        byte[] data = HexRead.readFromString( hexData );
        EscherSplitMenuColorsRecord r = new EscherSplitMenuColorsRecord();
        int bytesWritten = r.fillFields( data, new DefaultEscherRecordFactory() );

        assertEquals( 24, bytesWritten );
        assertEquals( 0x0402, r.getColor1() );
        assertEquals( 0x02, r.getColor2() );
        assertEquals( 0x02, r.getColor3() );
        assertEquals( 0x01, r.getColor4() );
    
public voidtestSerialize()

        EscherSplitMenuColorsRecord r = createRecord();

        byte[] data = new byte[24];
        int bytesWritten = r.serialize( 0, data, new NullEscherSerializationListener() );
        assertEquals( 24, bytesWritten );
        assertEquals( "[40, 00, " +
                "1E, F1, " +
                "10, 00, 00, 00, " +
                "02, 04, 00, 00, " +
                "02, 00, 00, 00, " +
                "02, 00, 00, 00, " +
                "01, 00, 00, 00, ]",
                HexDump.toHex( data ) );
    
public voidtestToString()

        String nl = System.getProperty("line.separator");

        String expected = "org.apache.poi.ddf.EscherSplitMenuColorsRecord:" + nl +
                "  RecordId: 0xF11E" + nl +
                "  Options: 0x0040" + nl +
                "  Color1: 0x00000402" + nl +
                "  Color2: 0x00000002" + nl +
                "  Color3: 0x00000002" + nl +
                "  Color4: 0x00000001" + nl +
                "";
        assertEquals( expected, createRecord().toString() );