1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestAxisRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, 39 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, 40 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, 41 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 42 43 }; 44 45 public TestAxisRecord(String name) 46 { 47 super(name); 48 } 49 50 public void testLoad() 51 throws Exception 52 { 53 54 AxisRecord record = new AxisRecord((short)0x101d, (short)data.length, data); 55 assertEquals( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS, record.getAxisType()); 56 assertEquals( 0, record.getReserved1()); 57 assertEquals( 0, record.getReserved2()); 58 assertEquals( 0, record.getReserved3()); 59 assertEquals( 0, record.getReserved4()); 60 61 62 assertEquals( 4 + 18, record.getRecordSize() ); 63 64 record.validateSid((short)0x101d); 65 } 66 67 public void testStore() 68 { 69 AxisRecord record = new AxisRecord(); 70 record.setAxisType( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS ); 71 record.setReserved1( 0 ); 72 record.setReserved2( 0 ); 73 record.setReserved3( 0 ); 74 record.setReserved4( 0 ); 75 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 |