Fixes to ddf junits after r776424

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2009-05-20 00:32:54 +00:00
parent 52d7b774bf
commit f8178f716a
7 changed files with 211 additions and 232 deletions

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -22,12 +21,8 @@ import junit.framework.TestCase;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import java.io.IOException; public final class TestEscherBSERecord extends TestCase {
public void testFillFields() {
public class TestEscherBSERecord extends TestCase
{
public void testFillFields() throws Exception
{
String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " + String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " +
" 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 00 00 00 " + " 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 00 00 00 " +
" 00 00 02 00 00 00 03 00 00 00 04 05 06 07"; " 00 00 02 00 00 00 03 00 00 00 04 05 06 07";
@ -48,8 +43,7 @@ public class TestEscherBSERecord extends TestCase
assertEquals( 0, r.getRemainingData().length ); assertEquals( 0, r.getRemainingData().length );
} }
public void testSerialize() throws Exception public void testSerialize() {
{
EscherBSERecord r = createRecord(); EscherBSERecord r = createRecord();
byte[] data = new byte[8 + 36]; byte[] data = new byte[8 + 36];
@ -62,8 +56,7 @@ public class TestEscherBSERecord extends TestCase
} }
private EscherBSERecord createRecord() throws IOException private EscherBSERecord createRecord() {
{
EscherBSERecord r = new EscherBSERecord(); EscherBSERecord r = new EscherBSERecord();
r.setOptions( (short) 0x0001 ); r.setOptions( (short) 0x0001 );
r.setBlipTypeWin32( EscherBSERecord.BT_JPEG ); r.setBlipTypeWin32( EscherBSERecord.BT_JPEG );
@ -81,27 +74,27 @@ public class TestEscherBSERecord extends TestCase
} }
public void testToString() throws Exception public void testToString() {
{
EscherBSERecord record = createRecord(); EscherBSERecord record = createRecord();
String nl = System.getProperty("line.separator"); String expected = "org.apache.poi.ddf.EscherBSERecord:" + '\n' +
assertEquals( "org.apache.poi.ddf.EscherBSERecord:" + nl + " RecordId: 0xF007" + '\n' +
" RecordId: 0xF007" + nl + " Options: 0x0001" + '\n' +
" Options: 0x0001" + nl + " BlipTypeWin32: 5" + '\n' +
" BlipTypeWin32: 5" + nl + " BlipTypeMacOS: 5" + '\n' +
" BlipTypeMacOS: 5" + nl + " SUID: [01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]" + '\n' +
" SUID: [01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]" + nl + " Tag: 1" + '\n' +
" Tag: 1" + nl + " Size: 0" + '\n' +
" Size: 0" + nl + " Ref: 2" + '\n' +
" Ref: 2" + nl + " Offset: 3" + '\n' +
" Offset: 3" + nl + " Usage: 4" + '\n' +
" Usage: 4" + nl + " Name: 5" + '\n' +
" Name: 5" + nl + " Unused2: 6" + '\n' +
" Unused2: 6" + nl + " Unused3: 7" + '\n' +
" Unused3: 7" + nl + " blipRecord: null" + '\n' +
" blipRecord: null" + nl + " Extra Data:" + '\n' +
" Extra Data:" + nl + ": 0";
"No Data" + nl, record.toString() ); String actual = record.toString();
assertEquals( expected, actual );
} }
} }

View File

@ -21,8 +21,7 @@ import junit.framework.TestCase;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
public class TestEscherDgRecord extends TestCase public final class TestEscherDgRecord extends TestCase {
{
public void testSerialize() { public void testSerialize() {
EscherDgRecord r = createRecord(); EscherDgRecord r = createRecord();
@ -53,13 +52,11 @@ public class TestEscherDgRecord extends TestCase
} }
public void testToString() { public void testToString() {
String nl = System.getProperty("line.separator"); String expected = "org.apache.poi.ddf.EscherDgRecord:" + '\n' +
" RecordId: 0xF008" + '\n' +
String expected = "org.apache.poi.ddf.EscherDgRecord:" + nl + " Options: 0x0010" + '\n' +
" RecordId: 0xF008" + nl + " NumShapes: 2" + '\n' +
" Options: 0x0010" + nl + " LastMSOSPID: 1025" + '\n';
" NumShapes: 2" + nl +
" LastMSOSPID: 1025" + nl;
assertEquals( expected, createRecord().toString() ); assertEquals( expected, createRecord().toString() );
} }

View File

@ -21,8 +21,7 @@ import junit.framework.TestCase;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
public class TestEscherDggRecord extends TestCase public final class TestEscherDggRecord extends TestCase {
{
public void testSerialize() { public void testSerialize() {
EscherDggRecord r = createRecord(); EscherDggRecord r = createRecord();
@ -64,17 +63,15 @@ public class TestEscherDggRecord extends TestCase
} }
public void testToString() { public void testToString() {
String nl = System.getProperty("line.separator"); String expected = "org.apache.poi.ddf.EscherDggRecord:" + '\n' +
" RecordId: 0xF006" + '\n' +
String expected = "org.apache.poi.ddf.EscherDggRecord:" + nl + " Options: 0x0000" + '\n' +
" RecordId: 0xF006" + nl + " ShapeIdMax: 1026" + '\n' +
" Options: 0x0000" + nl + " NumIdClusters: 2" + '\n' +
" ShapeIdMax: 1026" + nl + " NumShapesSaved: 2" + '\n' +
" NumIdClusters: 2" + nl + " DrawingsSaved: 1" + '\n' +
" NumShapesSaved: 2" + nl + " DrawingGroupId1: 1" + '\n' +
" DrawingsSaved: 1" + nl + " NumShapeIdsUsed1: 2" + '\n';
" DrawingGroupId1: 1" + nl +
" NumShapeIdsUsed1: 2" + nl;
assertEquals( expected, createRecord().toString() ); assertEquals( expected, createRecord().toString() );
} }

View File

@ -21,8 +21,7 @@ import junit.framework.TestCase;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
public class TestEscherSpgrRecord extends TestCase public final class TestEscherSpgrRecord extends TestCase {
{
public void testSerialize() { public void testSerialize() {
EscherSpgrRecord r = createRecord(); EscherSpgrRecord r = createRecord();
@ -59,15 +58,14 @@ public class TestEscherSpgrRecord extends TestCase
} }
public void testToString() { public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherSpgrRecord:" + nl + String expected = "org.apache.poi.ddf.EscherSpgrRecord:" + '\n' +
" RecordId: 0xF009" + nl + " RecordId: 0xF009" + '\n' +
" Options: 0x0010" + nl + " Options: 0x0010" + '\n' +
" RectX: 1" + nl + " RectX: 1" + '\n' +
" RectY: 2" + nl + " RectY: 2" + '\n' +
" RectWidth: 3" + nl + " RectWidth: 3" + '\n' +
" RectHeight: 4" + nl; " RectHeight: 4" + '\n';
assertEquals( expected, createRecord().toString() ); assertEquals( expected, createRecord().toString() );
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -22,8 +21,7 @@ import junit.framework.TestCase;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
public class TestEscherSplitMenuColorsRecord extends TestCase public final class TestEscherSplitMenuColorsRecord extends TestCase {
{
public void testSerialize() { public void testSerialize() {
EscherSplitMenuColorsRecord r = createRecord(); EscherSplitMenuColorsRecord r = createRecord();
@ -60,15 +58,13 @@ public class TestEscherSplitMenuColorsRecord extends TestCase
} }
public void testToString() { public void testToString() {
String nl = System.getProperty("line.separator"); String expected = "org.apache.poi.ddf.EscherSplitMenuColorsRecord:" + '\n' +
" RecordId: 0xF11E" + '\n' +
String expected = "org.apache.poi.ddf.EscherSplitMenuColorsRecord:" + nl + " Options: 0x0040" + '\n' +
" RecordId: 0xF11E" + nl + " Color1: 0x00000402" + '\n' +
" Options: 0x0040" + nl + " Color2: 0x00000002" + '\n' +
" Color1: 0x00000402" + nl + " Color3: 0x00000002" + '\n' +
" Color2: 0x00000002" + nl + " Color4: 0x00000001" + '\n' +
" Color3: 0x00000002" + nl +
" Color4: 0x00000001" + nl +
""; "";
assertEquals( expected, createRecord().toString() ); assertEquals( expected, createRecord().toString() );
} }

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -22,8 +21,7 @@ import junit.framework.TestCase;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
public class TestUnknownEscherRecord extends TestCase public final class TestUnknownEscherRecord extends TestCase {
{
public void testFillFields() { public void testFillFields() {
String testData = String testData =
"0F 02 " + // options "0F 02 " + // options
@ -108,12 +106,12 @@ public class TestUnknownEscherRecord extends TestCase
byte[] data = new byte[8]; byte[] data = new byte[8];
r.serialize( 0, data, new NullEscherSerializationListener() ); r.serialize( 0, data, new NullEscherSerializationListener() );
String nl = System.getProperty("line.separator"); assertEquals( "org.apache.poi.ddf.UnknownEscherRecord:" + '\n' +
assertEquals( "org.apache.poi.ddf.UnknownEscherRecord:" + nl + " isContainer: false" + '\n' +
" isContainer: false" + nl + " options: 0x1234" + '\n' +
" options: 0x1234" + nl + " recordId: 0xF112" + '\n' +
" recordId: 0xF112" + nl + " numchildren: 0" + '\n' +
" numchildren: 0" + nl ": 0"
, r.toString() ); , r.toString() );
} }
} }