xref: /AOO41X/test/testgui/source/fvt/gui/sc/rowcolumn/InsertRowAndColumn.java (revision fd3484265709667881cfaec27d41da15d46b6832)
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 package fvt.gui.sc.rowcolumn;
22 
23 import static org.junit.Assert.*;
24 import static testlib.gui.AppTool.*;
25 import static testlib.gui.UIMap.*;
26 
27 import org.junit.After;
28 import org.junit.Before;
29 import org.junit.Rule;
30 import org.junit.Test;
31 import org.openoffice.test.common.Logger;
32 
33 import testlib.gui.AppTool;
34 import testlib.gui.SCTool;
35 
36 public class InsertRowAndColumn {
37     @Rule
38     public Logger log = Logger.getLogger(this);
39 
40     @Before
setUp()41     public void setUp() throws Exception {
42         app.start();
43         AppTool.newSpreadsheet();
44     }
45 
46     @After
tearDown()47     public void tearDown() throws Exception {
48         app.stop();
49     }
50 
51     /**
52      * Insert new entire row and column
53      *
54      * @throws Exception
55      */
56 
57     @Test
testInsertEntireRowColumn()58     public void testInsertEntireRowColumn() {
59 
60         // insert data in cell A2 and B2
61         SCTool.selectRange("Sheet1.A2");
62         typeKeys("123");
63         SCTool.selectRange("Sheet1.B2");
64         typeKeys("456");
65 
66         // Set expected result after executing insert one row
67         String[][] expectedInsertRowResult = new String[][] { { "", "" }, { "", "" }, { "123", "456" }, };
68 
69         // Select Cell A2
70         SCTool.selectRange("Sheet1.A2");
71 
72         // Insert one entire Row via menu
73         calc.menuItem("Insert->Rows").select();
74 
75         // Verify results after inserting one row
76         assertArrayEquals("Verify results after inserting one row", expectedInsertRowResult, SCTool.getCellTexts("A1:B3"));
77 
78         // Set expected result after executing insert column
79         String[][] expectedInsertColumnResult = new String[][] { { "", "", "" }, { "", "", "" }, { "", "123", "456" }, };
80         // Select Cell A3
81         SCTool.selectRange("Sheet1.A3");
82         // Insert one entire Column via menu
83         calc.menuItem("Insert->Columns").select();
84 
85         // Verify results after inserting one column
86         assertArrayEquals("Verify results after inserting one column", expectedInsertColumnResult, SCTool.getCellTexts("A1:C3"));
87 
88     }
89 
90 }
91