Methods Summary |
---|
public void | assertSlideShowWritesOutTheSame(org.apache.poi.hslf.HSLFSlideShow hss, org.apache.poi.poifs.filesystem.POIFSFileSystem pfs)
// Create a slideshow covering it
SlideShow ss = new SlideShow(hss);
ss.getSlides();
ss.getNotes();
// Now write out to a byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
hss.write(baos);
// Build an input stream of it
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
// Use POIFS to query that lot
POIFSFileSystem npfs = new POIFSFileSystem(bais);
// Check that the "PowerPoint Document" sections have the same size
DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry("PowerPoint Document");
DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry("PowerPoint Document");
assertEquals(oProps.getSize(),nProps.getSize());
// Check that they contain the same data
byte[] _oData = new byte[oProps.getSize()];
byte[] _nData = new byte[nProps.getSize()];
pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
for(int i=0; i<_oData.length; i++) {
if(_oData[i] != _nData[i])
System.out.println(i + "\t" + Integer.toHexString(i));
assertEquals(_oData[i], _nData[i]);
}
|
public void | assertWritesOutTheSame(org.apache.poi.hslf.HSLFSlideShow hss, org.apache.poi.poifs.filesystem.POIFSFileSystem pfs)
// Write out to a byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
hss.write(baos);
// Build an input stream of it
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
// Use POIFS to query that lot
POIFSFileSystem npfs = new POIFSFileSystem(bais);
// Check that the "PowerPoint Document" sections have the same size
DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry("PowerPoint Document");
DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry("PowerPoint Document");
assertEquals(oProps.getSize(),nProps.getSize());
// Check that they contain the same data
byte[] _oData = new byte[oProps.getSize()];
byte[] _nData = new byte[nProps.getSize()];
pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
for(int i=0; i<_oData.length; i++) {
//System.out.println(i + "\t" + Integer.toHexString(i));
assertEquals(_oData[i], _nData[i]);
}
|
public void | setUp()
String dirname = System.getProperty("HSLF.testdata.path");
String filenameA = dirname + "/basic_test_ppt_file.ppt";
FileInputStream fisA = new FileInputStream(filenameA);
pfsA = new POIFSFileSystem(fisA);
hssA = new HSLFSlideShow(pfsA);
String filenameB = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
FileInputStream fisB = new FileInputStream(filenameB);
pfsB = new POIFSFileSystem(fisB);
hssB = new HSLFSlideShow(pfsB);
|
public void | testSlideShowWritesOutTheSame()Ensure that simply opening a slideshow (usermodel) view of it
doesn't change things
assertSlideShowWritesOutTheSame(hssA, pfsA);
// Some bug in StyleTextPropAtom rewriting means this will fail
// We need to identify and fix that first
//assertSlideShowWritesOutTheSame(hssB, pfsB);
|
public void | testWritesOutTheSame()
assertWritesOutTheSame(hssA, pfsA);
assertWritesOutTheSame(hssB, pfsB);
|