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