1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestLineFormatRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00, (byte)0x01,(byte)0x00, (byte)0x4D,(byte)0x00 }; 43 44 public TestLineFormatRecord(String name) 45 { 46 super(name); 47 } 48 49 public void testLoad() 50 throws Exception 51 { 52 LineFormatRecord record = new LineFormatRecord((short)0x1007, (short)data.length, data); 53 assertEquals( 0, record.getLineColor()); 54 assertEquals( 0, record.getLinePattern()); 55 assertEquals( 0, record.getWeight()); 56 assertEquals( 1, record.getFormat()); 57 assertEquals( true, record.isAuto() ); 58 assertEquals( false, record.isDrawTicks() ); 59 assertEquals( 0x4d, record.getColourPaletteIndex()); 60 61 62 assertEquals( 16, record.getRecordSize() ); 63 64 record.validateSid((short)0x1007); 65 } 66 67 public void testStore() 68 { 69 LineFormatRecord record = new LineFormatRecord(); 70 record.setLineColor( 0 ); 71 record.setLinePattern( (short)0 ); 72 record.setWeight( (short)0 ); 73 record.setAuto( true ); 74 record.setDrawTicks( false ); 75 record.setColourPaletteIndex( (short)0x4d ); 76 77 78 byte [] recordBytes = record.serialize(); 79 assertEquals(recordBytes.length - 4, data.length); 80 for (int i = 0; i < data.length; i++) 81 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 82 } 83 } 84 | Popular Tags |