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 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 62 public void tearDown() throws Exception { 63 sleep(3); 64 //close navigator 65 if (sdNavigatorDlg.exists()) { 66 app.dispatch(".uno:Navigator"); 67 } 68 app.stop(); 69 } 70 71 /** 72 * Insert a new CallOut shape 73 * @throws Exception 74 */ 75 @Test 76 public void testCalloutShapes() throws Exception{ 77 78 impress.focus(); 79 //before insert CallOut Shape 80 sdNavigator.focus(); 81 sdNavigatorShapeFilter.click(); 82 typeKeys("<down><down>"); 83 typeKeys("<enter>"); 84 sdNavigator.select(0); 85 typeKeys("<enter>"); 86 String[] allShapes=sdNavigator.getAllItemsText(); 87 assertEquals(3, allShapes.length); 88 89 //After insert CallOut shape 90 sdCalloutShapes.click(); 91 impress.focus(); 92 impress.drag(100, 100, 200, 200); 93 sdNavigatorDlg.focus(); 94 sdNavigatorShapeFilter.click(); 95 typeKeys("<down><down>"); 96 typeKeys("<enter>"); 97 sdNavigator.focus(); 98 sdNavigator.select(0); 99 typeKeys("<enter>"); 100 allShapes=sdNavigator.getAllItemsText(); 101 assertEquals(4, allShapes.length); 102 103 104 } 105 /** 106 * Insert a new Star shape 107 * @throws Exception 108 */ 109 @Test 110 public void testStarsShapes() throws Exception{ 111 112 impress.focus(); 113 //before insert CallOut Shape 114 sdNavigator.focus(); 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 sdNavigatorShapeFilter.click(); 129 typeKeys("<down><down>"); 130 typeKeys("<enter>"); 131 sdNavigator.focus(); 132 sdNavigator.select(0); 133 typeKeys("<enter>"); 134 allShapes=sdNavigator.getAllItemsText(); 135 assertEquals(4, allShapes.length); 136 137 } 138 139 } 140 141