01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.hslf.model;
19:
20: import java.io.*;
21:
22: import org.apache.poi.hslf.HSLFSlideShow;
23: import org.apache.poi.hslf.usermodel.ObjectData;
24: import org.apache.poi.hslf.usermodel.PictureData;
25:
26: import junit.framework.TestCase;
27:
28: public class TestOleEmbedding extends TestCase {
29: /**
30: * Tests support for OLE objects.
31: *
32: * @throws Exception if an error occurs.
33: */
34: public void testOleEmbedding2003() throws Exception {
35: String dirname = System.getProperty("HSLF.testdata.path");
36: File file = new File(dirname, "ole2-embedding-2003.ppt");
37: HSLFSlideShow slideShow = new HSLFSlideShow(
38: new FileInputStream(file));
39: try {
40: // Placeholder EMFs for clients that don't support the OLE components.
41: PictureData[] pictures = slideShow.getPictures();
42: assertEquals("Should be two pictures", 2, pictures.length);
43: //assertDigestEquals("Wrong data for picture 1", "8d1fbadf4814f321bb1ccdd056e3c788", pictures[0].getData());
44: //assertDigestEquals("Wrong data for picture 2", "987a698e83559cf3d38a0deeba1cc63b", pictures[1].getData());
45:
46: // Actual embedded objects.
47: ObjectData[] objects = slideShow.getEmbeddedObjects();
48: assertEquals("Should be two objects", 2, objects.length);
49: //assertDigestEquals("Wrong data for objecs 1", "0d1fcc61a83de5c4894dc0c88e9a019d", objects[0].getData());
50: //assertDigestEquals("Wrong data for object 2", "b323604b2003a7299c77c2693b641495", objects[1].getData());
51: } finally {
52: slideShow.close();
53: }
54: }
55: }
|