Source Code Cross Referenced for TestSheetText.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hslf » usermodel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hslf.usermodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 Sheets which have the right text in them
26:         *
27:         * @author Nick Burch (nick at torchbox dot com)
28:         */
29:        public class TestSheetText extends TestCase {
30:            // SlideShow primed on the test data
31:            private SlideShow ss;
32:
33:            public TestSheetText() 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 testSheetOne() throws Exception {
41:                Sheet slideOne = ss.getSlides()[0];
42:
43:                String[] expectText = new String[] { "This is a test title",
44:                        "This is a test subtitle\nThis is on page 1" };
45:                assertEquals(expectText.length, slideOne.getTextRuns().length);
46:                for (int i = 0; i < expectText.length; i++) {
47:                    assertEquals(expectText[i], slideOne.getTextRuns()[i]
48:                            .getText());
49:                }
50:            }
51:
52:            public void testSheetTwo() throws Exception {
53:                Sheet slideTwo = ss.getSlides()[1];
54:                String[] expectText = new String[] {
55:                        "This is the title on page 2",
56:                        "This is page two\nIt has several blocks of text\nNone of them have formatting" };
57:                assertEquals(expectText.length, slideTwo.getTextRuns().length);
58:                for (int i = 0; i < expectText.length; i++) {
59:                    assertEquals(expectText[i], slideTwo.getTextRuns()[i]
60:                            .getText());
61:                }
62:            }
63:
64:            /**
65:             * Check we can still get the text from a file where the
66:             *  TextProps don't have enough data.
67:             * (Make sure we don't screw up / throw an exception etc)
68:             */
69:            public void testWithShortTextPropData() throws Exception {
70:                String dirname = System.getProperty("HSLF.testdata.path");
71:                String filename = dirname + "/iisd_report.ppt";
72:                HSLFSlideShow hss = new HSLFSlideShow(filename);
73:                SlideShow sss = new SlideShow(hss);
74:
75:                // Should come out with 10 slides, no notes
76:                assertEquals(10, sss.getSlides().length);
77:                assertEquals(0, sss.getNotes().length);
78:
79:                // Check text on first slide
80:                Slide s = sss.getSlides()[0];
81:                String exp = "Realizing the Development Dividend:\n"
82:                        + "Community Capacity Building and CDM.\n"
83:                        + "Can they co-exist?\n\n" + "Gay Harley\n"
84:                        + "Clean Development Alliance\n"
85:                        + "COP 11 \u2013 MOP 1\n" + // special long hyphon
86:                        "December 5, 2005\n";
87:
88:                assertEquals(1, s.getTextRuns().length);
89:                assertEquals(exp, s.getTextRuns()[0].getText());
90:            }
91:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.