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 33*424494b0SLi Feng Wang import testlib.gui.AppTool; 34b4d2d410SLiu Zhe import testlib.gui.SCTool; 3589070d26SLiu Zhe 3689070d26SLiu Zhe public class InsertRowAndColumn { 3722a14f28SLiu Zhe 3889070d26SLiu Zhe @Before 3989070d26SLiu Zhe public void setUp() throws Exception { 4089070d26SLiu Zhe app.start(); 41*424494b0SLi Feng Wang AppTool.newSpreadsheet(); 4289070d26SLiu Zhe } 4389070d26SLiu Zhe 4489070d26SLiu Zhe @After 4589070d26SLiu Zhe public void tearDown() throws Exception { 46*424494b0SLi Feng Wang app.stop(); 4789070d26SLiu Zhe } 4889070d26SLiu Zhe 4989070d26SLiu Zhe /** 5089070d26SLiu Zhe * Insert new entire row and column 5122a14f28SLiu Zhe * 5289070d26SLiu Zhe * @throws Exception 5389070d26SLiu Zhe */ 5422a14f28SLiu Zhe 5589070d26SLiu Zhe @Test 5622a14f28SLiu Zhe public void testInsertEntireRowColumn() { 5722a14f28SLiu Zhe 5822a14f28SLiu Zhe // insert data in cell A2 and B2 59b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.A2"); 6089070d26SLiu Zhe typeKeys("123"); 61b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.B2"); 6289070d26SLiu Zhe typeKeys("456"); 6322a14f28SLiu Zhe 6422a14f28SLiu Zhe // Set expected result after executing insert one row 6522a14f28SLiu Zhe String[][] expectedInsertRowResult = new String[][] { { "", "" }, { "", "" }, { "123", "456" }, }; 6622a14f28SLiu Zhe 6722a14f28SLiu Zhe // Select Cell A2 68b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.A2"); 6922a14f28SLiu Zhe 7022a14f28SLiu Zhe // Insert one entire Row via menu 7189070d26SLiu Zhe calc.menuItem("Insert->Rows").select(); 7222a14f28SLiu Zhe 7322a14f28SLiu Zhe // Verify results after inserting one row 74b4d2d410SLiu Zhe assertArrayEquals("Verify results after inserting one row", expectedInsertRowResult, SCTool.getCellTexts("A1:B3")); 7522a14f28SLiu Zhe 7622a14f28SLiu Zhe // Set expected result after executing insert column 7722a14f28SLiu Zhe String[][] expectedInsertColumnResult = new String[][] { { "", "", "" }, { "", "", "" }, { "", "123", "456" }, }; 7822a14f28SLiu Zhe // Select Cell A3 79b4d2d410SLiu Zhe SCTool.selectRange("Sheet1.A3"); 8022a14f28SLiu Zhe // Insert one entire Column via menu 8189070d26SLiu Zhe calc.menuItem("Insert->Columns").select(); 8222a14f28SLiu Zhe 8322a14f28SLiu Zhe // Verify results after inserting one column 84b4d2d410SLiu Zhe assertArrayEquals("Verify results after inserting one column", expectedInsertColumnResult, SCTool.getCellTexts("A1:C3")); 8522a14f28SLiu Zhe 8689070d26SLiu Zhe } 8789070d26SLiu Zhe 8889070d26SLiu Zhe } 89