for test cases: do not reconstruct binary tables for read-write tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-12 09:09:05 +00:00
parent 920e0ee72f
commit 83c757f1cb
2 changed files with 17 additions and 4 deletions

View File

@ -74,7 +74,7 @@ public class CHPBinTable
*/ */
public CHPBinTable( byte[] documentStream, byte[] tableStream, int offset, public CHPBinTable( byte[] documentStream, byte[] tableStream, int offset,
int size, ComplexFileTable complexFileTable, TextPieceTable tpt, int size, ComplexFileTable complexFileTable, TextPieceTable tpt,
boolean ignoreChpxWithoutTextPieces ) boolean reconstructChpxTable )
{ {
/* /*
* Page 35: * Page 35:
@ -96,7 +96,7 @@ public class CHPBinTable
int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum; int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;
CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream, CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream,
pageOffset, tpt, ignoreChpxWithoutTextPieces); pageOffset, tpt, reconstructChpxTable);
int fkpSize = cfkp.size(); int fkpSize = cfkp.size();
@ -108,6 +108,12 @@ public class CHPBinTable
} }
} }
if ( !reconstructChpxTable )
{
Collections.sort( _textRuns );
return;
}
if ( complexFileTable != null ) if ( complexFileTable != null )
{ {
SprmBuffer[] sprmBuffers = complexFileTable.getGrpprls(); SprmBuffer[] sprmBuffers = complexFileTable.getGrpprls();

View File

@ -20,6 +20,7 @@ package org.apache.poi.hwpf.model;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -69,7 +70,7 @@ public class PAPBinTable
public PAPBinTable( byte[] documentStream, byte[] tableStream, public PAPBinTable( byte[] documentStream, byte[] tableStream,
byte[] dataStream, int offset, int size, ComplexFileTable complexFileTable, byte[] dataStream, int offset, int size, ComplexFileTable complexFileTable,
TextPieceTable tpt, boolean ignorePapxWithoutTextPieces ) TextPieceTable tpt, boolean reconstructPapxTable )
{ {
PlexOfCps binTable = new PlexOfCps(tableStream, offset, size, 4); PlexOfCps binTable = new PlexOfCps(tableStream, offset, size, 4);
this.tpt = tpt; this.tpt = tpt;
@ -83,7 +84,7 @@ public class PAPBinTable
int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum; int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;
PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(documentStream, PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(documentStream,
dataStream, pageOffset, tpt, ignorePapxWithoutTextPieces); dataStream, pageOffset, tpt, reconstructPapxTable);
int fkpSize = pfkp.size(); int fkpSize = pfkp.size();
@ -96,6 +97,12 @@ public class PAPBinTable
} }
} }
if ( !reconstructPapxTable )
{
Collections.sort( _paragraphs );
return;
}
if ( complexFileTable != null ) if ( complexFileTable != null )
{ {
SprmBuffer[] sprmBuffers = complexFileTable.getGrpprls(); SprmBuffer[] sprmBuffers = complexFileTable.getGrpprls();