001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017: package org.apache.poi.hslf.model;
018:
019: import junit.framework.*;
020:
021: import java.io.FileOutputStream;
022: import java.awt.*;
023:
024: import org.apache.poi.hslf.usermodel.SlideShow;
025: import org.apache.poi.hslf.HSLFSlideShow;
026:
027: /**
028: * Test Line shape.
029: *
030: * @author Yegor Kozlov
031: */
032: public class TestLine extends TestCase {
033:
034: public void setUp() throws Exception {
035:
036: }
037:
038: public void testCreateLines() throws Exception {
039: SlideShow ppt = new SlideShow();
040:
041: Slide slide = ppt.createSlide();
042:
043: slide.addTitle().setText("Lines tester");
044:
045: Line line;
046:
047: /**
048: * line styles
049: */
050: line = new Line();
051: line.setAnchor(new java.awt.Rectangle(75, 200, 300, 0));
052: line.setLineStyle(Line.LINE_SIMPLE);
053: line.setLineColor(Color.blue);
054: slide.addShape(line);
055:
056: line = new Line();
057: line.setAnchor(new java.awt.Rectangle(75, 230, 300, 0));
058: line.setLineStyle(Line.LINE_DOUBLE);
059: line.setLineWidth(3.5);
060: slide.addShape(line);
061:
062: line = new Line();
063: line.setAnchor(new java.awt.Rectangle(75, 260, 300, 0));
064: line.setLineStyle(Line.LINE_TRIPLE);
065: line.setLineWidth(6);
066: slide.addShape(line);
067:
068: line = new Line();
069: line.setAnchor(new java.awt.Rectangle(75, 290, 300, 0));
070: line.setLineStyle(Line.LINE_THICKTHIN);
071: line.setLineWidth(4.5);
072: slide.addShape(line);
073:
074: line = new Line();
075: line.setAnchor(new java.awt.Rectangle(75, 320, 300, 0));
076: line.setLineStyle(Line.LINE_THINTHICK);
077: line.setLineWidth(5.5);
078: slide.addShape(line);
079:
080: /**
081: * line dashing
082: */
083: line = new Line();
084: line.setAnchor(new java.awt.Rectangle(450, 200, 300, 0));
085: line.setLineDashing(Line.PEN_SOLID);
086: slide.addShape(line);
087:
088: line = new Line();
089: line.setAnchor(new java.awt.Rectangle(450, 230, 300, 0));
090: line.setLineDashing(Line.PEN_PS_DASH);
091: slide.addShape(line);
092:
093: line = new Line();
094: line.setAnchor(new java.awt.Rectangle(450, 260, 300, 0));
095: line.setLineDashing(Line.PEN_DOT);
096: slide.addShape(line);
097:
098: line = new Line();
099: line.setAnchor(new java.awt.Rectangle(450, 290, 300, 0));
100: line.setLineDashing(Line.PEN_DOTGEL);
101: slide.addShape(line);
102:
103: line = new Line();
104: line.setAnchor(new java.awt.Rectangle(450, 320, 300, 0));
105: line.setLineDashing(Line.PEN_LONGDASHDOTDOTGEL);
106: slide.addShape(line);
107:
108: /**
109: * Combinations
110: */
111: line = new Line();
112: line.setAnchor(new java.awt.Rectangle(75, 400, 300, 0));
113: line.setLineDashing(Line.PEN_DASHDOT);
114: line.setLineStyle(Line.LINE_TRIPLE);
115: line.setLineWidth(5.0);
116: slide.addShape(line);
117:
118: line = new Line();
119: line.setAnchor(new java.awt.Rectangle(75, 430, 300, 0));
120: line.setLineDashing(Line.PEN_DASH);
121: line.setLineStyle(Line.LINE_THICKTHIN);
122: line.setLineWidth(4.0);
123: slide.addShape(line);
124:
125: line = new Line();
126: line.setAnchor(new java.awt.Rectangle(75, 460, 300, 0));
127: line.setLineDashing(Line.PEN_DOT);
128: line.setLineStyle(Line.LINE_DOUBLE);
129: line.setLineWidth(8.0);
130: slide.addShape(line);
131:
132: }
133:
134: }
|