1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestSheetPropertiesRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x0A,(byte)0x00, 38 (byte)0x00 39 }; 41 42 public TestSheetPropertiesRecord(String name) 43 { 44 super(name); 45 } 46 47 public void testLoad() 48 throws Exception 49 { 50 SheetPropertiesRecord record = new SheetPropertiesRecord((short)0x1044, (short)data.length, data); 51 assertEquals( 10, record.getFlags()); 52 assertEquals( false, record.isChartTypeManuallyFormatted() ); 53 assertEquals( true, record.isPlotVisibleOnly() ); 54 assertEquals( false, record.isDoNotSizeWithWindow() ); 55 assertEquals( true, record.isDefaultPlotDimensions() ); 56 assertEquals( false, record.isAutoPlotArea() ); 57 assertEquals( 0, record.getEmpty()); 58 59 60 assertEquals( 7, record.getRecordSize() ); 61 62 record.validateSid((short)0x1044); 63 } 64 65 public void testStore() 66 { 67 SheetPropertiesRecord record = new SheetPropertiesRecord(); 68 record.setChartTypeManuallyFormatted( false ); 69 record.setPlotVisibleOnly( true ); 70 record.setDoNotSizeWithWindow( false ); 71 record.setDefaultPlotDimensions( true ); 72 record.setAutoPlotArea( false ); 73 record.setEmpty( (byte)0 ); 74 75 76 byte [] recordBytes = record.serialize(); 77 assertEquals(recordBytes.length - 4, data.length); 78 for (int i = 0; i < data.length; i++) 79 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 80 } 81 } 82 | Popular Tags |