1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestFrameRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x00,(byte)0x00, (byte)0x02,(byte)0x00 }; 40 41 public TestFrameRecord(String name) 42 { 43 super(name); 44 } 45 46 public void testLoad() 47 throws Exception 48 { 49 50 FrameRecord record = new FrameRecord((short)0x1032, (short)data.length, data); 51 assertEquals( FrameRecord.BORDER_TYPE_REGULAR, record.getBorderType()); 52 assertEquals( 2, record.getOptions()); 53 assertEquals( false, record.isAutoSize() ); 54 assertEquals( true, record.isAutoPosition() ); 55 56 57 assertEquals( 8, record.getRecordSize() ); 58 59 record.validateSid((short)0x1032); 60 } 61 62 public void testStore() 63 { 64 FrameRecord record = new FrameRecord(); 65 record.setBorderType( FrameRecord.BORDER_TYPE_REGULAR ); 66 record.setOptions( (short)2 ); 67 record.setAutoSize( false ); 68 record.setAutoPosition( true ); 69 70 71 byte [] recordBytes = record.serialize(); 72 assertEquals(recordBytes.length - 4, data.length); 73 for (int i = 0; i < data.length; i++) 74 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 75 } 76 } 77 | Popular Tags |