189070d26SLiu Zhe /************************************************************** 289070d26SLiu Zhe * 389070d26SLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 489070d26SLiu Zhe * or more contributor license agreements. See the NOTICE file 589070d26SLiu Zhe * distributed with this work for additional information 689070d26SLiu Zhe * regarding copyright ownership. The ASF licenses this file 789070d26SLiu Zhe * to you under the Apache License, Version 2.0 (the 889070d26SLiu Zhe * "License"); you may not use this file except in compliance 989070d26SLiu Zhe * with the License. You may obtain a copy of the License at 1089070d26SLiu Zhe * 1189070d26SLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 1289070d26SLiu Zhe * 1389070d26SLiu Zhe * Unless required by applicable law or agreed to in writing, 1489070d26SLiu Zhe * software distributed under the License is distributed on an 1589070d26SLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1689070d26SLiu Zhe * KIND, either express or implied. See the License for the 1789070d26SLiu Zhe * specific language governing permissions and limitations 1889070d26SLiu Zhe * under the License. 1989070d26SLiu Zhe * 2089070d26SLiu Zhe *************************************************************/ 2180a6f5c5SLiu Zhe package fvt.gui.sc.rowcolumn; 2289070d26SLiu Zhe 2389070d26SLiu Zhe import static org.junit.Assert.*; 24b4d2d410SLiu Zhe import static testlib.gui.AppTool.*; 2589070d26SLiu Zhe import static testlib.gui.UIMap.*; 2689070d26SLiu Zhe 2789070d26SLiu Zhe import org.junit.After; 2889070d26SLiu Zhe import org.junit.Before; 2989070d26SLiu Zhe import org.junit.Rule; 3089070d26SLiu Zhe import org.junit.Test; 3122a14f28SLiu Zhe import org.openoffice.test.common.Logger; 3289070d26SLiu Zhe 33424494b0SLi Feng Wang import testlib.gui.AppTool; 34b4d2d410SLiu Zhe import testlib.gui.SCTool; 3589070d26SLiu Zhe 3689070d26SLiu Zhe public class InsertRowAndColumn { 37*fd348426SLi Feng Wang @Rule 38*fd348426SLi Feng Wang public Logger log = Logger.getLogger(this); 3922a14f28SLiu Zhe 4089070d26SLiu Zhe @Before setUp()4189070d26SLiu Zhe public void setUp() throws Exception { 4289070d26SLiu Zhe app.start(); 43424494b0SLi Feng Wang AppTool.newSpreadsheet(); 4489070d26SLiu Zhe } 4589070d26SLiu Zhe 4689070d26SLiu Zhe @After tearDown()4789070d26SLiu Zhe public void tearDown() throws Exception { 48424494b0SLi Feng Wang app.stop(); 4989070d26SLiu Zhe } 5089070d26SLiu Zhe 5189070d26SLiu Zhe /** 5289070d26SLiu Zhe * Insert new entire row and column 5322a14f28SLiu Zhe * 5489070d26SLiu Zhe * @throws Exception 5589070d26SLiu Zhe */ 5622a14f28SLiu Zhe 5789070d26SLiu Zhe @Test testInsertEntireRowColumn()5822a14f28SLiu Zhe public void testInsertEntireRowColumn() { 5922a14f28SLiu Zhe 6022a14f28SLiu Zhe // insert data in cell A2 and B2 61b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.A2"); 6289070d26SLiu Zhe typeKeys("123"); 63b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.B2"); 6489070d26SLiu Zhe typeKeys("456"); 6522a14f28SLiu Zhe 6622a14f28SLiu Zhe // Set expected result after executing insert one row 6722a14f28SLiu Zhe String[][] expectedInsertRowResult = new String[][] { { "", "" }, { "", "" }, { "123", "456" }, }; 6822a14f28SLiu Zhe 6922a14f28SLiu Zhe // Select Cell A2 70b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.A2"); 7122a14f28SLiu Zhe 7222a14f28SLiu Zhe // Insert one entire Row via menu 7389070d26SLiu Zhe calc.menuItem("Insert->Rows").select(); 7422a14f28SLiu Zhe 7522a14f28SLiu Zhe // Verify results after inserting one row 76b4d2d410SLiu Zhe assertArrayEquals("Verify results after inserting one row", expectedInsertRowResult, SCTool.getCellTexts("A1:B3")); 7722a14f28SLiu Zhe 7822a14f28SLiu Zhe // Set expected result after executing insert column 7922a14f28SLiu Zhe String[][] expectedInsertColumnResult = new String[][] { { "", "", "" }, { "", "", "" }, { "", "123", "456" }, }; 8022a14f28SLiu Zhe // Select Cell A3 81b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.A3"); 8222a14f28SLiu Zhe // Insert one entire Column via menu 8389070d26SLiu Zhe calc.menuItem("Insert->Columns").select(); 8422a14f28SLiu Zhe 8522a14f28SLiu Zhe // Verify results after inserting one column 86b4d2d410SLiu Zhe assertArrayEquals("Verify results after inserting one column", expectedInsertColumnResult, SCTool.getCellTexts("A1:C3")); 8722a14f28SLiu Zhe 8889070d26SLiu Zhe } 8989070d26SLiu Zhe 9089070d26SLiu Zhe } 91