View | Details | Raw Unified | Return to bug 34787
Collapse All | Expand All

(-)TestEscherClientAnchorRecord.java (+28 lines)
Lines 88-93 Link Here
88
        assertEquals( expected, createRecord().toString() );
88
        assertEquals( expected, createRecord().toString() );
89
    }
89
    }
90
90
91
    public void testShortRecord() throws Exception
92
    {
93
        String hexData = "00 00 " +
94
                "10 F0 " +
95
                "08 00 00 00 " +
96
                "AD 00 20 01 60 15 7D 03";
97
        byte[] data = HexRead.readFromString( hexData );
98
        EscherClientAnchorRecord r = new EscherClientAnchorRecord();
99
        int bytesWritten = r.fillFields( data, new DefaultEscherRecordFactory() );
100
101
        assertEquals( 16, bytesWritten );
102
        assertEquals( (short) 173, r.getFlag() );
103
        assertEquals( (short) 288, r.getCol1() );
104
        assertEquals( (short) 5472, r.getDx1() );
105
        assertEquals( (short) 893, r.getRow1() );
106
107
		// Check #5 isn't set
108
        assertEquals( (short) 0, r.getDy1() );
109
110
		// Check writes back out correctly
111
		byte[] outData = new byte[data.length];
112
        bytesWritten = r.serialize( 0, outData, new NullEscherSerializationListener() );
113
        assertEquals( 16, bytesWritten );
114
		for(int i=0; i<data.length; i++) {
115
			assertEquals( data[i], outData[i] );
116
		}
117
	}
118
91
    private EscherClientAnchorRecord createRecord()
119
    private EscherClientAnchorRecord createRecord()
92
    {
120
    {
93
        EscherClientAnchorRecord r = new EscherClientAnchorRecord();
121
        EscherClientAnchorRecord r = new EscherClientAnchorRecord();

Return to bug 34787