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 22*424494b0SLi Feng Wang 2380a6f5c5SLiu Zhe package fvt.gui.sc.subtotals; 2480a6f5c5SLiu Zhe 2580a6f5c5SLiu Zhe import static org.junit.Assert.*; 2680a6f5c5SLiu Zhe import static org.openoffice.test.common.Testspace.*; 2780a6f5c5SLiu Zhe import static org.openoffice.test.vcl.Tester.*; 2880a6f5c5SLiu Zhe import static testlib.gui.AppTool.*; 2980a6f5c5SLiu Zhe import static testlib.gui.UIMap.*; 3080a6f5c5SLiu Zhe 3180a6f5c5SLiu Zhe import org.junit.After; 3280a6f5c5SLiu Zhe import org.junit.Before; 3380a6f5c5SLiu Zhe import org.junit.Rule; 3480a6f5c5SLiu Zhe import org.junit.Test; 3580a6f5c5SLiu Zhe import org.openoffice.test.common.Logger; 3680a6f5c5SLiu Zhe 3780a6f5c5SLiu Zhe import testlib.gui.SCTool; 3880a6f5c5SLiu Zhe 3980a6f5c5SLiu Zhe 40*424494b0SLi Feng Wang public class SubtotalsFunctions { 4180a6f5c5SLiu Zhe 4280a6f5c5SLiu Zhe @Before 4380a6f5c5SLiu Zhe public void setUp() throws Exception { 4480a6f5c5SLiu Zhe app.start(true); 4580a6f5c5SLiu Zhe String file = prepareData("sc/SubtotalsSampleFile.ods"); 46*424494b0SLi Feng Wang open(file); 4780a6f5c5SLiu Zhe SCTool.selectRange("A1:E7"); 4880a6f5c5SLiu Zhe app.dispatch(".uno:DataSubTotals"); 4980a6f5c5SLiu Zhe } 5080a6f5c5SLiu Zhe 5180a6f5c5SLiu Zhe @After 5280a6f5c5SLiu Zhe public void tearDown() throws Exception { 53*424494b0SLi Feng Wang app.stop(); 5480a6f5c5SLiu Zhe 5580a6f5c5SLiu Zhe } 5680a6f5c5SLiu Zhe 5780a6f5c5SLiu Zhe /** 5880a6f5c5SLiu Zhe * Just support en-US language Verify Average function in SubTotals 5980a6f5c5SLiu Zhe */ 6080a6f5c5SLiu Zhe @Test 6180a6f5c5SLiu Zhe public void testAverage() { 6280a6f5c5SLiu Zhe scSubTotalsGroupByListBox.select(4); // "Team" 6380a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 25); // In different platform, can 6480a6f5c5SLiu Zhe // not focus on same checkbox 6580a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(1); 6680a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(1); // "Code" 6780a6f5c5SLiu Zhe sleep(1); 6880a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(2); // "Average" 6980a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 7080a6f5c5SLiu Zhe sleep(1); 7180a6f5c5SLiu Zhe 72*424494b0SLi Feng Wang assertArrayEquals("Wrong Average function in Subtotal ", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "2", "A", "Chcomic" }, { "CS", "30", "5", "A", "Ally" }, 7380a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "", "20", "", "A Average", "" }, { "BS", "20", "4", "B", "Elle" }, { "MS", "10", "3", "B", "Kevin" }, 7480a6f5c5SLiu Zhe { "", "15", "", "B Average", "" }, { "BS", "20", "6", "C", "Sweet" }, { "", "20", "", "C Average", "" }, { "", "18.33333333", "", "Grand Total", "" } }, 7580a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 7680a6f5c5SLiu Zhe } 7780a6f5c5SLiu Zhe 7880a6f5c5SLiu Zhe /** 7980a6f5c5SLiu Zhe * Just support en-US language Verify Count Numbers only function in 8080a6f5c5SLiu Zhe * SubTotals 8180a6f5c5SLiu Zhe */ 8280a6f5c5SLiu Zhe @Test 8380a6f5c5SLiu Zhe public void testCountNumbersOnly() { 8480a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 8580a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 8680a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 8780a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(6); // "Count (numbers only)" 8880a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 8980a6f5c5SLiu Zhe sleep(1); 9080a6f5c5SLiu Zhe 91*424494b0SLi Feng Wang assertArrayEquals("Wrong Count Numbers only function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 9280a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Count", "", "3", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Count", "", "1", "", "" }, 9380a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Count", "", "2", "", "" }, { "Grand Total", "", "6", "", "" } }, 9480a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 9580a6f5c5SLiu Zhe } 9680a6f5c5SLiu Zhe 9780a6f5c5SLiu Zhe /** 9880a6f5c5SLiu Zhe * Just support en-US language Verify Max Numbers function in SubTotals 9980a6f5c5SLiu Zhe */ 10080a6f5c5SLiu Zhe @Test 10180a6f5c5SLiu Zhe public void testMax() { 10280a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 10380a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 10480a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 10580a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(3); // "Max" 10680a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 10780a6f5c5SLiu Zhe sleep(1); 10880a6f5c5SLiu Zhe 109*424494b0SLi Feng Wang assertArrayEquals("Wrong Max Numbers function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 11080a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Max", "", "6", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Max", "", "5", "", "" }, 11180a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Max", "", "3", "", "" }, { "Grand Total", "", "6", "", "" } }, 11280a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 11380a6f5c5SLiu Zhe } 11480a6f5c5SLiu Zhe 11580a6f5c5SLiu Zhe /** 11680a6f5c5SLiu Zhe * Just support en-US language Verify Min Numbers function in SubTotals 11780a6f5c5SLiu Zhe */ 11880a6f5c5SLiu Zhe @Test 11980a6f5c5SLiu Zhe public void testMin() { 12080a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 12180a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 12280a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 12380a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(4); // "Min" 12480a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 12580a6f5c5SLiu Zhe sleep(1); 12680a6f5c5SLiu Zhe 127*424494b0SLi Feng Wang assertArrayEquals("Wrong Min Numbers function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 12880a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Min", "", "2", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Min", "", "5", "", "" }, 12980a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Min", "", "1", "", "" }, { "Grand Total", "", "1", "", "" } }, 13080a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 13180a6f5c5SLiu Zhe } 13280a6f5c5SLiu Zhe 13380a6f5c5SLiu Zhe /** 13480a6f5c5SLiu Zhe * Just support en-US language Verify Product function in SubTotals 13580a6f5c5SLiu Zhe */ 13680a6f5c5SLiu Zhe @Test 13780a6f5c5SLiu Zhe public void testProduct() { 13880a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 13980a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 14080a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 14180a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(5); // "Product" 14280a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 14380a6f5c5SLiu Zhe sleep(1); 14480a6f5c5SLiu Zhe 145*424494b0SLi Feng Wang assertArrayEquals("Wrong Product function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 14680a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Product", "", "48", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Product", "", "5", "", "" }, 14780a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Product", "", "3", "", "" }, { "Grand Total", "", "720", "", "" } }, 14880a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 14980a6f5c5SLiu Zhe } 15080a6f5c5SLiu Zhe 15180a6f5c5SLiu Zhe /** 15280a6f5c5SLiu Zhe * Just support en-US language Verify StDevP (Population) function in 15380a6f5c5SLiu Zhe * SubTotals 15480a6f5c5SLiu Zhe */ 15580a6f5c5SLiu Zhe @Test 15680a6f5c5SLiu Zhe public void testStDevPPopulation() { 15780a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 15880a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 15980a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 16080a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(8); // "StDevP (Population)" 16180a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 16280a6f5c5SLiu Zhe sleep(1); 16380a6f5c5SLiu Zhe 164*424494b0SLi Feng Wang assertArrayEquals("Wrong StdevP function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 16580a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS StDev", "", "1.63299316", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS StDev", "", "0", "", "" }, 16680a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS StDev", "", "1", "", "" }, { "Grand Total", "", "1.70782513", "", "" } }, 16780a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 16880a6f5c5SLiu Zhe } 16980a6f5c5SLiu Zhe 17080a6f5c5SLiu Zhe /** 17180a6f5c5SLiu Zhe * Just support en-US language Verify sum function in SubTotals 17280a6f5c5SLiu Zhe */ 17380a6f5c5SLiu Zhe @Test 17480a6f5c5SLiu Zhe public void testSum() { 17580a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 17680a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 17780a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 17880a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(0); // "Sum" 17980a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 18080a6f5c5SLiu Zhe sleep(1); 18180a6f5c5SLiu Zhe 182*424494b0SLi Feng Wang assertArrayEquals("Wrong Sum Function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 18380a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Sum", "", "12", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Sum", "", "5", "", "" }, 18480a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Sum", "", "4", "", "" }, { "Grand Total", "", "21", "", "" } }, 18580a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 18680a6f5c5SLiu Zhe } 18780a6f5c5SLiu Zhe 18880a6f5c5SLiu Zhe /** 18980a6f5c5SLiu Zhe * Just support en-US language Verify Var Sample function in SubTotals 19080a6f5c5SLiu Zhe */ 19180a6f5c5SLiu Zhe @Test 19280a6f5c5SLiu Zhe public void testVarSample() { 19380a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 19480a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 19580a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 19680a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(9); // "Var (Sample)" 19780a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 19880a6f5c5SLiu Zhe sleep(1); 19980a6f5c5SLiu Zhe 200*424494b0SLi Feng Wang assertArrayEquals("Wrong Var Sample function in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "BS", "20", "6", "C", "Sweet" }, 20180a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Var", "", "4", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Var", "", "#DIV/0!", "", "" }, 20280a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Var", "", "2", "", "" }, { "Grand Total", "", "3.5", "", "" } }, 20380a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 20480a6f5c5SLiu Zhe } 20580a6f5c5SLiu Zhe 20680a6f5c5SLiu Zhe /** 20780a6f5c5SLiu Zhe * Just support en-US language Verify Don't sort in Sub totals 20880a6f5c5SLiu Zhe */ 20980a6f5c5SLiu Zhe @Test 21080a6f5c5SLiu Zhe public void testDoNotSortOption() { 21180a6f5c5SLiu Zhe scSubTotalsGroupByListBox.select(4); // "Team" 21280a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 25); 21380a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(1); 21480a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(1); // "Code" 21580a6f5c5SLiu Zhe scSubTotalsOptionsTabPage.select(); 21680a6f5c5SLiu Zhe scSubtotalsPreSortToGroupCheckBox.uncheck(); 21780a6f5c5SLiu Zhe scSubTotalsOptionsTabPage.ok(); 21880a6f5c5SLiu Zhe sleep(1); 21980a6f5c5SLiu Zhe 220*424494b0SLi Feng Wang assertArrayEquals("Wrong Not Sort option in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, { "", "20", "", "B Sum", "" }, 22180a6f5c5SLiu Zhe { "BS", "20", "6", "C", "Sweet" }, { "", "20", "", "C Sum", "" }, { "BS", "20", "2", "A", "Chcomic" }, { "CS", "30", "5", "A", "Ally" }, 22280a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "", "60", "", "A Sum", "" }, { "MS", "10", "3", "B", "Kevin" }, { "", "10", "", "B Sum", "" }, 22380a6f5c5SLiu Zhe { "", "110", "", "Grand Total", "" } }, SCTool.getCellTexts("A1:E12")); 22480a6f5c5SLiu Zhe } 22580a6f5c5SLiu Zhe 22680a6f5c5SLiu Zhe /** 22780a6f5c5SLiu Zhe * Just support en-US language Verify SubTotals Options default UI 22880a6f5c5SLiu Zhe */ 22980a6f5c5SLiu Zhe @Test 23080a6f5c5SLiu Zhe public void testDefaultUI() { 23180a6f5c5SLiu Zhe assertArrayEquals("Group List: ", new String[] { "- none -", "Level", "Code", "No.", "Team", "Name" }, scSubTotalsGroupByListBox.getItemsText()); 23280a6f5c5SLiu Zhe 23380a6f5c5SLiu Zhe scSubTotalsOptionsTabPage.select(); 234*424494b0SLi Feng Wang assertFalse("Wrong default value of InsertPageBreak checkbox",scSubtotalsInsertPageBreakCheckBox.isChecked()); 235*424494b0SLi Feng Wang assertFalse("Wrong default value of CaseSensitive checkbox",scSubtotalsCaseSensitiveCheckBox.isChecked()); 236*424494b0SLi Feng Wang assertTrue("Worng default value of PreSortToGroup checkbox",scSubtotalsPreSortToGroupCheckBox.isChecked()); 237*424494b0SLi Feng Wang assertTrue("Wrong default value of SortAscending Radio button",scSubtotalSortAscendingRadioButton.isChecked()); 238*424494b0SLi Feng Wang assertFalse("Wrong default value of SortDescending Radio button",scSubtotalSortDescendingRadioButton.isChecked()); 239*424494b0SLi Feng Wang assertFalse("Wrong default value of InludeFormat checkbox",scSubtotalsIncludeFormatsCheckBox.isChecked()); 240*424494b0SLi Feng Wang assertFalse("Wrong default value of CustomSortOrder checkbox",scSubtotalsCustomSortOrderCheckBox.isChecked()); 241*424494b0SLi Feng Wang assertFalse("Wrong default value of CustomSort listbox",scSubtotalsCustomSortListBox.isEnabled()); 24280a6f5c5SLiu Zhe scSubTotalsOptionsTabPage.ok(); 24380a6f5c5SLiu Zhe } 24480a6f5c5SLiu Zhe 24580a6f5c5SLiu Zhe /** 24680a6f5c5SLiu Zhe * Just support en-US language Verify Subtotals using all group 24780a6f5c5SLiu Zhe */ 24880a6f5c5SLiu Zhe @Test 24980a6f5c5SLiu Zhe public void testUsingAllGroup() { 25080a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.select(); 25180a6f5c5SLiu Zhe scSubTotalsGroupByListBox.select(1); // "Level" 25280a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 45); 25380a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 25480a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 25580a6f5c5SLiu Zhe scSubTotalsGroup2Dialog.select(); 25680a6f5c5SLiu Zhe scSubTotalsGroupByListBox.select(4); // "Team" 25780a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 25); 25880a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(1); 25980a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(1); // "Code" 26080a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(3); // "Max" 26180a6f5c5SLiu Zhe scSubTotalsGroup3Dialog.select(); 26280a6f5c5SLiu Zhe scSubTotalsGroupByListBox.select(5); // "Name" 26380a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10, 25); 26480a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(1); 26580a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(1); // "Code" 26680a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.select(); 26780a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 26880a6f5c5SLiu Zhe sleep(1); 26980a6f5c5SLiu Zhe 270*424494b0SLi Feng Wang assertArrayEquals("Not all group in Subtotal", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "2", "A", "Chcomic" }, { "", "20", "", "", "Chcomic Sum" }, 27180a6f5c5SLiu Zhe { "", "20", "", "A Max", "" }, { "BS", "20", "4", "B", "Elle" }, { "", "20", "", "", "Elle Sum" }, { "", "20", "", "B Max", "" }, 27280a6f5c5SLiu Zhe { "BS", "20", "6", "C", "Sweet" }, { "", "20", "", "", "Sweet Sum" }, { "", "20", "", "C Max", "" }, { "BS Sum", "", "12", "", "" }, 27380a6f5c5SLiu Zhe { "CS", "30", "5", "A", "Ally" }, { "", "30", "", "", "Ally Sum" }, { "", "30", "", "A Max", "" }, { "CS Sum", "", "5", "", "" }, 27480a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "", "10", "", "", "Joker Sum" }, { "", "10", "", "A Max", "" }, { "MS", "10", "3", "B", "Kevin" }, 27580a6f5c5SLiu Zhe { "", "10", "", "", "Kevin Sum" }, { "", "10", "", "B Max", "" }, { "MS Sum", "", "4", "", "" }, { "Grand Total", "", "21", "", "" } }, 27680a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E23")); 27780a6f5c5SLiu Zhe } 27880a6f5c5SLiu Zhe 27980a6f5c5SLiu Zhe /** 28080a6f5c5SLiu Zhe * Just support en-US language Verify Subtotals_Recalculate and refresh 28180a6f5c5SLiu Zhe * results when data rows deleted. 28280a6f5c5SLiu Zhe */ 28380a6f5c5SLiu Zhe @Test 28480a6f5c5SLiu Zhe public void testRecalculateAfterRowDeleted() { 28580a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10,45); 28680a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(2); 28780a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(2); // "No." 28880a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 28980a6f5c5SLiu Zhe sleep(1); 29080a6f5c5SLiu Zhe 291*424494b0SLi Feng Wang assertArrayEquals("Subtotal table not equal before deleting row", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, 29280a6f5c5SLiu Zhe { "BS", "20", "6", "C", "Sweet" }, { "BS", "20", "2", "A", "Chcomic" }, { "BS Sum", "", "12", "", "" }, { "CS", "30", "5", "A", "Ally" }, 29380a6f5c5SLiu Zhe { "CS Sum", "", "5", "", "" }, { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Sum", "", "4", "", "" }, 29480a6f5c5SLiu Zhe { "Grand Total", "", "21", "", "" } }, SCTool.getCellTexts("A1:E11")); 29580a6f5c5SLiu Zhe 29680a6f5c5SLiu Zhe SCTool.selectRange("A3:E3"); 29780a6f5c5SLiu Zhe app.dispatch(".uno:DeleteCell"); 29880a6f5c5SLiu Zhe scDeleteCellsDeleteRowsRadioButton.check(); 29980a6f5c5SLiu Zhe scDeleteCellsDialog.ok(); 30080a6f5c5SLiu Zhe sleep(1); 30180a6f5c5SLiu Zhe 302*424494b0SLi Feng Wang assertArrayEquals("Subtotal table not equal after deleting row", new String[][] { { "Level", "Code", "No.", "Team", "Name" }, { "BS", "20", "4", "B", "Elle" }, 30380a6f5c5SLiu Zhe { "BS", "20", "2", "A", "Chcomic" }, { "BS Sum", "", "6", "", "" }, { "CS", "30", "5", "A", "Ally" }, { "CS Sum", "", "5", "", "" }, 30480a6f5c5SLiu Zhe { "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B", "Kevin" }, { "MS Sum", "", "4", "", "" }, { "Grand Total", "", "15", "", "" }, { "", "", "", "", "" } }, 30580a6f5c5SLiu Zhe SCTool.getCellTexts("A1:E11")); 30680a6f5c5SLiu Zhe 30780a6f5c5SLiu Zhe } 30880a6f5c5SLiu Zhe 30980a6f5c5SLiu Zhe /** 31080a6f5c5SLiu Zhe * Verify Recalculates when source data changed with Average function in 31180a6f5c5SLiu Zhe * SubTotals 31280a6f5c5SLiu Zhe */ 31380a6f5c5SLiu Zhe @Test 31480a6f5c5SLiu Zhe public void testRecalculateWhenDataChanged() { 31580a6f5c5SLiu Zhe scSubTotalsGroupByListBox.select(4); // "Team" 31680a6f5c5SLiu Zhe // SCCalcSubTotalForColumns.click(10,25); 31780a6f5c5SLiu Zhe scCalcSubTotalForColumns.select(1); 31880a6f5c5SLiu Zhe scCalcSubTotalForColumns.check(1); // "Code" 31980a6f5c5SLiu Zhe scCalcSubTotolsFuncionList.select(2); // "Average" 32080a6f5c5SLiu Zhe scSubTotalsGroup1Dialog.ok(); 32180a6f5c5SLiu Zhe sleep(1); 32280a6f5c5SLiu Zhe 32380a6f5c5SLiu Zhe SCTool.selectRange("B4"); 32480a6f5c5SLiu Zhe typeKeys("40" + "<enter>"); 32580a6f5c5SLiu Zhe sleep(1); 326*424494b0SLi Feng Wang assertEquals("B5's cell text is not 30","30", SCTool.getCellText("B5")); 327*424494b0SLi Feng Wang assertEquals("B11's cell text is not 23.33333333","23.33333333", SCTool.getCellText("B11")); 32880a6f5c5SLiu Zhe 32980a6f5c5SLiu Zhe SCTool.selectRange("B7"); 33080a6f5c5SLiu Zhe typeKeys("50" + "<enter>"); 33180a6f5c5SLiu Zhe sleep(1); 332*424494b0SLi Feng Wang assertEquals("B8's cell text is not 35","35", SCTool.getCellText("B8")); 333*424494b0SLi Feng Wang assertEquals("B11's cell text is not 30","30", SCTool.getCellText("B11")); 33480a6f5c5SLiu Zhe 33580a6f5c5SLiu Zhe SCTool.selectRange("B9"); 33680a6f5c5SLiu Zhe typeKeys("30" + "<enter>"); 33780a6f5c5SLiu Zhe sleep(1); 338*424494b0SLi Feng Wang assertEquals("B10's cell text is not 30","30", SCTool.getCellText("B10")); 339*424494b0SLi Feng Wang assertEquals("B11's cell text is not 31.66666667","31.66666667", SCTool.getCellText("B11")); 34080a6f5c5SLiu Zhe } 34180a6f5c5SLiu Zhe } 342