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 org.openoffice.test.vcl.Tester.sleep; 28 import static testlib.gui.AppTool.*; 29 import static testlib.gui.UIMap.*; 30 31 import org.junit.After; 32 import org.junit.Before; 33 import org.junit.Rule; 34 import org.junit.Test; 35 import org.openoffice.test.common.Logger; 36 37 import testlib.gui.AppTool; 38 39 40 41 public class ShapeTypes { 42 43 @Rule 44 public Logger log = Logger.getLogger(this); 45 46 @Before setUp()47 public void setUp() throws Exception { 48 app.start(); 49 AppTool.newPresentation(); 50 51 // Pop up navigator panel 52 if (!sdNavigatorDlg.exists()) { 53 app.dispatch(".uno:Navigator"); 54 } 55 //Pop up drawing toolbar 56 if(!sdDrawingToolbar.exists()){ 57 app.dispatch(".uno:AvailableToolbars?Toolbar:string=toolbar"); 58 } 59 } 60 61 @After tearDown()62 public void tearDown() throws Exception { 63 //close navigator 64 if (sdNavigatorDlg.exists()) { 65 app.dispatch(".uno:Navigator"); 66 } 67 AppTool.discard(); 68 app.stop(); 69 } 70 71 /** 72 * Insert a new CallOut shape 73 * @throws Exception 74 */ 75 @Test testCalloutShapes()76 public void testCalloutShapes() throws Exception{ 77 78 impress.focus(); 79 //before insert CallOut Shape 80 sdNavigator.focus(); 81 sdNavigator.waitForEnabled( 2.0, 0.1); 82 sdNavigatorShapeFilter.click(); 83 typeKeys("<down><down>"); 84 typeKeys("<enter>"); 85 sdNavigator.select(0); 86 typeKeys("<enter>"); 87 String[] allShapes=sdNavigator.getAllItemsText(); 88 assertEquals(3, allShapes.length); 89 90 //After insert CallOut shape 91 sdCalloutShapes.click(); 92 impress.focus(); 93 impress.drag(100, 100, 200, 200); 94 sdNavigatorDlg.focus(); 95 sdNavigator.waitForEnabled( 2.0, 0.1); 96 sdNavigatorShapeFilter.click(); 97 typeKeys("<down><down>"); 98 typeKeys("<enter>"); 99 sdNavigator.focus(); 100 allShapes=sdNavigator.getAllItemsText(); 101 assertEquals(4, allShapes.length); 102 } 103 104 /** 105 * Insert a new Star shape 106 * @throws Exception 107 */ 108 @Test testStarsShapes()109 public void testStarsShapes() throws Exception{ 110 111 impress.focus(); 112 //before insert CallOut Shape 113 sdNavigator.focus(); 114 sdNavigator.waitForEnabled( 2.0, 0.1); 115 sdNavigatorShapeFilter.click(); 116 typeKeys("<down><down>"); 117 typeKeys("<enter>"); 118 sdNavigator.select(0); 119 typeKeys("<enter>"); 120 String[] allShapes=sdNavigator.getAllItemsText(); 121 assertEquals(3, allShapes.length); 122 123 //After insert CallOut shape 124 sdStarShapes.click(); 125 impress.focus(); 126 impress.drag(100, 100, 200, 200); 127 sdNavigatorDlg.focus(); 128 sdNavigator.waitForEnabled( 2.0, 0.1); 129 sdNavigatorShapeFilter.click(); 130 typeKeys("<down><down>"); 131 typeKeys("<enter>"); 132 sdNavigator.focus(); 133 allShapes=sdNavigator.getAllItemsText(); 134 assertEquals(4, allShapes.length); 135 } 136 137 } 138 139