1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 32 public class TestAxisParentRecord 33 extends TestCase 34 { 35 byte[] data = new byte[] { 36 (byte)0x00,(byte)0x00, (byte)0x1D,(byte)0x02,(byte)0x00,(byte)0x00, (byte)0xDD,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x31,(byte)0x0B,(byte)0x00,(byte)0x00, (byte)0x56,(byte)0x0B,(byte)0x00,(byte)0x00 }; 42 43 public TestAxisParentRecord(String name) 44 { 45 super(name); 46 } 47 48 public void testLoad() 49 throws Exception 50 { 51 AxisParentRecord record = new AxisParentRecord((short)0x1041, (short)data.length, data); 52 assertEquals( AxisParentRecord.AXIS_TYPE_MAIN, record.getAxisType()); 53 assertEquals( 0x021d, record.getX()); 54 assertEquals( 0xdd, record.getY()); 55 assertEquals( 0x0b31, record.getWidth()); 56 assertEquals( 0x0b56, record.getHeight()); 57 58 59 assertEquals( 22, record.getRecordSize() ); 60 61 record.validateSid((short)0x1041); 62 } 63 64 public void testStore() 65 { 66 AxisParentRecord record = new AxisParentRecord(); 67 record.setAxisType( AxisParentRecord.AXIS_TYPE_MAIN ); 68 record.setX( 0x021d ); 69 record.setY( 0xdd ); 70 record.setWidth( 0x0b31 ); 71 record.setHeight( 0x0b56 ); 72 73 74 byte [] recordBytes = record.serialize(); 75 assertEquals(recordBytes.length - 4, data.length); 76 for (int i = 0; i < data.length; i++) 77 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 78 } 79 } 80 | Popular Tags |