1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 package fvt.gui.sd.shape;
26 import static org.junit.Assert.*;
27 import static testlib.gui.AppTool.*;
28 import static testlib.gui.UIMap.*;
29 
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Rule;
33 import org.junit.Test;
34 import org.openoffice.test.common.Logger;
35 
36 
37 
38 public class ShapeTypes {
39 	@Rule
40 	public Logger log = Logger.getLogger(this);
41 
42 	@Before
43 	public void setUp() throws Exception {
44 		app.start();
45 
46 		// New a impress, insert some slides
47 		app.dispatch("private:factory/simpress?slot=6686");
48 		presentationWizard.ok();
49 		// Pop up navigator panel
50 		if (!sdNavigatorDlg.exists()) {
51 			app.dispatch(".uno:Navigator");
52 		}
53 
54 		if(!sdDrawingToolbar.exists()){
55 			app.dispatch(".uno:AvailableToolbars?Toolbar:string=toolbar");
56 		}
57 	}
58 
59 	@After
60 	public void tearDown() throws Exception {
61 		app.close();
62 	}
63 
64 	/**
65 	 * Insert a new CallOut shape
66 	 * @throws Exception
67 	 */
68 	@Test
69 	public void testCalloutShapes() throws Exception{
70 
71 		impress.focus();
72 		//---before insert CallOut Shape
73 		sdNavigator.focus();
74 		sdNavigatorShapeFilter.click();
75 		typeKeys("<down><down>");
76 		typeKeys("<enter>");
77 		sdNavigator.select(0);
78 		typeKeys("<enter>");
79 		String[] allShapes=sdNavigator.getAllItemsText();
80 		assertEquals(3, allShapes.length);
81 
82 		//--- After insert CallOut shape
83 		sdCalloutShapes.click();
84 		impress.focus();
85 		impress.drag(100, 100, 200, 200);
86 		sdNavigatorDlg.focus();
87 		sdNavigatorShapeFilter.click();
88 		typeKeys("<down><down>");
89 		typeKeys("<enter>");
90 		sdNavigator.focus();
91 		sdNavigator.select(0);
92 		typeKeys("<enter>");
93 		allShapes=sdNavigator.getAllItemsText();
94 		assertEquals(4, allShapes.length);
95 
96 	}
97 	/**
98 	 * Insert a new Star shape
99 	 * @throws Exception
100 	 */
101 	@Test
102 	public void testStarsShapes() throws Exception{
103 
104 		impress.focus();
105 		//---before insert CallOut Shape
106 		sdNavigator.focus();
107 		sdNavigatorShapeFilter.click();
108 		typeKeys("<down><down>");
109 		typeKeys("<enter>");
110 		sdNavigator.select(0);
111 		typeKeys("<enter>");
112 		String[] allShapes=sdNavigator.getAllItemsText();
113 		assertEquals(3, allShapes.length);
114 
115 		//--- After insert CallOut shape
116 		sdStarShapes.click();
117 		impress.focus();
118 		impress.drag(100, 100, 200, 200);
119 		sdNavigatorDlg.focus();
120 		sdNavigatorShapeFilter.click();
121 		typeKeys("<down><down>");
122 		typeKeys("<enter>");
123 		sdNavigator.focus();
124 		sdNavigator.select(0);
125 		typeKeys("<enter>");
126 		allShapes=sdNavigator.getAllItemsText();
127 		assertEquals(4, allShapes.length);
128 
129 	}
130 
131 }
132 
133