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