1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 32 public class TestSeriesRecord 33 extends TestCase 34 { 35 byte[] data = new byte[] { 36 (byte)0x01,(byte)0x00, (byte)0x01,(byte)0x00, (byte)0x1B,(byte)0x00, (byte)0x1B,(byte)0x00, (byte)0x01,(byte)0x00, (byte)0x00,(byte)0x00 }; 43 44 public TestSeriesRecord(String name) 45 { 46 super(name); 47 } 48 49 public void testLoad() 50 throws Exception 51 { 52 53 SeriesRecord record = new SeriesRecord((short)0x1003, (short)data.length, data); 54 assertEquals( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, record.getCategoryDataType()); 55 assertEquals( SeriesRecord.VALUES_DATA_TYPE_NUMERIC, record.getValuesDataType()); 56 assertEquals( 27, record.getNumCategories()); 57 assertEquals( 27, record.getNumValues()); 58 assertEquals( SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC, record.getBubbleSeriesType()); 59 assertEquals( 0, record.getNumBubbleValues()); 60 61 62 assertEquals( 16, record.getRecordSize() ); 63 64 record.validateSid((short)0x1003); 65 } 66 67 public void testStore() 68 { 69 SeriesRecord record = new SeriesRecord(); 70 record.setCategoryDataType( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC ); 71 record.setValuesDataType( SeriesRecord.VALUES_DATA_TYPE_NUMERIC ); 72 record.setNumCategories( (short)27 ); 73 record.setNumValues( (short)27 ); 74 record.setBubbleSeriesType( SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC ); 75 record.setNumBubbleValues( (short)0 ); 76 77 byte [] recordBytes = record.serialize(); 78 assertEquals(recordBytes.length - 4, data.length); 79 for (int i = 0; i < data.length; i++) 80 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 81 } 82 } 83 | Popular Tags |