summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLiu Zhe <liuzhe@apache.org>2012-08-28 00:50:23 +0000
committerLiu Zhe <liuzhe@apache.org>2012-08-28 00:50:23 +0000
commitb407e33323351ebcac4bc711bc055f4ecfeb2b86 (patch)
tree02460a16a1e3c64f80cbb9298e6a6e4d131292fd /test
parent0a731aa083647216a65df8f78c909fb8995cb3a0 (diff)
#120725 - SC SVT operations on ods sample file
Patch by: Liu Yi Xuan <liuyixuan.527@gmail.com> Review by: Liu Zhe <aliuzhe@gmail.com>
Notes
Notes: ignore: vclauto
Diffstat (limited to 'test')
-rw-r--r--test/testgui/data/svt/complex.odsbin0 -> 9424385 bytes
-rw-r--r--test/testgui/source/testcase/gui/svt/sc/OperationOnSampleFile.java176
-rw-r--r--test/testgui/source/testlib/gui/UIMap.java3
3 files changed, 179 insertions, 0 deletions
diff --git a/test/testgui/data/svt/complex.ods b/test/testgui/data/svt/complex.ods
new file mode 100644
index 000000000000..399388e70072
--- /dev/null
+++ b/test/testgui/data/svt/complex.ods
Binary files differ
diff --git a/test/testgui/source/testcase/gui/svt/sc/OperationOnSampleFile.java b/test/testgui/source/testcase/gui/svt/sc/OperationOnSampleFile.java
new file mode 100644
index 000000000000..0c147688ab2d
--- /dev/null
+++ b/test/testgui/source/testcase/gui/svt/sc/OperationOnSampleFile.java
@@ -0,0 +1,176 @@
+/**************************************************************
+ *
+ * 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.common.Testspace.prepareData;
+import static testlib.gui.AppUtil.typeKeys;
+import static org.openoffice.test.vcl.Tester.sleep;
+import static org.openoffice.test.vcl.Tester.typeKeys;
+import static testlib.gui.AppUtil.submitOpenDlg;
+import static testlib.gui.UIMap.SCAfterCurrentSheet;
+import static testlib.gui.UIMap.SCInsertSheetDlg;
+import static testlib.gui.UIMap.SCNewSheetName;
+import static testlib.gui.UIMap.app;
+import static testlib.gui.UIMap.writer;
+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 org.openoffice.test.common.Testspace;
+
+import testlib.gui.CalcUtil;
+import testlib.gui.Log;
+
+public class OperationOnSampleFile {
+ @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_sample1.csv")));
+ HashMap<String, Object> 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_sample1.csv"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ result.close();
+ }
+
+ @Test
+ public void operationOnSampleFile() throws Exception {
+ String file = prepareData("svt/complex.ods");
+ String pic = prepareData("svt/Sunset.jpg");
+ String [][] inputStr = { { "Area", "Item", "Count" }, { "1", "2", "3" },
+ { "4", "5", "6" }, { "7", "8", "9" }, { "10", "11", "12" }};
+ for(int i = 0; i < 1000; i++)
+ {
+ app.dispatch(".uno:Open");
+ submitOpenDlg(file);
+ calc.waitForExistence(20, 2);
+ sleep(2);
+
+ //Insert Chart
+ app.dispatch(".uno:Insert");
+ SCAfterCurrentSheet.check();
+ SCNewSheetName.setText("Instant Chart");
+ SCInsertSheetDlg.ok();
+ sleep(5);
+ inputCells(inputStr);
+ sleep(2);
+ CalcUtil.selectRange("A1:C5");
+ calc.menuItem("Insert->Chart...").select();
+ sleep(1);
+ Chart_Wizard.ok();
+ sleep(5);
+ calc.typeKeys("<esc>");
+ sleep(5);
+ calc.typeKeys("<esc>");
+ sleep(5);
+ calc.typeKeys("<esc>");
+ sleep(5);
+
+ //Insert Graphic and Fontwork
+ app.dispatch(".uno:Insert");
+ SCAfterCurrentSheet.check();
+ SCNewSheetName.setText("Instant Graphic and fontwork");
+ SCInsertSheetDlg.ok();
+ sleep(5);
+ calc.menuItem("Insert->Picture->From File...").select();
+ sleep(2);
+ FilePicker_Path.setText(pic);
+ sleep(1);
+ FilePicker_Open.click();
+ sleep(5);
+ calc.typeKeys("<esc>");
+ sleep(2);
+ calc.menuItem("View->Toolbars->Fontwork").select();
+ sleep(2);
+ app.dispatch(".uno:FontworkGalleryFloater");
+ sleep(2);
+ typeKeys("<right>");
+ FontworkGalleryDlg.ok();
+ sleep(2);
+ calc.typeKeys("<esc>");
+ sleep(2);
+
+ // Close file
+ calc.menuItem("File->Close").select();
+ ActiveMsgBox.no();
+ sleep(2);
+
+ HashMap<String, Object> 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);
+
+ }
+
+
+ }
+ public static void inputCells(String [][]inputs)
+ {
+ String back = "";
+ for (int i = 0; i < inputs.length; i++) {
+ calc.typeKeys(back);
+ sleep(1);
+ back = "";
+ for (int j = 0; j < inputs[i].length; j++) {
+ typeKeys(inputs[i][j]);
+ typeKeys("<Right>");
+ sleep(0.5);
+ back += "<Left>";
+ }
+ back += "<enter>";
+ }
+ sleep(2);
+ }
+}
diff --git a/test/testgui/source/testlib/gui/UIMap.java b/test/testgui/source/testlib/gui/UIMap.java
index de43974ee15d..bb0faf0dd78a 100644
--- a/test/testgui/source/testlib/gui/UIMap.java
+++ b/test/testgui/source/testlib/gui/UIMap.java
@@ -466,6 +466,9 @@ public class UIMap {
public static final VclComboBox FilterValue1 = combobox("sc:ComboBox:RID_SCDLG_FILTER:ED_VAL1");
public static final VclDialog StandardFilterDlg = dialog(".uno:DataFilterStandardFilter");
+ //Fontwork
+ public static final VclDialog FontworkGalleryDlg = dialog("svx:ModalDialog:RID_SVX_MDLG_FONTWORK_GALLERY");
+