1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestSeriesListRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x02,(byte)0x00,(byte)0x01,(byte)0x20,(byte)0xff,(byte)0xf0 38 }; 39 40 public TestSeriesListRecord(String name) 41 { 42 super(name); 43 } 44 45 public void testLoad() 46 throws Exception 47 { 48 49 SeriesListRecord record = new SeriesListRecord((short)0x1016, (short)data.length, data); 50 assertEquals( (short)0x2001, record.getSeriesNumbers()[0]); 51 assertEquals( (short)0xf0ff, record.getSeriesNumbers()[1]); 52 assertEquals( 2, record.getSeriesNumbers().length); 53 54 assertEquals( 4 + 6, record.getRecordSize() ); 55 56 record.validateSid((short)0x1016); 57 } 58 59 public void testStore() 60 { 61 SeriesListRecord record = new SeriesListRecord(); 62 record.setSeriesNumbers( new short[] { (short)0x2001, (short)0xf0ff } ); 63 64 byte [] recordBytes = record.serialize(); 65 assertEquals(recordBytes.length - 4, data.length); 66 for (int i = 0; i < data.length; i++) 67 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 68 } 69 } 70 | Popular Tags |