SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
byte[] src_bytes = slTests.readFile("cow.pict");
int idx = ppt.addPicture(src_bytes, Picture.PICT);
Picture pict = new Picture(idx);
assertEquals(idx, pict.getPictureIndex());
slide.addShape(pict);
//serialize and read again
ByteArrayOutputStream out = new ByteArrayOutputStream();
ppt.write(out);
out.close();
ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
//make sure we can read this picture shape and it refers to the correct picture data
Shape[] sh = ppt.getSlides()[0].getShapes();
assertEquals(1, sh.length);
pict = (Picture)sh[0];
assertEquals(idx, pict.getPictureIndex());
//check picture data
PictureData[] pictures = ppt.getPictureData();
//the Picture shape refers to the PictureData object in the Presentation
assertEquals(pict.getPictureData(), pictures[0]);
assertEquals(1, pictures.length);
assertEquals(Picture.PICT, pictures[0].getType());
assertTrue(pictures[0] instanceof PICT);
//compare the content of the initial file with what is stored in the PictureData