1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestDataFormatRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0xFF,(byte)0xFF, (byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00 }; 42 43 public TestDataFormatRecord(String name) 44 { 45 super(name); 46 } 47 48 public void testLoad() 49 throws Exception 50 { 51 52 DataFormatRecord record = new DataFormatRecord((short)0x1006, (short)data.length, data); 53 assertEquals( (short)0xFFFF, record.getPointNumber()); 54 assertEquals( 0, record.getSeriesIndex()); 55 assertEquals( 0, record.getSeriesNumber()); 56 assertEquals( 0, record.getFormatFlags()); 57 assertEquals( false, record.isUseExcel4Colors() ); 58 59 60 assertEquals( 12, record.getRecordSize() ); 61 62 record.validateSid((short)0x1006); 63 } 64 65 public void testStore() 66 { 67 DataFormatRecord record = new DataFormatRecord(); 68 record.setPointNumber( (short)0xFFFF ); 69 record.setSeriesIndex( (short)0 ); 70 record.setSeriesNumber( (short)0 ); 71 record.setFormatFlags( (short)0 ); 72 record.setUseExcel4Colors( false ); 73 74 75 byte [] recordBytes = record.serialize(); 76 assertEquals(recordBytes.length - 4, data.length); 77 for (int i = 0; i < data.length; i++) 78 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 79 } 80 } 81 | Popular Tags |