You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/08/18 04:41:50 UTC
svn commit: r805262 [5/6] - in /poi/trunk/src: java/org/apache/poi/hssf/dev/
java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/record/
java/org/apache/poi/hssf/record/formula/
java/org/apache/poi/hssf/record/formula/atp/ java/org/apache/poi/hssf...
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java Tue Aug 18 02:41:45 2009
@@ -18,25 +18,19 @@
package org.apache.poi.hwpf.model.types;
-
+import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
-import org.apache.poi.util.HexDump;
-import org.apache.poi.hdf.model.hdftypes.HDFType;
-import org.apache.poi.hwpf.usermodel.*;
/**
* Base part of the File information Block (FibBase). Holds the core part of the FIB, from the first 32 bytes.
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
-
+ *
* @author Andrew C. Oliver
*/
-public abstract class FIBAbstractType
- implements HDFType
-{
+public abstract class FIBAbstractType implements HDFType {
protected int field_1_wIdent;
protected int field_2_nFib;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java Tue Aug 18 02:41:45 2009
@@ -18,25 +18,19 @@
package org.apache.poi.hwpf.model.types;
-
-import org.apache.poi.util.BitField;
-import org.apache.poi.util.BitFieldFactory;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
-import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
/**
* Paragraph Properties.
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
-
+ *
* @author S. Ryan Ackley
*/
-public abstract class PAPAbstractType
- implements HDFType
-{
+public abstract class PAPAbstractType implements HDFType {
protected int field_1_istd;
protected byte field_2_jc;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java Tue Aug 18 02:41:45 2009
@@ -18,24 +18,18 @@
package org.apache.poi.hwpf.model.types;
-
-import org.apache.poi.util.BitField;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
-import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType;
-import org.apache.poi.hwpf.usermodel.*;
+import org.apache.poi.hwpf.usermodel.BorderCode;
+import org.apache.poi.hwpf.usermodel.DateAndTime;
/**
* Section Properties.
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
-
+ *
* @author S. Ryan Ackley
*/
-public abstract class SEPAbstractType
- implements HDFType
-{
+public abstract class SEPAbstractType implements HDFType {
protected byte field_1_bkc;
protected boolean field_2_fTitlePage;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java Tue Aug 18 02:41:45 2009
@@ -18,24 +18,19 @@
package org.apache.poi.hwpf.model.types;
-
-import org.apache.poi.util.BitField;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
-import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType;
-import org.apache.poi.hwpf.usermodel.*;
+import org.apache.poi.hwpf.usermodel.BorderCode;
+import org.apache.poi.hwpf.usermodel.ShadingDescriptor;
+import org.apache.poi.hwpf.usermodel.TableCellDescriptor;
/**
* Table Properties.
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
-
+ *
* @author S. Ryan Ackley
*/
-public abstract class TAPAbstractType
- implements HDFType
-{
+public abstract class TAPAbstractType implements HDFType {
protected int field_1_jc;
protected int field_2_dxaGapHalf;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java Tue Aug 18 02:41:45 2009
@@ -18,12 +18,9 @@
package org.apache.poi.hwpf.model.types;
-
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
-import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
@@ -34,9 +31,7 @@
* @author S. Ryan Ackley
*/
-public abstract class TCAbstractType
- implements HDFType
-{
+public abstract class TCAbstractType implements HDFType {
protected short field_1_rgf;
private static BitField fFirstMerged = BitFieldFactory.getInstance(0x0001);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmCompressor.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmCompressor.java Tue Aug 18 02:41:45 2009
@@ -18,8 +18,6 @@
package org.apache.poi.hwpf.sprm;
import java.util.ArrayList;
-import java.util.List;
-import java.util.Arrays;
import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.util.LittleEndian;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java Tue Aug 18 02:41:45 2009
@@ -21,7 +21,6 @@
import org.apache.poi.hwpf.usermodel.DateAndTime;
import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.ShadingDescriptor;
-import org.apache.poi.hwpf.model.StyleSheet;
import org.apache.poi.util.LittleEndian;
public final class CharacterSprmUncompressor
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java Tue Aug 18 02:41:45 2009
@@ -34,7 +34,7 @@
public static byte[] compressParagraphProperty(ParagraphProperties newPAP,
ParagraphProperties oldPAP)
{
- ArrayList sprmList = new ArrayList();
+ List sprmList = new ArrayList();
int size = 0;
if (newPAP.getJc() != oldPAP.getJc())
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java Tue Aug 18 02:41:45 2009
@@ -26,7 +26,6 @@
import org.apache.poi.util.LittleEndian;
import java.util.HashMap;
-import java.util.Set;
import java.util.Iterator;
import java.util.Collections;
import java.util.ArrayList;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java Tue Aug 18 02:41:45 2009
@@ -17,229 +17,9 @@
package org.apache.poi.hwpf.sprm;
-//
-//import java.util.ArrayList;
-//import java.util.Arrays;
-//
-//import org.apache.poi.hwpf.model.types.SEPAbstractType;
-//import org.apache.poi.hwpf.usermodel.SectionProperties;
-//import org.apache.poi.util.LittleEndian;
-//
-//
-//public class SectionSprmCompressor
-//{
-// private final static SectionProperties DEFAULT_SEP = new SectionProperties();
-// public SectionSprmCompressor()
-// {
-// }
-// public static byte[] compressSectionProperty(SectionProperties newSEP,
-// SectionProperties oldSEP)
-// {
-// int size = 0;
-// ArrayList sprmList = new ArrayList();
-//
-// if (newSEP.getCnsPgn() != DEFAULT_SEP.getCnsPgn())
-// {
-// size += SprmUtils.addSprm((short)0x3000, newSEP.getCnsPgn(), null, sprmList);
-// }
-// if (newSEP.getIHeadingPgn() != DEFAULT_SEP.getIHeadingPgn())
-// {
-// size += SprmUtils.addSprm((short)0x3001, newSEP.getIHeadingPgn(), null, sprmList);
-// }
-// if (!Arrays.equals(newSEP.getOlstAnm(), DEFAULT_SEP.getOlstAnm()))
-// {
-// size += SprmUtils.addSprm((short)0xD202, 0, newSEP.getOlstAnm(), sprmList);
-// }
-// if (newSEP.getFEvenlySpaced() != DEFAULT_SEP.getFEvenlySpaced())
-// {
-// size += SprmUtils.addSprm((short)0x3005, newSEP.getFEvenlySpaced() ? 1 : 0, null, sprmList);
-// }
-// if (newSEP.getFUnlocked() != DEFAULT_SEP.getFUnlocked())
-// {
-// size += SprmUtils.addSprm((short)0x3006, newSEP.getFUnlocked() ? 1 :0, null, sprmList);
-// }
-// if (newSEP.getDmBinFirst() != DEFAULT_SEP.getDmBinFirst())
-// {
-// size += SprmUtils.addSprm((short)0x5007, newSEP.getDmBinFirst(), null, sprmList);
-// }
-// if (newSEP.getDmBinOther() != DEFAULT_SEP.getDmBinOther())
-// {
-// size += SprmUtils.addSprm((short)0x5008, newSEP.getDmBinOther(), null, sprmList);
-// }
-// if (newSEP.getBkc() != DEFAULT_SEP.getBkc())
-// {
-// size += SprmUtils.addSprm((short)0x3009, newSEP.getBkc(), null, sprmList);
-// }
-// if (newSEP.getFTitlePage() != DEFAULT_SEP.getFTitlePage())
-// {
-// size += SprmUtils.addSprm((short)0x300A, newSEP.getFTitlePage() ? 1 : 0, null, sprmList);
-// }
-// if (newSEP.getCcolM1() != DEFAULT_SEP.getCcolM1())
-// {
-// size += SprmUtils.addSprm((short)0x500B, newSEP.getCcolM1(), null, sprmList);
-// }
-// if (newSEP.getDxaColumns() != DEFAULT_SEP.getDxaColumns())
-// {
-// size += SprmUtils.addSprm((short)0x900C, newSEP.getDxaColumns(), null, sprmList);
-// }
-// if (newSEP.getFAutoPgn() != DEFAULT_SEP.getFAutoPgn())
-// {
-// size += SprmUtils.addSprm((short)0x300D, newSEP.getFAutoPgn() ? 1 : 0, null, sprmList);
-// }
-// if (newSEP.getNfcPgn() != DEFAULT_SEP.getNfcPgn())
-// {
-// size += SprmUtils.addSprm((short)0x300E, newSEP.getNfcPgn(), null, sprmList);
-// }
-// if (newSEP.getDyaPgn() != DEFAULT_SEP.getDyaPgn())
-// {
-// size += SprmUtils.addSprm((short)0xB00F, newSEP.getDyaPgn(), null, sprmList);
-// }
-// if (newSEP.getDxaPgn() != DEFAULT_SEP.getDxaPgn())
-// {
-// size += SprmUtils.addSprm((short)0xB010, newSEP.getDxaPgn(), null, sprmList);
-// }
-// if (newSEP.getFPgnRestart() != DEFAULT_SEP.getFPgnRestart())
-// {
-// size += SprmUtils.addSprm((short)0x3011, newSEP.getFPgnRestart() ? 1 : 0, null, sprmList);
-// }
-// if (newSEP.getFEndNote() != DEFAULT_SEP.getFEndNote())
-// {
-// size += SprmUtils.addSprm((short)0x3012, newSEP.getFEndNote() ? 1 : 0, null, sprmList);
-// }
-// if (newSEP.getLnc() != DEFAULT_SEP.getLnc())
-// {
-// size += SprmUtils.addSprm((short)0x3013, newSEP.getLnc(), null, sprmList);
-// }
-// if (newSEP.getGrpfIhdt() != DEFAULT_SEP.getGrpfIhdt())
-// {
-// size += SprmUtils.addSprm((short)0x3014, newSEP.getGrpfIhdt(), null, sprmList);
-// }
-// if (newSEP.getNLnnMod() != DEFAULT_SEP.getNLnnMod())
-// {
-// size += SprmUtils.addSprm((short)0x5015, newSEP.getNLnnMod(), null, sprmList);
-// }
-// if (newSEP.getDxaLnn() != DEFAULT_SEP.getDxaLnn())
-// {
-// size += SprmUtils.addSprm((short)0x9016, newSEP.getDxaLnn(), null, sprmList);
-// }
-// if (newSEP.getDyaHdrTop() != DEFAULT_SEP.getDyaHdrTop())
-// {
-// size += SprmUtils.addSprm((short)0xB017, newSEP.getDyaHdrTop(), null, sprmList);
-// }
-// if (newSEP.getDyaHdrBottom() != DEFAULT_SEP.getDyaHdrBottom())
-// {
-// size += SprmUtils.addSprm((short)0xB018, newSEP.getDyaHdrBottom(), null, sprmList);
-// }
-// if (newSEP.getFLBetween() != DEFAULT_SEP.getFLBetween())
-// {
-// size += SprmUtils.addSprm((short)0x3019, newSEP.getFLBetween() ? 1 : 0, null, sprmList);
-// }
-// if (newSEP.getVjc() != DEFAULT_SEP.getVjc())
-// {
-// size += SprmUtils.addSprm((short)0x301A, newSEP.getVjc(), null, sprmList);
-// }
-// if (newSEP.getLnnMin() != DEFAULT_SEP.getLnnMin())
-// {
-// size += SprmUtils.addSprm((short)0x501B, newSEP.getLnnMin(), null, sprmList);
-// }
-// if (newSEP.getPgnStart() != DEFAULT_SEP.getPgnStart())
-// {
-// size += SprmUtils.addSprm((short)0x501C, newSEP.getPgnStart(), null, sprmList);
-// }
-// if (newSEP.getDmOrientPage() != DEFAULT_SEP.getDmOrientPage())
-// {
-// size += SprmUtils.addSprm((short)0x301D, newSEP.getDmOrientPage(), null, sprmList);
-// }
-// if (newSEP.getXaPage() != DEFAULT_SEP.getXaPage())
-// {
-// size += SprmUtils.addSprm((short)0xB01F, newSEP.getXaPage(), null, sprmList);
-// }
-// if (newSEP.getYaPage() != DEFAULT_SEP.getYaPage())
-// {
-// size += SprmUtils.addSprm((short)0xB020, newSEP.getYaPage(), null, sprmList);
-// }
-// if (newSEP.getDxaLeft() != DEFAULT_SEP.getDxaLeft())
-// {
-// size += SprmUtils.addSprm((short)0xB021, newSEP.getDxaLeft(), null, sprmList);
-// }
-// if (newSEP.getDxaRight() != DEFAULT_SEP.getDxaRight())
-// {
-// size += SprmUtils.addSprm((short)0xB022, newSEP.getDxaRight(), null, sprmList);
-// }
-// if (newSEP.getDyaTop() != DEFAULT_SEP.getDyaTop())
-// {
-// size += SprmUtils.addSprm((short)0x9023, newSEP.getDyaTop(), null, sprmList);
-// }
-// if (newSEP.getDyaBottom() != DEFAULT_SEP.getDyaBottom())
-// {
-// size += SprmUtils.addSprm((short)0x9024, newSEP.getDyaBottom(), null, sprmList);
-// }
-// if (newSEP.getDzaGutter() != DEFAULT_SEP.getDzaGutter())
-// {
-// size += SprmUtils.addSprm((short)0xB025, newSEP.getDzaGutter(), null, sprmList);
-// }
-// if (newSEP.getDmPaperReq() != DEFAULT_SEP.getDmPaperReq())
-// {
-// size += SprmUtils.addSprm((short)0x5026, newSEP.getDmPaperReq(), null, sprmList);
-// }
-// if (newSEP.getFPropMark() != DEFAULT_SEP.getFPropMark() ||
-// newSEP.getIbstPropRMark() != DEFAULT_SEP.getIbstPropRMark() ||
-// newSEP.getDttmPropRMark() != DEFAULT_SEP.getDttmPropRMark())
-// {
-// byte[] buf = new byte[7];
-// buf[0] = (byte)(newSEP.getFPropMark() ? 1 : 0);
-// int offset = LittleEndian.BYTE_SIZE;
-// LittleEndian.putShort(buf, (short)newSEP.getIbstPropRMark());
-// offset += LittleEndian.SHORT_SIZE;
-// LittleEndian.putInt(buf, newSEP.getDttmPropRMark());
-// size += SprmUtils.addSprm((short)0xD227, -1, buf, sprmList);
-// }
-// if (!Arrays.equals(newSEP.getBrcTop(), DEFAULT_SEP.getBrcTop()))
-// {
-// size += SprmUtils.addSprm((short)0x702B, SprmUtils.convertBrcToInt(newSEP.getBrcTop()), null, sprmList);
-// }
-// if (!Arrays.equals(newSEP.getBrcLeft(), DEFAULT_SEP.getBrcLeft()))
-// {
-// size += SprmUtils.addSprm((short)0x702C, SprmUtils.convertBrcToInt(newSEP.getBrcLeft()), null, sprmList);
-// }
-// if (!Arrays.equals(newSEP.getBrcBottom(), DEFAULT_SEP.getBrcBottom()))
-// {
-// size += SprmUtils.addSprm((short)0x702D, SprmUtils.convertBrcToInt(newSEP.getBrcBottom()), null, sprmList);
-// }
-// if (!Arrays.equals(newSEP.getBrcRight(), DEFAULT_SEP.getBrcRight()))
-// {
-// size += SprmUtils.addSprm((short)0x702E, SprmUtils.convertBrcToInt(newSEP.getBrcRight()), null, sprmList);
-// }
-// if (newSEP.getPgbProp() != DEFAULT_SEP.getPgbProp())
-// {
-// size += SprmUtils.addSprm((short)0x522F, newSEP.getPgbProp(), null, sprmList);
-// }
-// if (newSEP.getDxtCharSpace() != DEFAULT_SEP.getDxtCharSpace())
-// {
-// size += SprmUtils.addSprm((short)0x7030, newSEP.getDxtCharSpace(), null, sprmList);
-// }
-// if (newSEP.getDyaLinePitch() != DEFAULT_SEP.getDyaLinePitch())
-// {
-// size += SprmUtils.addSprm((short)0x9031, newSEP.getDyaLinePitch(), null, sprmList);
-// }
-// if (newSEP.getClm() != DEFAULT_SEP.getClm())
-// {
-// size += SprmUtils.addSprm((short)0x5032, newSEP.getClm(), null, sprmList);
-// }
-// if (newSEP.getWTextFlow() != DEFAULT_SEP.getWTextFlow())
-// {
-// size += SprmUtils.addSprm((short)0x5033, newSEP.getWTextFlow(), null, sprmList);
-// }
-//
-// return SprmUtils.getGrpprl(sprmList, size);
-// }
-//}
-
-
import java.util.ArrayList;
import java.util.Arrays;
-import org.apache.poi.hwpf.model.types.SEPAbstractType;
import org.apache.poi.hwpf.usermodel.SectionProperties;
import org.apache.poi.util.LittleEndian;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java Tue Aug 18 02:41:45 2009
@@ -20,7 +20,6 @@
import org.apache.poi.hwpf.usermodel.TableProperties;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.hwpf.usermodel.TableCellDescriptor;
-import org.apache.poi.hwpf.usermodel.ShadingDescriptor;
import org.apache.poi.hwpf.usermodel.BorderCode;
import java.util.ArrayList;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java Tue Aug 18 02:41:45 2009
@@ -17,13 +17,9 @@
package org.apache.poi.hwpf.usermodel;
-import org.apache.poi.util.BitField;
-import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
-public final class BorderCode
- implements Cloneable
-{
+public final class BorderCode implements Cloneable {
public static final int SIZE = 4;
private short _info;
private short _info2;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java Tue Aug 18 02:41:45 2009
@@ -17,8 +17,6 @@
package org.apache.poi.hwpf.usermodel;
-import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.model.ListTables;
import org.apache.poi.hwpf.model.ListLevel;
import org.apache.poi.hwpf.model.ListData;
import org.apache.poi.hwpf.model.ListFormatOverride;
@@ -43,8 +41,7 @@
*
* @author Ryan Ackley
*/
-public final class HWPFList
-{
+public final class HWPFList {
private ListData _listData;
private ListFormatOverride _override;
private boolean _registered;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java Tue Aug 18 02:41:45 2009
@@ -18,14 +18,8 @@
package org.apache.poi.hwpf.usermodel;
import org.apache.poi.hwpf.model.types.PAPAbstractType;
-import org.apache.poi.hwpf.model.StyleDescription;
-import org.apache.poi.hwpf.sprm.SprmBuffer;
-
-public final class ParagraphProperties
- extends PAPAbstractType
- implements Cloneable
-{
+public final class ParagraphProperties extends PAPAbstractType implements Cloneable {
public ParagraphProperties()
{
@@ -313,14 +307,14 @@
{
ParagraphProperties pp = (ParagraphProperties)super.clone();
pp.field_21_lspd = (LineSpacingDescriptor)field_21_lspd.clone();
- pp.field_24_phe = (byte[])field_24_phe.clone();
+ pp.field_24_phe = field_24_phe.clone();
pp.field_46_brcTop = (BorderCode)field_46_brcTop.clone();
pp.field_47_brcLeft = (BorderCode)field_47_brcLeft.clone();
pp.field_48_brcBottom = (BorderCode)field_48_brcBottom.clone();
pp.field_49_brcRight = (BorderCode)field_49_brcRight.clone();
pp.field_50_brcBetween = (BorderCode)field_50_brcBetween.clone();
pp.field_51_brcBar = (BorderCode)field_51_brcBar.clone();
- pp.field_60_anld = (byte[])field_60_anld.clone();
+ pp.field_60_anld = field_60_anld.clone();
return pp;
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableIterator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableIterator.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableIterator.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableIterator.java Tue Aug 18 02:41:45 2009
@@ -18,8 +18,6 @@
package org.apache.poi.hwpf.usermodel;
-import java.util.ArrayList;
-
public final class TableIterator
{
Range _range;
@@ -56,7 +54,6 @@
public Table next()
{
int numParagraphs = _range.numParagraphs();
- int numRows = 0;
int startIndex = _index;
int endIndex = _index;
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java Tue Aug 18 02:41:45 2009
@@ -21,7 +21,6 @@
import junit.framework.TestCase;
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
-import org.apache.poi.hslf.record.*;
/**
* Tests that HSLFSlideShow does the right thing with an encrypted file
@@ -39,41 +38,41 @@
private String ss_56_e;
- public TestEncryptedFile() throws Exception {
+ public TestEncryptedFile() {
String dirname = System.getProperty("HSLF.testdata.path");
ss_ne = dirname + "/basic_test_ppt_file.ppt";
ss_e = dirname + "/Password_Protected-hello.ppt";
ss_np_e = dirname + "/Password_Protected-np-hello.ppt";
ss_56_e = dirname + "/Password_Protected-56-hello.ppt";
- }
+ }
- public void testLoadNonEncrypted() throws Exception {
- HSLFSlideShow hss = new HSLFSlideShow(ss_ne);
+ public void testLoadNonEncrypted() throws Exception {
+ HSLFSlideShow hss = new HSLFSlideShow(ss_ne);
- assertNotNull(hss);
- }
+ assertNotNull(hss);
+ }
- public void testLoadEncrypted() throws Exception {
- try {
- new HSLFSlideShow(ss_e);
- fail();
- } catch(EncryptedPowerPointFileException e) {
- // Good
- }
-
- try {
- new HSLFSlideShow(ss_np_e);
- fail();
- } catch(EncryptedPowerPointFileException e) {
- // Good
- }
-
- try {
- new HSLFSlideShow(ss_56_e);
- fail();
- } catch(EncryptedPowerPointFileException e) {
- // Good
- }
- }
+ public void testLoadEncrypted() throws Exception {
+ try {
+ new HSLFSlideShow(ss_e);
+ fail();
+ } catch(EncryptedPowerPointFileException e) {
+ // Good
+ }
+
+ try {
+ new HSLFSlideShow(ss_np_e);
+ fail();
+ } catch(EncryptedPowerPointFileException e) {
+ // Good
+ }
+
+ try {
+ new HSLFSlideShow(ss_56_e);
+ fail();
+ } catch(EncryptedPowerPointFileException e) {
+ // Good
+ }
+ }
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java Tue Aug 18 02:41:45 2009
@@ -17,19 +17,12 @@
package org.apache.poi.hslf.model;
+import java.awt.geom.Area;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
+import java.awt.geom.Rectangle2D;
+
import junit.framework.TestCase;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.HSLFSlideShow;
-
-import java.awt.*;
-import java.awt.Rectangle;
-import java.awt.geom.*;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
/**
* Test Freeform object.
@@ -41,7 +34,7 @@
*/
public final class TestFreeform extends TestCase {
- public void testClosedPath() throws Exception {
+ public void testClosedPath() {
GeneralPath path1 = new GeneralPath();
path1.moveTo(100, 100);
@@ -57,7 +50,7 @@
assertTrue(new Area(path1).equals(new Area(path2)));
}
- public void testLine() throws Exception {
+ public void testLine() {
GeneralPath path1 = new GeneralPath(new Line2D.Double(100, 100, 200, 100));
@@ -68,7 +61,7 @@
assertTrue(new Area(path1).equals(new Area(path2)));
}
- public void testRectangle() throws Exception {
+ public void testRectangle() {
GeneralPath path1 = new GeneralPath(new Rectangle2D.Double(100, 100, 200, 50));
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestImagePainter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestImagePainter.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestImagePainter.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestImagePainter.java Tue Aug 18 02:41:45 2009
@@ -17,18 +17,13 @@
package org.apache.poi.hslf.model;
-import junit.framework.*;
+import java.awt.Graphics2D;
-import java.io.FileOutputStream;
-import java.io.File;
-import java.awt.*;
+import junit.framework.TestCase;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.blip.ImagePainter;
import org.apache.poi.hslf.blip.BitmapPainter;
-import org.apache.poi.ddf.EscherBSERecord;
+import org.apache.poi.hslf.blip.ImagePainter;
+import org.apache.poi.hslf.usermodel.PictureData;
/**
* Test Picture shape.
@@ -37,22 +32,23 @@
*/
public final class TestImagePainter extends TestCase {
- private static class CustomImagePainer implements ImagePainter{
+ private static class CustomImagePainter implements ImagePainter {
+ public CustomImagePainter() {
+ // no fields to initialise
+ }
public void paint(Graphics2D graphics, PictureData pict, Picture parent){
//do noting
}
-
}
- public void testImagePainter() throws Exception {
+ public void testImagePainter() {
ImagePainter pntr = PictureData.getImagePainter(Picture.PNG);
assertTrue(PictureData.getImagePainter(Picture.PNG) instanceof BitmapPainter);
assertTrue(PictureData.getImagePainter(Picture.JPEG) instanceof BitmapPainter);
assertTrue(PictureData.getImagePainter(Picture.DIB) instanceof BitmapPainter);
- PictureData.setImagePainter(Picture.WMF, new CustomImagePainer());
- assertTrue(PictureData.getImagePainter(Picture.WMF) instanceof CustomImagePainer);
+ PictureData.setImagePainter(Picture.WMF, new CustomImagePainter());
+ assertTrue(PictureData.getImagePainter(Picture.WMF) instanceof CustomImagePainter);
}
-
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java Tue Aug 18 02:41:45 2009
@@ -17,13 +17,11 @@
package org.apache.poi.hslf.model;
-import junit.framework.*;
+import java.awt.Color;
-import java.io.FileOutputStream;
-import java.awt.*;
+import junit.framework.TestCase;
import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.HSLFSlideShow;
/**
* Test Line shape.
@@ -32,11 +30,7 @@
*/
public final class TestLine extends TestCase {
- public void setUp() throws Exception {
-
- }
-
- public void testCreateLines() throws Exception {
+ public void testCreateLines() {
SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
@@ -129,7 +123,5 @@
line.setLineStyle(Line.LINE_DOUBLE);
line.setLineWidth(8.0);
slide.addShape(line);
-
}
-
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java Tue Aug 18 02:41:45 2009
@@ -17,14 +17,14 @@
package org.apache.poi.hslf.model;
-import junit.framework.TestCase;
-
-import java.io.*;
-import java.awt.*;
import java.awt.geom.Rectangle2D;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+
+import junit.framework.TestCase;
import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.HSLFSlideShow;
/**
* Test <code>MovieShape</code> object.
@@ -61,7 +61,5 @@
shape = (MovieShape)slide.getShapes()[0];
assertEquals(path, shape.getPath());
assertFalse(shape.isAutoPlay());
-
}
-
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java Tue Aug 18 02:41:45 2009
@@ -17,18 +17,17 @@
package org.apache.poi.hslf.model;
-import junit.framework.*;
-
-import java.io.FileOutputStream;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.HSLFSlideShow;
+import junit.framework.TestCase;
+
import org.apache.poi.ddf.EscherBSERecord;
+import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.hslf.usermodel.SlideShow;
/**
* Test Picture shape.
@@ -71,14 +70,13 @@
EscherBSERecord bse3 = pict.getEscherBSERecord();
assertSame(bse2, bse3);
assertEquals(3, bse1.getRef());
-
}
/**
* Picture#getEscherBSERecord threw NullPointerException if EscherContainerRecord.BSTORE_CONTAINER
* was not found. The correct behaviour is to return null.
*/
- public void test46122() throws IOException {
+ public void test46122() {
SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
@@ -90,8 +88,5 @@
BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
pict.draw(graphics);
-
- assertTrue("no errors rendering Picture with null data", true);
}
-
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java Tue Aug 18 02:41:45 2009
@@ -19,10 +19,10 @@
import junit.framework.TestCase;
-import org.apache.poi.hslf.*;
-import org.apache.poi.hslf.model.*;
-import org.apache.poi.hslf.usermodel.*;
+
+import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.record.SlideAtom;
+import org.apache.poi.hslf.usermodel.SlideShow;
/**
* Tests that changing a slide's idea of what notes sheet is its works right
@@ -33,23 +33,23 @@
// SlideShow primed on the test data
private SlideShow ss;
- public TestSlideChangeNotes() throws Exception {
+ public TestSlideChangeNotes() throws Exception {
String dirname = System.getProperty("HSLF.testdata.path");
String filename = dirname + "/basic_test_ppt_file.ppt";
HSLFSlideShow hss = new HSLFSlideShow(filename);
ss = new SlideShow(hss);
- }
+ }
- public void testSetToNone() throws Exception {
+ public void testSetToNone() {
Slide slideOne = ss.getSlides()[0];
SlideAtom sa = slideOne.getSlideRecord().getSlideAtom();
slideOne.setNotes(null);
assertEquals(0, sa.getNotesID());
- }
+ }
- public void testSetToSomething() throws Exception {
+ public void testSetToSomething() {
Slide slideOne = ss.getSlides()[0];
Notes notesOne = ss.getNotes()[1];
SlideAtom sa = slideOne.getSlideRecord().getSlideAtom();
@@ -57,5 +57,5 @@
slideOne.setNotes(notesOne);
assertEquals(notesOne._getSheetNumber(), sa.getNotesID());
- }
+ }
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java Tue Aug 18 02:41:45 2009
@@ -17,17 +17,17 @@
package org.apache.poi.hslf.model;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
import junit.framework.TestCase;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.usermodel.RichTextRun;
+
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
-import org.apache.poi.hslf.record.*;
-import org.apache.poi.hslf.record.StyleTextPropAtom.*;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.awt.*;
+import org.apache.poi.hslf.record.Environment;
+import org.apache.poi.hslf.record.TextHeaderAtom;
+import org.apache.poi.hslf.usermodel.RichTextRun;
+import org.apache.poi.hslf.usermodel.SlideShow;
/**
* Tests for SlideMaster
@@ -37,7 +37,7 @@
public final class TestSlideMaster extends TestCase{
String home;
- public void setUp() throws Exception {
+ public void setUp() {
home = System.getProperty("HSLF.testdata.path");
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Tue Aug 18 02:41:45 2009
@@ -17,15 +17,13 @@
package org.apache.poi.hslf.model;
-import junit.framework.TestCase;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
-import java.io.*;
-import java.awt.*;
-import java.awt.geom.Rectangle2D;
+import junit.framework.TestCase;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.record.TextHeaderAtom;
+import org.apache.poi.hslf.usermodel.SlideShow;
/**
* Test <code>Table</code> object.
@@ -90,13 +88,13 @@
public void testIllegalCOnstruction(){
try {
- Table tbl = new Table(0, 5);
+ new Table(0, 5);
fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");
} catch (IllegalArgumentException e){
}
try {
- Table tbl = new Table(5, 0);
+ new Table(5, 0);
fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");
} catch (IllegalArgumentException e){
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java Tue Aug 18 02:41:45 2009
@@ -22,8 +22,6 @@
import java.io.ByteArrayOutputStream;
import java.util.Arrays;
-import org.apache.poi.util.HexDump;
-
/**
* Tests that {@link HeadersFootersAtom} works properly
*
@@ -43,7 +41,7 @@
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- public void testRead() throws Exception {
+ public void testRead() {
AnimationInfoAtom record = new AnimationInfoAtom(data, 0, data.length);
assertEquals(RecordTypes.AnimationInfoAtom.typeID, record.getRecordType());
assertTrue(record.getFlag(AnimationInfoAtom.Automatic));
@@ -84,5 +82,4 @@
assertTrue(Arrays.equals(data, b));
}
-
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java Tue Aug 18 02:41:45 2009
@@ -22,12 +22,7 @@
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import javax.imageio.stream.FileImageInputStream;
-
-import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java Tue Aug 18 02:41:45 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,18 +14,17 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf.record;
-import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Date;
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.SlideShow;
@@ -36,52 +34,52 @@
*
* @author Nick Burch (nick at torchbox dot com)
*/
-public class TestExHyperlink extends TestCase {
+public final class TestExHyperlink extends TestCase {
// From a real file
private byte[] data_a = new byte[] {
0x0F, 00, 0xD7-256, 0x0F, 0xA8-256, 00, 00, 00,
-
- 00, 00, 0xD3-256, 0x0F, 04, 00, 00, 00,
+
+ 00, 00, 0xD3-256, 0x0F, 04, 00, 00, 00,
03, 00, 00, 00,
-
- 00, 00, 0xBA-256, 0x0F, 0x46, 00, 00, 00,
+
+ 00, 00, 0xBA-256, 0x0F, 0x46, 00, 00, 00,
0x68, 00, 0x74, 00, 0x74, 00, 0x70, 00,
- 0x3A, 00, 0x2F, 00, 0x2F, 00, 0x6A, 00,
+ 0x3A, 00, 0x2F, 00, 0x2F, 00, 0x6A, 00,
0x61, 00, 0x6B, 00, 0x61, 00, 0x72, 00,
0x74, 00, 0x61, 00, 0x2E, 00, 0x61, 00,
0x70, 00, 0x61, 00, 0x63, 00, 0x68, 00,
0x65, 00, 0x2E, 00, 0x6F, 00, 0x72, 00,
0x67, 00, 0x2F, 00, 0x70, 00, 0x6F, 00,
- 0x69, 00, 0x2F, 00, 0x68, 00, 0x73, 00,
- 0x73, 00, 0x66, 00, 0x2F, 00,
-
+ 0x69, 00, 0x2F, 00, 0x68, 00, 0x73, 00,
+ 0x73, 00, 0x66, 00, 0x2F, 00,
+
0x10, 00, 0xBA-256, 0x0F, 0x46, 00, 00, 00,
0x68, 00, 0x74, 00, 0x74, 00, 0x70, 00,
- 0x3A, 00, 0x2F, 00, 0x2F, 00, 0x6A, 00,
+ 0x3A, 00, 0x2F, 00, 0x2F, 00, 0x6A, 00,
0x61, 00, 0x6B, 00, 0x61, 00, 0x72, 00,
0x74, 00, 0x61, 00, 0x2E, 00, 0x61, 00,
0x70, 00, 0x61, 00, 0x63, 00, 0x68, 00,
0x65, 00, 0x2E, 00, 0x6F, 00, 0x72, 00,
0x67, 00, 0x2F, 00, 0x70, 00, 0x6F, 00,
- 0x69, 00, 0x2F, 00, 0x68, 00, 0x73, 00,
- 0x73, 00, 0x66, 00, 0x2F, 00
+ 0x69, 00, 0x2F, 00, 0x68, 00, 0x73, 00,
+ 0x73, 00, 0x66, 00, 0x2F, 00
};
-
- public void testRecordType() throws Exception {
+
+ public void testRecordType() {
ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
assertEquals(4055l, eh.getRecordType());
}
-
- public void testNumber() throws Exception {
+
+ public void testNumber() {
ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
assertEquals(3, eh.getExHyperlinkAtom().getNumber());
}
-
- public void testLinkURL() throws Exception {
+
+ public void testLinkURL() {
ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
assertEquals("http://jakarta.apache.org/poi/hssf/", eh.getLinkURL());
}
- public void testDetails() throws Exception {
+ public void testDetails() {
ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
assertEquals("http://jakarta.apache.org/poi/hssf/", eh._getDetailsA());
assertEquals("http://jakarta.apache.org/poi/hssf/", eh._getDetailsB());
@@ -98,12 +96,12 @@
assertEquals(data_a[i],b[i]);
}
}
-
+
public void testRealFile() throws Exception {
String dirname = System.getProperty("HSLF.testdata.path");
HSLFSlideShow hss = new HSLFSlideShow(dirname + File.separator + "WithLinks.ppt");
SlideShow ss = new SlideShow(hss);
-
+
// Get the document
Document doc = ss.getDocumentRecord();
// Get the ExObjList
@@ -113,37 +111,40 @@
exObjList = (ExObjList)doc._children[i];
}
}
- assertNotNull(exObjList);
-
+ if (exObjList == null) {
+ throw new AssertionFailedError("exObjList must not be null");
+ }
+
// Within that, grab out the Hyperlink atoms
- ArrayList linksA = new ArrayList();
+ List<ExHyperlink> linksA = new ArrayList<ExHyperlink>();
for(int i=0; i<exObjList._children.length; i++) {
- if(exObjList._children[i] instanceof ExHyperlink) {
- linksA.add(exObjList._children[i]);
+ Record ch = exObjList._children[i];
+ if(ch instanceof ExHyperlink) {
+ linksA.add((ExHyperlink) ch);
}
}
-
+
// Should be 4 of them
assertEquals(4, linksA.size());
ExHyperlink[] links = new ExHyperlink[linksA.size()];
linksA.toArray(links);
-
+
assertEquals(4, exObjList.getExHyperlinks().length);
-
+
// Check the other way
-
+
// Check they have what we expect in them
assertEquals(1, links[0].getExHyperlinkAtom().getNumber());
assertEquals("http://jakarta.apache.org/poi/", links[0].getLinkURL());
-
+
assertEquals(2, links[1].getExHyperlinkAtom().getNumber());
assertEquals("http://slashdot.org/", links[1].getLinkURL());
-
+
assertEquals(3, links[2].getExHyperlinkAtom().getNumber());
assertEquals("http://jakarta.apache.org/poi/hssf/", links[2].getLinkURL());
-
+
assertEquals(4, links[3].getExHyperlinkAtom().getNumber());
assertEquals("http://jakarta.apache.org/hslf/", links[3].getLinkURL());
-
+
}
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlinkAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlinkAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlinkAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlinkAtom.java Tue Aug 18 02:41:45 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,16 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf.record;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
/**
* Tests that ExHyperlinkAtom works properly.
@@ -37,24 +32,24 @@
00, 00, 0xD3-256, 0x0F, 04, 00, 00, 00,
01, 00, 00, 00
};
- private byte[] data_b = new byte[] {
+ private byte[] data_b = new byte[] {
00, 00, 0xD3-256, 0x0F, 04, 00, 00, 00,
04, 00, 00, 00
};
-
- public void testRecordType() throws Exception {
+
+ public void testRecordType() {
ExHyperlinkAtom eha = new ExHyperlinkAtom(data_a, 0, data_a.length);
assertEquals(4051l, eha.getRecordType());
}
-
- public void testGetNumber() throws Exception {
+
+ public void testGetNumber() {
ExHyperlinkAtom eha = new ExHyperlinkAtom(data_a, 0, data_a.length);
ExHyperlinkAtom ehb = new ExHyperlinkAtom(data_b, 0, data_b.length);
-
+
assertEquals(1, eha.getNumber());
assertEquals(4, ehb.getNumber());
}
-
+
public void testWrite() throws Exception {
ExHyperlinkAtom eha = new ExHyperlinkAtom(data_a, 0, data_a.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -68,35 +63,35 @@
}
// Create A from scratch
- public void testCreate() throws Exception {
- ExHyperlinkAtom eha = new ExHyperlinkAtom();
-
- // Set value
- eha.setNumber(1);
-
+ public void testCreate() throws Exception {
+ ExHyperlinkAtom eha = new ExHyperlinkAtom();
+
+ // Set value
+ eha.setNumber(1);
+
// Check it's now the same as a
ByteArrayOutputStream baos = new ByteArrayOutputStream();
eha.writeOut(baos);
byte[] b = baos.toByteArray();
-
+
assertEquals(data_a.length, b.length);
for(int i=0; i<data_a.length; i++) {
assertEquals(data_a[i],b[i]);
}
- }
+ }
// Try to turn a into b
public void testChange() throws Exception {
- ExHyperlinkAtom eha = new ExHyperlinkAtom(data_a, 0, data_a.length);
+ ExHyperlinkAtom eha = new ExHyperlinkAtom(data_a, 0, data_a.length);
// Change the number
eha.setNumber(4);
-
+
// Check bytes are now the same
ByteArrayOutputStream baos = new ByteArrayOutputStream();
eha.writeOut(baos);
byte[] b = baos.toByteArray();
-
+
// Should now be the same
assertEquals(data_b.length, b.length);
for(int i=0; i<data_b.length; i++) {
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java Tue Aug 18 02:41:45 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,18 +14,13 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf.record;
-import junit.framework.TestCase;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
+
+import junit.framework.TestCase;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.SlideShow;
@@ -41,36 +35,36 @@
String dirname = System.getProperty("HSLF.testdata.path");
HSLFSlideShow hss = new HSLFSlideShow(dirname + File.separator + "WithLinks.ppt");
SlideShow ss = new SlideShow(hss);
-
+
// Get the document
Document doc = ss.getDocumentRecord();
// Get the ExObjList
ExObjList exObjList = doc.getExObjList();
assertNotNull(exObjList);
assertEquals(1033l, exObjList.getRecordType());
-
+
// Check the atom
assertNotNull(exObjList.getExObjListAtom());
assertEquals(4, exObjList.getExObjListAtom().getObjectIDSeed());
-
+
// Check the Hyperlinks
assertEquals(4, exObjList.getExHyperlinks().length);
-
+
// Check the contents
ExHyperlink[] links = exObjList.getExHyperlinks();
-
+
// Check they have what we expect in them
assertEquals(1, links[0].getExHyperlinkAtom().getNumber());
assertEquals("http://jakarta.apache.org/poi/", links[0].getLinkURL());
-
+
assertEquals(2, links[1].getExHyperlinkAtom().getNumber());
assertEquals("http://slashdot.org/", links[1].getLinkURL());
-
+
assertEquals(3, links[2].getExHyperlinkAtom().getNumber());
assertEquals("http://jakarta.apache.org/poi/hssf/", links[2].getLinkURL());
-
+
assertEquals(4, links[3].getExHyperlinkAtom().getNumber());
assertEquals("http://jakarta.apache.org/hslf/", links[3].getLinkURL());
-
+
}
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjListAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjListAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjListAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjListAtom.java Tue Aug 18 02:41:45 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,16 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf.record;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
/**
* Tests that ExObjListAtom works properly.
@@ -37,26 +32,26 @@
00, 00, 0x0A, 0x04, 04, 00, 00, 00,
01, 00, 00, 00
};
- private byte[] data_b = new byte[] {
+ private byte[] data_b = new byte[] {
00, 00, 0x0A, 0x04, 04, 00, 00, 00,
04, 00, 00, 00
};
-
- public void testRecordType() throws Exception {
- ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
+
+ public void testRecordType() {
+ ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
assertEquals(1034l, eoa.getRecordType());
}
-
- public void testGetSeed() throws Exception {
- ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
- ExObjListAtom eob = new ExObjListAtom(data_b, 0, data_b.length);
-
+
+ public void testGetSeed() {
+ ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
+ ExObjListAtom eob = new ExObjListAtom(data_b, 0, data_b.length);
+
assertEquals(1, eoa.getObjectIDSeed());
assertEquals(4, eob.getObjectIDSeed());
- }
-
+ }
+
public void testWrite() throws Exception {
- ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
+ ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
eoa.writeOut(baos);
byte[] b = baos.toByteArray();
@@ -68,35 +63,35 @@
}
// Create A from scratch
- public void testCreate() throws Exception {
- ExObjListAtom eoa = new ExObjListAtom();
-
- // Set seed
- eoa.setObjectIDSeed(1);
-
+ public void testCreate() throws Exception {
+ ExObjListAtom eoa = new ExObjListAtom();
+
+ // Set seed
+ eoa.setObjectIDSeed(1);
+
// Check it's now the same as a
ByteArrayOutputStream baos = new ByteArrayOutputStream();
eoa.writeOut(baos);
byte[] b = baos.toByteArray();
-
+
assertEquals(data_a.length, b.length);
for(int i=0; i<data_a.length; i++) {
assertEquals(data_a[i],b[i]);
}
- }
+ }
// Try to turn a into b
public void testChange() throws Exception {
- ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
+ ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
// Change the number
eoa.setObjectIDSeed(4);
-
+
// Check bytes are now the same
ByteArrayOutputStream baos = new ByteArrayOutputStream();
eoa.writeOut(baos);
byte[] b = baos.toByteArray();
-
+
// Should now be the same
assertEquals(data_b.length, b.length);
for(int i=0; i<data_b.length; i++) {
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java Tue Aug 18 02:41:45 2009
@@ -20,13 +20,11 @@
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Arrays;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentEntry;
/**
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java Tue Aug 18 02:41:45 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,16 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf.record;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
/**
* Tests that InteractiveInfoAtom works properly.
@@ -33,44 +28,44 @@
*/
public class TestInteractiveInfoAtom extends TestCase {
// From a real file
- private byte[] data_a = new byte[] {
+ private byte[] data_a = new byte[] {
00, 00, 0xF3-256, 0x0F, 0x10, 00, 00, 00,
00, 00, 00, 00, 01, 00, 00, 00,
04, 00, 00, 00, 8, 00, 00, 00
};
- private byte[] data_b = new byte[] {
+ private byte[] data_b = new byte[] {
00, 00, 0xF3-256, 0x0F, 0x10, 00, 00, 00,
00, 00, 00, 00, 04, 00, 00, 00,
04, 00, 00, 00, 8, 00, 00, 00
};
-
- public void testRecordType() throws Exception {
+
+ public void testRecordType() {
InteractiveInfoAtom ia = new InteractiveInfoAtom(data_a, 0, data_a.length);
assertEquals(4083l, ia.getRecordType());
}
-
- public void testGetNumber() throws Exception {
+
+ public void testGetNumber() {
InteractiveInfoAtom ia = new InteractiveInfoAtom(data_a, 0, data_a.length);
InteractiveInfoAtom ib = new InteractiveInfoAtom(data_b, 0, data_b.length);
-
+
assertEquals(1, ia.getHyperlinkID());
assertEquals(4, ib.getHyperlinkID());
- }
-
- public void testGetRest() throws Exception {
+ }
+
+ public void testGetRest() {
InteractiveInfoAtom ia = new InteractiveInfoAtom(data_a, 0, data_a.length);
InteractiveInfoAtom ib = new InteractiveInfoAtom(data_b, 0, data_b.length);
-
+
assertEquals(0, ia.getSoundRef());
assertEquals(0, ib.getSoundRef());
-
+
assertEquals(4, ia.getAction());
assertEquals(4, ib.getAction());
-
+
assertEquals(8, ia.getHyperlinkType());
assertEquals(8, ib.getHyperlinkType());
- }
-
+ }
+
public void testWrite() throws Exception {
InteractiveInfoAtom ia = new InteractiveInfoAtom(data_a, 0, data_a.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -84,25 +79,25 @@
}
// Create A from scratch
- public void testCreate() throws Exception {
- InteractiveInfoAtom ia = new InteractiveInfoAtom();
-
- // Set values
- ia.setHyperlinkID(1);
- ia.setSoundRef(0);
- ia.setAction((byte)4);
- ia.setHyperlinkType((byte)8);
-
+ public void testCreate() throws Exception {
+ InteractiveInfoAtom ia = new InteractiveInfoAtom();
+
+ // Set values
+ ia.setHyperlinkID(1);
+ ia.setSoundRef(0);
+ ia.setAction((byte)4);
+ ia.setHyperlinkType((byte)8);
+
// Check it's now the same as a
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ia.writeOut(baos);
byte[] b = baos.toByteArray();
-
+
assertEquals(data_a.length, b.length);
for(int i=0; i<data_a.length; i++) {
assertEquals(data_a[i],b[i]);
}
- }
+ }
// Try to turn a into b
public void testChange() throws Exception {
@@ -110,12 +105,12 @@
// Change the number
ia.setHyperlinkID(4);
-
+
// Check bytes are now the same
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ia.writeOut(baos);
byte[] b = baos.toByteArray();
-
+
// Should now be the same
assertEquals(data_b.length, b.length);
for(int i=0; i<data_b.length; i++) {
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java Tue Aug 18 02:41:45 2009
@@ -17,21 +17,18 @@
package org.apache.poi.hslf.record;
-
-import junit.framework.TestCase;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.Arrays;
-import org.apache.poi.hslf.HSLFSlideShow;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
import org.apache.poi.hslf.usermodel.SlideShow;
/**
- * Tests Sound-related records: SoundCollection(2020), Sound(2022) and SoundData(2023)).
+ * Tests Sound-related records: SoundCollection(2020), Sound(2022) and
+ * SoundData(2023)).
*
* @author Yegor Kozlov
*/
@@ -44,40 +41,43 @@
// Get the document
Document doc = ppt.getDocumentRecord();
- SoundCollection soundCollection = null;
- Record[] doc_ch = doc.getChildRecords();
- for (int i = 0; i < doc_ch.length; i++) {
- if(doc_ch[i] instanceof SoundCollection){
- soundCollection = (SoundCollection)doc_ch[i];
- break;
- }
- }
- assertNotNull(soundCollection);
-
- Sound sound = null;
- Record[] sound_ch = soundCollection.getChildRecords();
- int k = 0;
- for (int i = 0; i < sound_ch.length; i++) {
- if(sound_ch[i] instanceof Sound){
- sound = (Sound)sound_ch[i];
- k++;
- }
- }
- assertNotNull(sound);
- assertEquals(1, k);
-
- assertEquals("ringin.wav", sound.getSoundName());
- assertEquals(".WAV", sound.getSoundType());
- assertNotNull(sound.getSoundData());
-
- File f = new File(cwd, "ringin.wav");
- int length = (int)f.length();
- byte[] ref_data = new byte[length];
- is = new FileInputStream(f);
- is.read(ref_data);
- is.close();
-
- assertTrue(Arrays.equals(ref_data, sound.getSoundData()));
+ SoundCollection soundCollection = null;
+ Record[] doc_ch = doc.getChildRecords();
+ for (int i = 0; i < doc_ch.length; i++) {
+ if (doc_ch[i] instanceof SoundCollection) {
+ soundCollection = (SoundCollection) doc_ch[i];
+ break;
+ }
+ }
+ if (soundCollection == null) {
+ throw new AssertionFailedError("soundCollection must not be null");
+ }
+
+ Sound sound = null;
+ Record[] sound_ch = soundCollection.getChildRecords();
+ int k = 0;
+ for (int i = 0; i < sound_ch.length; i++) {
+ if (sound_ch[i] instanceof Sound) {
+ sound = (Sound) sound_ch[i];
+ k++;
+ }
+ }
+ if (sound == null) {
+ throw new AssertionFailedError("sound must not be null");
+ }
+ assertEquals(1, k);
+
+ assertEquals("ringin.wav", sound.getSoundName());
+ assertEquals(".WAV", sound.getSoundType());
+ assertNotNull(sound.getSoundData());
+
+ File f = new File(cwd, "ringin.wav");
+ int length = (int) f.length();
+ byte[] ref_data = new byte[length];
+ is = new FileInputStream(f);
+ is.read(ref_data);
+ is.close();
+ assertTrue(Arrays.equals(ref_data, sound.getSoundData()));
}
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java Tue Aug 18 02:41:45 2009
@@ -17,19 +17,18 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.hslf.HSLFSlideShow;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.LinkedList;
+
+import junit.framework.TestCase;
+
import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
import org.apache.poi.hslf.model.textproperties.TextProp;
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.record.StyleTextPropAtom.*;
-import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.util.HexDump;
-import junit.framework.TestCase;
-import java.io.ByteArrayOutputStream;
-import java.util.LinkedList;
-import java.util.Arrays;
-
/**
* Tests that StyleTextPropAtom works properly
*
@@ -164,7 +163,7 @@
assertEquals(5, stpb.getCharacterStyles().size());
}
- public void testParagraphStyleCounts() throws Exception {
+ public void testParagraphStyleCounts() {
StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
@@ -179,7 +178,7 @@
}
- public void testCharacterStyleLengths() throws Exception {
+ public void testCharacterStyleLengths() {
StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
@@ -209,7 +208,7 @@
}
- public void testCharacterPropOrdering() throws Exception {
+ public void testCharacterPropOrdering() {
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
stpb.setParentTextSize(data_b_text_len);
@@ -263,7 +262,7 @@
assertEquals(24, tp_4_3.getValue());
}
- public void testParagraphProps() throws Exception {
+ public void testParagraphProps() {
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
stpb.setParentTextSize(data_b_text_len);
@@ -315,7 +314,7 @@
assertEquals(80, tp_4_2.getValue());
}
- public void testCharacterProps() throws Exception {
+ public void testCharacterProps() {
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
stpb.setParentTextSize(data_b_text_len);
@@ -647,37 +646,41 @@
}
}
- public void testWriteA() throws Exception {
+ public void testWriteA() {
doReadWrite(data_a, -1);
}
- public void testLoadWriteA() throws Exception {
+ public void testLoadWriteA() {
doReadWrite(data_b, data_b_text_len);
}
- public void testWriteB() throws Exception {
+ public void testWriteB() {
doReadWrite(data_b, -1);
}
- public void testLoadWriteB() throws Exception {
+ public void testLoadWriteB() {
doReadWrite(data_b, data_b_text_len);
}
- public void testLoadWriteC() throws Exception {
+ public void testLoadWriteC() {
doReadWrite(data_c, data_c_text_len);
}
- public void testLoadWriteD() throws Exception {
+ public void testLoadWriteD() {
doReadWrite(data_d, data_d_text_len);
}
- protected void doReadWrite(byte[] data, int textlen) throws Exception {
+ protected void doReadWrite(byte[] data, int textlen) {
StyleTextPropAtom stpb = new StyleTextPropAtom(data, 0,data.length);
if(textlen != -1) stpb.setParentTextSize(textlen);
ByteArrayOutputStream out = new ByteArrayOutputStream();
- stpb.writeOut(out);
+ try {
+ stpb.writeOut(out);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
byte[] bytes = out.toByteArray();
assertEquals(data.length, bytes.length);
@@ -689,7 +692,7 @@
}
}
- public void testNotEnoughDataProp() throws Exception {
+ public void testNotEnoughDataProp() {
// We don't have enough data in the record to cover
// all the properties the mask says we have
// Make sure we just do the best we can
@@ -702,7 +705,7 @@
/**
* Check the test data for Bug 40143.
*/
- public void testBug40143() throws Exception {
+ public void testBug40143() {
StyleTextPropAtom atom = new StyleTextPropAtom(data_d, 0, data_d.length);
atom.setParentTextSize(data_d_text_len);
@@ -724,7 +727,7 @@
/**
* Check the test data for Bug 42677.
*/
- public void test42677() throws Exception {
+ public void test42677() {
int length = 18;
byte[] data = {0x00, 0x00, (byte)0xA1, 0x0F, 0x28, 0x00, 0x00, 0x00,
0x13, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , (byte)0xF1 , 0x20 , 0x00, 0x00 , 0x00 , 0x00 ,
@@ -748,7 +751,7 @@
* 00 00 00 01 18 00 00 01 18 01 00 00 00 01 1C 00 00 01 1C
* </StyleTextPropAtom>
*/
- public void test45815() throws Exception {
+ public void test45815() {
int length = 19;
byte[] data = {
0x00, 0x00, (byte)0xA1, 0x0F, 0x5E, 0x00, 0x00, 0x00, 0x14, 0x00,
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java Tue Aug 18 02:41:45 2009
@@ -17,19 +17,11 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
-import org.apache.poi.hslf.model.textproperties.TextProp;
-import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.record.StyleTextPropAtom.*;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.util.HexDump;
-
-import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.util.LinkedList;
import java.util.Arrays;
+import junit.framework.TestCase;
+
/**
* Tests TextRulerAtom
*
@@ -37,53 +29,51 @@
*/
public final class TestTextRulerAtom extends TestCase {
- //from a real file
+ //from a real file
private byte[] data_1 = new byte[] {
0x00, 0x00, (byte)0xA6, 0x0F, 0x18, 0x00, 0x00, 0x00,
- (byte)0xF8, 0x1F, 0x00, 0x00, 0x75, 0x00, (byte)0xE2, 0x00, 0x59,
- 0x01, (byte)0xC3, 0x01, 0x1A, 0x03, (byte)0x87, 0x03, (byte)0xF8,
- 0x03, 0x69, 0x04, (byte)0xF6, 0x05, (byte)0xF6, 0x05
+ (byte)0xF8, 0x1F, 0x00, 0x00, 0x75, 0x00, (byte)0xE2, 0x00, 0x59,
+ 0x01, (byte)0xC3, 0x01, 0x1A, 0x03, (byte)0x87, 0x03, (byte)0xF8,
+ 0x03, 0x69, 0x04, (byte)0xF6, 0x05, (byte)0xF6, 0x05
};
- private byte[] data_2 = new byte[] {
- 0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
- 0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
- };
+ private byte[] data_2 = new byte[] {
+ 0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
+ 0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
+ };
- public void testReadRuler() throws Exception {
+ public void testReadRuler() {
TextRulerAtom ruler = new TextRulerAtom(data_1, 0, data_1.length);
- assertEquals(ruler.getNumberOfLevels(), 0);
- assertEquals(ruler.getDefaultTabSize(), 0);
+ assertEquals(ruler.getNumberOfLevels(), 0);
+ assertEquals(ruler.getDefaultTabSize(), 0);
- int[] tabStops = ruler.getTabStops();
- assertNull(tabStops);
+ int[] tabStops = ruler.getTabStops();
+ assertNull(tabStops);
- int[] textOffsets = ruler.getTextOffsets();
- assertTrue(Arrays.equals(new int[]{226, 451, 903, 1129, 1526}, textOffsets));
+ int[] textOffsets = ruler.getTextOffsets();
+ assertTrue(Arrays.equals(new int[]{226, 451, 903, 1129, 1526}, textOffsets));
- int[] bulletOffsets = ruler.getBulletOffsets();
- assertTrue(Arrays.equals(new int[]{117, 345, 794, 1016, 1526}, bulletOffsets));
+ int[] bulletOffsets = ruler.getBulletOffsets();
+ assertTrue(Arrays.equals(new int[]{117, 345, 794, 1016, 1526}, bulletOffsets));
}
- public void testWriteRuler() throws Exception {
+ public void testWriteRuler() throws Exception {
TextRulerAtom ruler = new TextRulerAtom(data_1, 0, data_1.length);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ruler.writeOut(out);
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ruler.writeOut(out);
- byte[] result = out.toByteArray();
- assertTrue(Arrays.equals(result, data_1));
+ byte[] result = out.toByteArray();
+ assertTrue(Arrays.equals(result, data_1));
}
- public void testRead2() throws Exception {
+ public void testRead2() throws Exception {
TextRulerAtom ruler = TextRulerAtom.getParagraphInstance();
- ruler.setParagraphIndent((short)249, (short)321);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ruler.writeOut(out);
-
- byte[] result = out.toByteArray();
- assertTrue(Arrays.equals(result, data_2));
+ ruler.setParagraphIndent((short)249, (short)321);
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ruler.writeOut(out);
+ byte[] result = out.toByteArray();
+ assertTrue(Arrays.equals(result, data_2));
}
-
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java Tue Aug 18 02:41:45 2009
@@ -17,19 +17,11 @@
package org.apache.poi.hslf.record;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
-import org.apache.poi.hslf.model.textproperties.TextProp;
-import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.record.StyleTextPropAtom.*;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.util.HexDump;
-
-import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.util.LinkedList;
import java.util.Arrays;
+import junit.framework.TestCase;
+
/**
* Tests TextSpecInfoAtom
*
@@ -38,17 +30,17 @@
public final class TestTextSpecInfoAtom extends TestCase {
//from a real file
- private byte[] data_1 = new byte[] {
+ private byte[] data_1 = new byte[] {
0x00, 0x00, (byte)0xAA, 0x0F, 0x2C, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
+ };
- public void testRead() throws Exception {
- TextSpecInfoAtom spec = new TextSpecInfoAtom(data_1, 0, data_1.length);
+ public void testRead() {
+ TextSpecInfoAtom spec = new TextSpecInfoAtom(data_1, 0, data_1.length);
TextSpecInfoAtom.TextSpecInfoRun[] run = spec.getTextSpecInfoRuns();
assertEquals(5, run.length);
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java Tue Aug 18 02:41:45 2009
@@ -20,8 +20,6 @@
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
/**
* Tests that TxInteractiveInfoAtom works properly.
@@ -35,24 +33,24 @@
0x19, 00, 00, 00, 0x38, 00, 00, 00
};
- private byte[] data_b = new byte[] {
- 00, 00, (byte)0xDF, 0x0F, 0x08, 00, 00, 00,
- 0x39, 00, 00, 00, 0x4E, 00, 00, 00
- };
+ private byte[] data_b = new byte[] {
+ 00, 00, (byte)0xDF, 0x0F, 0x08, 00, 00, 00,
+ 0x39, 00, 00, 00, 0x4E, 00, 00, 00
+ };
- public void testRead() throws Exception {
- TxInteractiveInfoAtom ia1 = new TxInteractiveInfoAtom(data_a, 0, data_a.length);
+ public void testRead() {
+ TxInteractiveInfoAtom ia1 = new TxInteractiveInfoAtom(data_a, 0, data_a.length);
- assertEquals(4063, ia1.getRecordType());
+ assertEquals(4063, ia1.getRecordType());
assertEquals(25, ia1.getStartIndex());
assertEquals(56, ia1.getEndIndex());
- TxInteractiveInfoAtom ia2 = new TxInteractiveInfoAtom(data_b, 0, data_b.length);
+ TxInteractiveInfoAtom ia2 = new TxInteractiveInfoAtom(data_b, 0, data_b.length);
- assertEquals(4063, ia2.getRecordType());
+ assertEquals(4063, ia2.getRecordType());
assertEquals(57, ia2.getStartIndex());
assertEquals(78, ia2.getEndIndex());
- }
+ }
public void testWrite() throws Exception {
TxInteractiveInfoAtom atom = new TxInteractiveInfoAtom(data_a, 0, data_a.length);
@@ -67,12 +65,12 @@
}
// Create A from scratch
- public void testCreate() throws Exception {
- TxInteractiveInfoAtom ia = new TxInteractiveInfoAtom();
+ public void testCreate() throws Exception {
+ TxInteractiveInfoAtom ia = new TxInteractiveInfoAtom();
- // Set values
- ia.setStartIndex(25);
- ia.setEndIndex(56);
+ // Set values
+ ia.setStartIndex(25);
+ ia.setEndIndex(56);
// Check it's now the same as a
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -83,7 +81,7 @@
for(int i=0; i<data_a.length; i++) {
assertEquals(data_a[i],b[i]);
}
- }
+ }
// Try to turn a into b
public void testChange() throws Exception {
@@ -91,7 +89,7 @@
// Change the number
ia.setStartIndex(57);
- ia.setEndIndex(78);
+ ia.setEndIndex(78);
// Check bytes are now the same
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java?rev=805262&r1=805261&r2=805262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java Tue Aug 18 02:41:45 2009
@@ -17,13 +17,15 @@
package org.apache.poi.hslf.record;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
-import org.apache.poi.hslf.usermodel.SlideShow;
+
import org.apache.poi.hslf.model.textproperties.TextProp;
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.record.StyleTextPropAtom.*;
-
-import java.util.ArrayList;
+import org.apache.poi.hslf.usermodel.SlideShow;
/**
@@ -36,9 +38,8 @@
public final class TestTxMasterStyleAtom extends TestCase {
protected SlideShow _ppt;
- public void setUp() throws Exception{
+ public void setUp() {
_ppt = new SlideShow();
-
}
public void testDefaultStyles() {
@@ -199,23 +200,25 @@
* There must be a TxMasterStyleAtom per each type of text defined in TextHeaderAtom
*/
protected TxMasterStyleAtom[] getMasterStyles(){
- ArrayList lst = new ArrayList();
+ List<TxMasterStyleAtom> lst = new ArrayList<TxMasterStyleAtom>();
- Record[] core = _ppt.getMostRecentCoreRecords();
- for (int i = 0; i < core.length; i++) {
- if(core[i].getRecordType() == RecordTypes.MainMaster.typeID){
- Record[] rec = core[i].getChildRecords();
+ Record[] coreRecs = _ppt.getMostRecentCoreRecords();
+ for (int i = 0; i < coreRecs.length; i++) {
+ Record coreRec = coreRecs[i];
+ if(coreRec.getRecordType() == RecordTypes.MainMaster.typeID){
+ Record[] recs = coreRec.getChildRecords();
int cnt = 0;
- for (int j = 0; j < rec.length; j++) {
- if (rec[j] instanceof TxMasterStyleAtom) {
- lst.add(rec[j]);
+ for (int j = 0; j < recs.length; j++) {
+ Record rec = recs[j];
+ if (rec instanceof TxMasterStyleAtom) {
+ lst.add((TxMasterStyleAtom) rec);
cnt++;
}
}
assertEquals("MainMaster must contain 7 TxMasterStyleAtoms ", 7, cnt);
- } else if(core[i].getRecordType() == RecordTypes.Document.typeID){
+ } else if(coreRec.getRecordType() == RecordTypes.Document.typeID){
TxMasterStyleAtom txstyle = null;
- Document doc = (Document)core[i];
+ Document doc = (Document)coreRec;
Record[] rec = doc.getEnvironment().getChildRecords();
for (int j = 0; j < rec.length; j++) {
if (rec[j] instanceof TxMasterStyleAtom) {
@@ -223,7 +226,9 @@
txstyle = (TxMasterStyleAtom)rec[j];
}
}
- assertNotNull("TxMasterStyleAtom not found in Document.Environment", txstyle);
+ if (txstyle == null) {
+ throw new AssertionFailedError("TxMasterStyleAtom not found in Document.Environment");
+ }
assertEquals("Document.Environment must contain TxMasterStyleAtom with type=TextHeaderAtom.OTHER_TYPE",
TextHeaderAtom.OTHER_TYPE, txstyle.getTextType());
@@ -231,6 +236,6 @@
}
}
- return (TxMasterStyleAtom[])lst.toArray(new TxMasterStyleAtom[lst.size()]);
+ return lst.toArray(new TxMasterStyleAtom[lst.size()]);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org