180a6f5c5SLiu Zhe /************************************************************** 280a6f5c5SLiu Zhe * 380a6f5c5SLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 480a6f5c5SLiu Zhe * or more contributor license agreements. See the NOTICE file 580a6f5c5SLiu Zhe * distributed with this work for additional information 680a6f5c5SLiu Zhe * regarding copyright ownership. The ASF licenses this file 780a6f5c5SLiu Zhe * to you under the Apache License, Version 2.0 (the 880a6f5c5SLiu Zhe * "License"); you may not use this file except in compliance 980a6f5c5SLiu Zhe * with the License. You may obtain a copy of the License at 1080a6f5c5SLiu Zhe * 1180a6f5c5SLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 1280a6f5c5SLiu Zhe * 1380a6f5c5SLiu Zhe * Unless required by applicable law or agreed to in writing, 1480a6f5c5SLiu Zhe * software distributed under the License is distributed on an 1580a6f5c5SLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1680a6f5c5SLiu Zhe * KIND, either express or implied. See the License for the 1780a6f5c5SLiu Zhe * specific language governing permissions and limitations 1880a6f5c5SLiu Zhe * under the License. 1980a6f5c5SLiu Zhe * 2080a6f5c5SLiu Zhe *************************************************************/ 2180a6f5c5SLiu Zhe package fvt.gui.sc.rowcolumn; 2280a6f5c5SLiu Zhe 2380a6f5c5SLiu Zhe import static org.junit.Assert.*; 2480a6f5c5SLiu Zhe import static testlib.gui.AppTool.*; 2580a6f5c5SLiu Zhe import static testlib.gui.UIMap.*; 2680a6f5c5SLiu Zhe 2780a6f5c5SLiu Zhe import org.junit.After; 2880a6f5c5SLiu Zhe import org.junit.Before; 2980a6f5c5SLiu Zhe import org.junit.Rule; 3080a6f5c5SLiu Zhe import org.junit.Test; 3180a6f5c5SLiu Zhe import org.openoffice.test.common.Logger; 3280a6f5c5SLiu Zhe 33424494b0SLi Feng Wang import testlib.gui.AppTool; 3480a6f5c5SLiu Zhe import testlib.gui.SCTool; 3580a6f5c5SLiu Zhe 3680a6f5c5SLiu Zhe public class InsertRowAndColumn { 37*fd348426SLi Feng Wang @Rule 38*fd348426SLi Feng Wang public Logger log = Logger.getLogger(this); 3980a6f5c5SLiu Zhe 4080a6f5c5SLiu Zhe @Before setUp()4180a6f5c5SLiu Zhe public void setUp() throws Exception { 4280a6f5c5SLiu Zhe app.start(); 43424494b0SLi Feng Wang AppTool.newSpreadsheet(); 4480a6f5c5SLiu Zhe } 4580a6f5c5SLiu Zhe 4680a6f5c5SLiu Zhe @After tearDown()4780a6f5c5SLiu Zhe public void tearDown() throws Exception { 48424494b0SLi Feng Wang app.stop(); 4980a6f5c5SLiu Zhe } 5080a6f5c5SLiu Zhe 5180a6f5c5SLiu Zhe /** 5280a6f5c5SLiu Zhe * Insert new entire row and column 5380a6f5c5SLiu Zhe * 5480a6f5c5SLiu Zhe * @throws Exception 5580a6f5c5SLiu Zhe */ 5680a6f5c5SLiu Zhe 5780a6f5c5SLiu Zhe @Test testInsertEntireRowColumn()5880a6f5c5SLiu Zhe public void testInsertEntireRowColumn() { 5980a6f5c5SLiu Zhe 6080a6f5c5SLiu Zhe // insert data in cell A2 and B2 6180a6f5c5SLiu Zhe SCTool.selectRange("Sheet1.A2"); 6280a6f5c5SLiu Zhe typeKeys("123"); 6380a6f5c5SLiu Zhe SCTool.selectRange("Sheet1.B2"); 6480a6f5c5SLiu Zhe typeKeys("456"); 6580a6f5c5SLiu Zhe 6680a6f5c5SLiu Zhe // Set expected result after executing insert one row 6780a6f5c5SLiu Zhe String[][] expectedInsertRowResult = new String[][] { { "", "" }, { "", "" }, { "123", "456" }, }; 6880a6f5c5SLiu Zhe 6980a6f5c5SLiu Zhe // Select Cell A2 7080a6f5c5SLiu Zhe SCTool.selectRange("Sheet1.A2"); 7180a6f5c5SLiu Zhe 7280a6f5c5SLiu Zhe // Insert one entire Row via menu 7380a6f5c5SLiu Zhe calc.menuItem("Insert->Rows").select(); 7480a6f5c5SLiu Zhe 7580a6f5c5SLiu Zhe // Verify results after inserting one row 7680a6f5c5SLiu Zhe assertArrayEquals("Verify results after inserting one row", expectedInsertRowResult, SCTool.getCellTexts("A1:B3")); 7780a6f5c5SLiu Zhe 7880a6f5c5SLiu Zhe // Set expected result after executing insert column 7980a6f5c5SLiu Zhe String[][] expectedInsertColumnResult = new String[][] { { "", "", "" }, { "", "", "" }, { "", "123", "456" }, }; 8080a6f5c5SLiu Zhe // Select Cell A3 8180a6f5c5SLiu Zhe SCTool.selectRange("Sheet1.A3"); 8280a6f5c5SLiu Zhe // Insert one entire Column via menu 8380a6f5c5SLiu Zhe calc.menuItem("Insert->Columns").select(); 8480a6f5c5SLiu Zhe 8580a6f5c5SLiu Zhe // Verify results after inserting one column 8680a6f5c5SLiu Zhe assertArrayEquals("Verify results after inserting one column", expectedInsertColumnResult, SCTool.getCellTexts("A1:C3")); 8780a6f5c5SLiu Zhe 8880a6f5c5SLiu Zhe } 8980a6f5c5SLiu Zhe 9080a6f5c5SLiu Zhe } 91