1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestSeriesLabelsRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x03,(byte)0x00 38 }; 39 40 public TestSeriesLabelsRecord(String name) 41 { 42 super(name); 43 } 44 45 public void testLoad() 46 throws Exception 47 { 48 SeriesLabelsRecord record = new SeriesLabelsRecord((short)0x100c, (short)data.length, data); 49 assertEquals( 3, record.getFormatFlags()); 50 assertEquals( true, record.isShowActual() ); 51 assertEquals( true, record.isShowPercent() ); 52 assertEquals( false, record.isLabelAsPercentage() ); 53 assertEquals( false, record.isSmoothedLine() ); 54 assertEquals( false, record.isShowLabel() ); 55 assertEquals( false, record.isShowBubbleSizes() ); 56 57 58 assertEquals( 2+4, record.getRecordSize() ); 59 60 record.validateSid((short)0x100c); 61 } 62 63 public void testStore() 64 { 65 SeriesLabelsRecord record = new SeriesLabelsRecord(); 66 record.setShowActual( true ); 67 record.setShowPercent( true ); 68 record.setLabelAsPercentage( false ); 69 record.setSmoothedLine( false ); 70 record.setShowLabel( false ); 71 record.setShowBubbleSizes( false ); 72 73 74 byte [] recordBytes = record.serialize(); 75 assertEquals(recordBytes.length - 4, data.length); 76 for (int i = 0; i < data.length; i++) 77 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 78 } 79 } 80 | Popular Tags |