15691bed9SLiu Zhe /**************************************************************
25691bed9SLiu Zhe  *
35691bed9SLiu Zhe  * Licensed to the Apache Software Foundation (ASF) under one
45691bed9SLiu Zhe  * or more contributor license agreements.  See the NOTICE file
55691bed9SLiu Zhe  * distributed with this work for additional information
65691bed9SLiu Zhe  * regarding copyright ownership.  The ASF licenses this file
75691bed9SLiu Zhe  * to you under the Apache License, Version 2.0 (the
85691bed9SLiu Zhe  * "License"); you may not use this file except in compliance
95691bed9SLiu Zhe  * with the License.  You may obtain a copy of the License at
105691bed9SLiu Zhe  *
115691bed9SLiu Zhe  *   http://www.apache.org/licenses/LICENSE-2.0
125691bed9SLiu Zhe  *
135691bed9SLiu Zhe  * Unless required by applicable law or agreed to in writing,
145691bed9SLiu Zhe  * software distributed under the License is distributed on an
155691bed9SLiu Zhe  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165691bed9SLiu Zhe  * KIND, either express or implied.  See the License for the
175691bed9SLiu Zhe  * specific language governing permissions and limitations
185691bed9SLiu Zhe  * under the License.
195691bed9SLiu Zhe  *
205691bed9SLiu Zhe  *************************************************************/
215691bed9SLiu Zhe 
225691bed9SLiu Zhe 
235691bed9SLiu Zhe 
245691bed9SLiu Zhe 
2580a6f5c5SLiu Zhe package fvt.gui.sd.shape;
265691bed9SLiu Zhe import static org.junit.Assert.*;
2770375b46SLi Feng Wang import static org.openoffice.test.vcl.Tester.sleep;
28b4d2d410SLiu Zhe import static testlib.gui.AppTool.*;
295691bed9SLiu Zhe import static testlib.gui.UIMap.*;
305691bed9SLiu Zhe 
315691bed9SLiu Zhe import org.junit.After;
325691bed9SLiu Zhe import org.junit.Before;
335691bed9SLiu Zhe import org.junit.Rule;
345691bed9SLiu Zhe import org.junit.Test;
355691bed9SLiu Zhe import org.openoffice.test.common.Logger;
365691bed9SLiu Zhe 
37c37bcbf4SLi Feng Wang import testlib.gui.AppTool;
38c37bcbf4SLi Feng Wang 
395691bed9SLiu Zhe 
405691bed9SLiu Zhe 
415691bed9SLiu Zhe public class ShapeTypes {
425691bed9SLiu Zhe 
43fd348426SLi Feng Wang 	@Rule
44fd348426SLi Feng Wang 	public Logger log = Logger.getLogger(this);
45fd348426SLi Feng Wang 
465691bed9SLiu Zhe 	@Before
setUp()475691bed9SLiu Zhe 	public void setUp() throws Exception {
485691bed9SLiu Zhe 		app.start();
49c37bcbf4SLi Feng Wang 		AppTool.newPresentation();
505691bed9SLiu Zhe 
515691bed9SLiu Zhe 		// Pop up navigator panel
52b4d2d410SLiu Zhe 		if (!sdNavigatorDlg.exists()) {
535691bed9SLiu Zhe 			app.dispatch(".uno:Navigator");
545691bed9SLiu Zhe 		}
55c37bcbf4SLi Feng Wang 		//Pop up drawing toolbar
56b4d2d410SLiu Zhe 		if(!sdDrawingToolbar.exists()){
575691bed9SLiu Zhe 			app.dispatch(".uno:AvailableToolbars?Toolbar:string=toolbar");
585691bed9SLiu Zhe 		}
595691bed9SLiu Zhe 	}
605691bed9SLiu Zhe 
615691bed9SLiu Zhe 	@After
tearDown()625691bed9SLiu Zhe 	public void tearDown() throws Exception {
63c37bcbf4SLi Feng Wang 		//close navigator
6496ee427fSLi Feng Wang 		if (sdNavigatorDlg.exists()) {
651ff8e3a9SLi Feng Wang 			app.dispatch(".uno:Navigator");
6696ee427fSLi Feng Wang 		}
67*05d85903SHerbert Dürr 		AppTool.discard();
684a13b48eSLi Feng Wang 		app.stop();
695691bed9SLiu Zhe 	}
705691bed9SLiu Zhe 
715691bed9SLiu Zhe 	/**
725691bed9SLiu Zhe 	 * Insert a new CallOut shape
735691bed9SLiu Zhe 	 * @throws Exception
745691bed9SLiu Zhe 	 */
755691bed9SLiu Zhe 	@Test
testCalloutShapes()765691bed9SLiu Zhe 	public void testCalloutShapes() throws Exception{
775691bed9SLiu Zhe 
785691bed9SLiu Zhe 		impress.focus();
79c37bcbf4SLi Feng Wang 		//before insert CallOut Shape
80b4d2d410SLiu Zhe 		sdNavigator.focus();
81afc57781SHerbert Dürr 		sdNavigator.waitForEnabled( 2.0, 0.1);
82b4d2d410SLiu Zhe 		sdNavigatorShapeFilter.click();
835691bed9SLiu Zhe 		typeKeys("<down><down>");
845691bed9SLiu Zhe 		typeKeys("<enter>");
85b4d2d410SLiu Zhe 		sdNavigator.select(0);
865691bed9SLiu Zhe 		typeKeys("<enter>");
87b4d2d410SLiu Zhe 		String[] allShapes=sdNavigator.getAllItemsText();
885691bed9SLiu Zhe 		assertEquals(3, allShapes.length);
895691bed9SLiu Zhe 
90c37bcbf4SLi Feng Wang 		//After insert CallOut shape
91b4d2d410SLiu Zhe 		sdCalloutShapes.click();
925691bed9SLiu Zhe 		impress.focus();
935691bed9SLiu Zhe 		impress.drag(100, 100, 200, 200);
94b4d2d410SLiu Zhe 		sdNavigatorDlg.focus();
95afc57781SHerbert Dürr 		sdNavigator.waitForEnabled( 2.0, 0.1);
96b4d2d410SLiu Zhe 		sdNavigatorShapeFilter.click();
975691bed9SLiu Zhe 		typeKeys("<down><down>");
985691bed9SLiu Zhe 		typeKeys("<enter>");
99b4d2d410SLiu Zhe 		sdNavigator.focus();
100b4d2d410SLiu Zhe 		allShapes=sdNavigator.getAllItemsText();
1015691bed9SLiu Zhe 		assertEquals(4, allShapes.length);
1025691bed9SLiu Zhe 	}
103*05d85903SHerbert Dürr 
1045691bed9SLiu Zhe 	/**
1055691bed9SLiu Zhe 	 * Insert a new Star shape
1065691bed9SLiu Zhe 	 * @throws Exception
1075691bed9SLiu Zhe 	 */
1085691bed9SLiu Zhe 	@Test
testStarsShapes()1095691bed9SLiu Zhe 	public void testStarsShapes() throws Exception{
1105691bed9SLiu Zhe 
1115691bed9SLiu Zhe 		impress.focus();
112c37bcbf4SLi Feng Wang 		//before insert CallOut Shape
113b4d2d410SLiu Zhe 		sdNavigator.focus();
114afc57781SHerbert Dürr 		sdNavigator.waitForEnabled( 2.0, 0.1);
115b4d2d410SLiu Zhe 		sdNavigatorShapeFilter.click();
1165691bed9SLiu Zhe 		typeKeys("<down><down>");
1175691bed9SLiu Zhe 		typeKeys("<enter>");
118b4d2d410SLiu Zhe 		sdNavigator.select(0);
1195691bed9SLiu Zhe 		typeKeys("<enter>");
120b4d2d410SLiu Zhe 		String[] allShapes=sdNavigator.getAllItemsText();
1215691bed9SLiu Zhe 		assertEquals(3, allShapes.length);
1225691bed9SLiu Zhe 
123c37bcbf4SLi Feng Wang 		//After insert CallOut shape
124b4d2d410SLiu Zhe 		sdStarShapes.click();
1255691bed9SLiu Zhe 		impress.focus();
1265691bed9SLiu Zhe 		impress.drag(100, 100, 200, 200);
127b4d2d410SLiu Zhe 		sdNavigatorDlg.focus();
128afc57781SHerbert Dürr 		sdNavigator.waitForEnabled( 2.0, 0.1);
129b4d2d410SLiu Zhe 		sdNavigatorShapeFilter.click();
1305691bed9SLiu Zhe 		typeKeys("<down><down>");
1315691bed9SLiu Zhe 		typeKeys("<enter>");
132b4d2d410SLiu Zhe 		sdNavigator.focus();
133b4d2d410SLiu Zhe 		allShapes=sdNavigator.getAllItemsText();
1345691bed9SLiu Zhe 		assertEquals(4, allShapes.length);
1355691bed9SLiu Zhe 	}
1365691bed9SLiu Zhe 
1375691bed9SLiu Zhe }
1385691bed9SLiu Zhe 
139