Index: testgui/source/testcase/gui/svt/sc/OperationOnNewSC.java =================================================================== --- testgui/source/testcase/gui/svt/sc/OperationOnNewSC.java (revision 0) +++ testgui/source/testcase/gui/svt/sc/OperationOnNewSC.java (working copy) @@ -0,0 +1,196 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +/** + * + */ + + +package testcase.gui.svt.sc; + +import static org.openoffice.test.vcl.Tester.sleep; +import static testlib.gui.AppUtil.typeKeys; +import static testlib.gui.UIMap.SortOptionsPage; +import static testlib.gui.UIMap.SortOptionsPage_RangeContainsColumnLabels; +import static testlib.gui.UIMap.SortPage; +import static testlib.gui.UIMap.SortPage_Ascending1; +import static testlib.gui.UIMap.SortPage_By1; +import static testlib.gui.UIMap.app; +import static testlib.gui.UIMap.*; + +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.util.HashMap; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.openoffice.test.OpenOffice; +import org.openoffice.test.common.SystemUtil; +import static org.openoffice.test.common.Testspace.prepareData; +import org.openoffice.test.common.*; + +import testlib.gui.CalcUtil; +import testlib.gui.Log; +import static testlib.gui.AppUtil.submitSaveDlg; + +public class OperationOnNewSC { + @Rule + public Log LOG = new Log(); + + private PrintStream result = null; + + private String pid = null; + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + OpenOffice.killAll(); + app.start(); + result = new PrintStream(new FileOutputStream(Testspace.getFile("output/svt_sc_new.csv"))); + HashMap proccessInfo = SystemUtil.findProcess(".*(soffice\\.bin|soffice.*-env).*"); + pid = (String)proccessInfo.get("pid"); + result.println("Iterator,Time,Memory(KB),CPU(%)"); + LOG.info("Result will be saved to " + Testspace.getPath("output/svt_sc_new.csv")); + } + + @After + public void tearDown() throws Exception { + app.close(); + result.close(); + } + + @Test + public void operationOnNewSC() throws Exception { + String[][] inputStr = {{"3"},{"2"}, {"5"}, {"1"}, {"6"},{"4"}, {"10"}, {"8"}, {"9"}, {"7"}}; + String[][] inputStr_InstantFilter = {{ "A" }, { "1" }, { "2" }, { "3" }, { "1" }, + { "2" }, { "3" }, { "1" }, { "2" }, { "3" } }; + String pic = prepareData("svt/Sunset.jpg"); + + for(int i = 0; i < 1000; i++) + { + // Data Sort + app.dispatch("private:factory/scalc"); + CalcUtil.selectRange("A1"); + typeKeys("32516410897"); + sleep(1); + app.dispatch(".uno:DataSort"); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.uncheck(); + SortPage.select(); + SortPage_By1.select(1); // "Column A" + SortPage_Ascending1.check(); + SortPage.ok(); + sleep(5); + + //Insert Sheet + app.dispatch(".uno:Insert"); + SCAfterCurrentSheet.check(); + SCNewSheetName.setText("Instant Filter"); + SCInsertSheetDlg.ok(); + sleep(5); + + //Standard Filter + CalcUtil.selectRange("A1"); + typeKeys("A123123123"); + sleep(1); + CalcUtil.selectRange("A1"); + app.dispatch(".uno:DataFilterStandardFilter"); + sleep(2); + FilterValue1.setText("1"); + StandardFilterDlg.ok(); + sleep(5); + + //Data Validate + app.dispatch(".uno:Insert"); + SCAfterCurrentSheet.check(); + SCNewSheetName.setText("Data Validate"); + SCInsertSheetDlg.ok(); + sleep(5); + CalcUtil.selectRange("B2:E5"); + sleep(2); + + app.dispatch(".uno:Validation"); + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Whole Numbers"); + SC_ValidityDecimalCompareOperator.select("greater than"); + SC_ValiditySourceInput.setText("1"); + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorMessageTitle.setText("Error"); + SC_ValidityErrorMessage.setText("Must greater than 1"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("B2"); + typeKeys("0"); + ActiveMsgBox.ok(); + sleep(1); + + CalcUtil.selectRange("E5"); + typeKeys("1"); + ActiveMsgBox.ok(); + sleep(1); + + CalcUtil.selectRange("E2"); + typeKeys("2"); + sleep(5); + + //Input cells, insert pics and chart + app.dispatch(".uno:Insert"); + SCBeforeCurrentSheet.check(); + SCNewSheetName.setText("InsertObjects"); + SCInsertSheetDlg.ok(); + sleep(5); + calc.menuItem("Insert->Picture->From File...").select(); + sleep(2); + FilePicker_Path.setText(pic); + sleep(1); + FilePicker_Open.click(); + sleep(5); + typeKeys(""); + sleep(5); + + //Save file and close + String saveTo = "tempSC_New" + i + ".ods"; + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + if(ActiveMsgBox.exists()) + { + ActiveMsgBox.yes(); + sleep(2); + } + calc.menuItem("File->Close").select(); + + HashMap perfData = SystemUtil.getProcessPerfData(pid); + String record = i + "," + System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu"); + LOG.info("Record: " + record); + result.println(record); + result.flush(); + + sleep(3); + } + } + +} Index: testgui/source/testlib/gui/UIMap.java =================================================================== --- testgui/source/testlib/gui/UIMap.java (revision 1377585) +++ testgui/source/testlib/gui/UIMap.java (working copy) @@ -462,7 +462,11 @@ public static final VclButton SlideAutoAfter = button("SD_HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO"); public static final VclButton ApplyToAllSlides = button("SD_HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL"); + //Spreadsheet: Standard Filter Dialog + public static final VclComboBox FilterValue1 = combobox("sc:ComboBox:RID_SCDLG_FILTER:ED_VAL1"); + public static final VclDialog StandardFilterDlg = dialog(".uno:DataFilterStandardFilter"); + }