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 junit.framework.TestCase;
21: import org.apache.poi.hslf.*;
22: import org.apache.poi.hslf.model.*;
23: import org.apache.poi.hslf.usermodel.*;
24: import org.apache.poi.hslf.record.SlideAtom;
25:
26: /**
27: * Tests that changing a slide's idea of what notes sheet is its works right
28: *
29: * @author Nick Burch (nick at torchbox dot com)
30: */
31: public class TestSlideChangeNotes extends TestCase {
32: // SlideShow primed on the test data
33: private SlideShow ss;
34:
35: public TestSlideChangeNotes() throws Exception {
36: String dirname = System.getProperty("HSLF.testdata.path");
37: String filename = dirname + "/basic_test_ppt_file.ppt";
38: HSLFSlideShow hss = new HSLFSlideShow(filename);
39: ss = new SlideShow(hss);
40: }
41:
42: public void testSetToNone() throws Exception {
43: Slide slideOne = ss.getSlides()[0];
44: SlideAtom sa = slideOne.getSlideRecord().getSlideAtom();
45:
46: slideOne.setNotes(null);
47:
48: assertEquals(0, sa.getNotesID());
49: }
50:
51: public void testSetToSomething() throws Exception {
52: Slide slideOne = ss.getSlides()[0];
53: Notes notesOne = ss.getNotes()[1];
54: SlideAtom sa = slideOne.getSlideRecord().getSlideAtom();
55:
56: slideOne.setNotes(notesOne);
57:
58: assertEquals(notesOne._getSheetNumber(), sa.getNotesID());
59: }
60: }
|