1 16 17 package org.apache.poi.hssf.record; 18 19 import junit.framework.TestCase; 20 import org.apache.poi.ddf.EscherContainerRecord; 21 import org.apache.poi.ddf.EscherSpRecord; 22 import org.apache.poi.util.HexDump; 23 24 public class TestDrawingGroupRecord extends TestCase 25 { 26 public void testGetRecordSize() 27 throws Exception 28 { 29 DrawingGroupRecord r = new DrawingGroupRecord(); 30 assertEquals(4, r.getRecordSize()); 31 32 EscherSpRecord sp = new EscherSpRecord(); 33 sp.setRecordId(EscherSpRecord.RECORD_ID); 34 sp.setOptions((short) 0x1111); 35 sp.setFlags(-1); 36 sp.setShapeId(-1); 37 EscherContainerRecord dggContainer = new EscherContainerRecord(); 38 dggContainer.setOptions((short) 0x000F); 39 dggContainer.setRecordId((short) 0xF000); 40 dggContainer.addChildRecord(sp); 41 42 r.addEscherRecord(dggContainer); 43 assertEquals(28, r.getRecordSize()); 44 45 byte[] data = new byte[28]; 46 int size = r.serialize(0, data); 47 assertEquals("[EB, 00, 18, 00, 0F, 00, 00, F0, 10, 00, 00, 00, 11, 11, 0A, F0, 08, 00, 00, 00, FF, FF, FF, FF, FF, FF, FF, FF, ]", HexDump.toHex(data)); 48 assertEquals(28, size); 49 50 assertEquals(24, dggContainer.getRecordSize()); 51 } 52 } 53 | Popular Tags |