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.usermodel;
19:
20: import junit.framework.TestCase;
21: import org.apache.poi.hslf.*;
22: import org.apache.poi.hslf.model.*;
23:
24: /**
25: * Tests that SlideShow returns MetaSheets which have the right text in them
26: *
27: * @author Nick Burch (nick at torchbox dot com)
28: */
29: public class TestNotesText extends TestCase {
30: // SlideShow primed on the test data
31: private SlideShow ss;
32:
33: public TestNotesText() throws Exception {
34: String dirname = System.getProperty("HSLF.testdata.path");
35: String filename = dirname + "/basic_test_ppt_file.ppt";
36: HSLFSlideShow hss = new HSLFSlideShow(filename);
37: ss = new SlideShow(hss);
38: }
39:
40: public void testNotesOne() throws Exception {
41: Notes notes = ss.getNotes()[0];
42:
43: String[] expectText = new String[] { "These are the notes for page 1" };
44: assertEquals(expectText.length, notes.getTextRuns().length);
45: for (int i = 0; i < expectText.length; i++) {
46: assertEquals(expectText[i], notes.getTextRuns()[i]
47: .getText());
48: }
49: }
50:
51: public void testNotesTwo() throws Exception {
52: Notes notes = ss.getNotes()[1];
53: String[] expectText = new String[] { "These are the notes on page two, again lacking formatting" };
54: assertEquals(expectText.length, notes.getTextRuns().length);
55: for (int i = 0; i < expectText.length; i++) {
56: assertEquals(expectText[i], notes.getTextRuns()[i]
57: .getText());
58: }
59: }
60: }
|