1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestDatRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x0D,(byte)0x00 }; 39 40 public TestDatRecord(String name) 41 { 42 super(name); 43 } 44 45 public void testLoad() 46 throws Exception 47 { 48 49 DatRecord record = new DatRecord((short)0x1063, (short)data.length, data); 50 assertEquals( 0xD, record.getOptions()); 51 assertEquals( true, record.isHorizontalBorder() ); 52 assertEquals( false, record.isVerticalBorder() ); 53 assertEquals( true, record.isBorder() ); 54 assertEquals( true, record.isShowSeriesKey() ); 55 56 57 assertEquals( 6, record.getRecordSize() ); 58 59 record.validateSid((short)0x1063); 60 } 61 62 public void testStore() 63 { 64 DatRecord record = new DatRecord(); 65 record.setHorizontalBorder( true ); 66 record.setVerticalBorder( false ); 67 record.setBorder( true ); 68 record.setShowSeriesKey( 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 |