1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 32 public class TestPaneRecord 33 extends TestCase 34 { 35 byte[] data = new byte[] { 36 (byte)0x01, (byte)0x00, 37 (byte)0x02, (byte)0x00, 38 (byte)0x03, (byte)0x00, 39 (byte)0x04, (byte)0x00, 40 (byte)0x02, (byte)0x00, 41 }; 42 43 public TestPaneRecord(String name) 44 { 45 super(name); 46 } 47 48 public void testLoad() 49 throws Exception 50 { 51 PaneRecord record = new PaneRecord((short)0x41, (short)data.length, data); 52 53 54 assertEquals( (short)1, record.getX()); 55 assertEquals( (short)2, record.getY()); 56 assertEquals( (short)3, record.getTopRow()); 57 assertEquals( (short)4, record.getLeftColumn()); 58 assertEquals( PaneRecord.ACTIVE_PANE_LOWER_LEFT, record.getActivePane()); 59 60 assertEquals( 14, record.getRecordSize() ); 61 62 record.validateSid((short)0x41); 63 } 64 65 public void testStore() 66 { 67 PaneRecord record = new PaneRecord(); 68 69 record.setX( (short) 1); 70 record.setY( (short) 2); 71 record.setTopRow( (short) 3); 72 record.setLeftColumn( (short) 4); 73 record.setActivePane( PaneRecord.ACTIVE_PANE_LOWER_LEFT); 74 75 byte [] recordBytes = record.serialize(); 76 assertEquals(recordBytes.length - 4, data.length); 77 for (int i = 0; i < data.length; i++) 78 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 79 } 80 } 81 | Popular Tags |