1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestChartRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, 38 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, 39 (byte)0xE8,(byte)0xFF,(byte)0xD0,(byte)0x01, 40 (byte)0xC8,(byte)0xCC,(byte)0xE5,(byte)0x00 41 }; 42 43 public TestChartRecord(String name) 44 { 45 super(name); 46 } 47 48 public void testLoad() 49 throws Exception 50 { 51 52 ChartRecord record = new ChartRecord((short)0x1002, (short)data.length, data); 53 assertEquals( 0, record.getX()); 54 assertEquals( 0, record.getY()); 55 assertEquals( 30474216, record.getWidth()); 56 assertEquals( 15060168, record.getHeight()); 57 58 59 assertEquals( 20, record.getRecordSize() ); 60 61 record.validateSid((short)0x1002); 62 } 63 64 public void testStore() 65 { 66 ChartRecord record = new ChartRecord(); 67 record.setX( 0 ); 68 record.setY( 0 ); 69 record.setWidth( 30474216 ); 70 record.setHeight( 15060168 ); 71 72 73 byte [] recordBytes = record.serialize(); 74 assertEquals(recordBytes.length - 4, data.length); 75 for (int i = 0; i < data.length; i++) 76 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 77 } 78 } 79 | Popular Tags |