You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/08/27 10:54:21 UTC
svn commit: r1377607 - in /incubator/ooo/trunk/main/test/testgui:
data/svt/ScenarioDesign.odt data/svt/complex.odt
source/testcase/gui/svt/sw/OperationOnSample1.java
source/testcase/gui/svt/sw/OperationOnSample2.java
Author: liuzhe
Date: Mon Aug 27 08:54:19 2012
New Revision: 1377607
URL: http://svn.apache.org/viewvc?rev=1377607&view=rev
Log:
#120722 - 2 SW SVT cases on Sample files patch
Patch by: Liu Yi Xuan <li...@gmail.com>
Review by: Liu Zhe <al...@gmail.com>
Added:
incubator/ooo/trunk/main/test/testgui/data/svt/ScenarioDesign.odt (with props)
incubator/ooo/trunk/main/test/testgui/data/svt/complex.odt (with props)
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample1.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample2.java
Added: incubator/ooo/trunk/main/test/testgui/data/svt/ScenarioDesign.odt
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/data/svt/ScenarioDesign.odt?rev=1377607&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/ooo/trunk/main/test/testgui/data/svt/ScenarioDesign.odt
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/ooo/trunk/main/test/testgui/data/svt/complex.odt
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/data/svt/complex.odt?rev=1377607&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/ooo/trunk/main/test/testgui/data/svt/complex.odt
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample1.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample1.java?rev=1377607&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample1.java (added)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample1.java Mon Aug 27 08:54:19 2012
@@ -0,0 +1,143 @@
+/**************************************************************
+ *
+ * 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.sw;
+
+import static org.openoffice.test.common.Testspace.prepareData;
+import static testlib.gui.AppUtil.submitOpenDlg;
+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 static org.openoffice.test.vcl.Tester.*;
+
+import testlib.gui.Log;
+
+public class OperationOnSample1 {
+
+ @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_sw_sample1.csv")));
+ String processSoffice = null;
+ if(SystemUtil.isWindows())
+ {
+ processSoffice = ".*soffice\\.exe.*";
+ }
+ else
+ {
+ processSoffice = ".*soffice\\.bin.*";
+ }
+ HashMap<String, Object> proccessInfo = SystemUtil.findProcess(processSoffice);
+ pid = (String)proccessInfo.get("pid");
+ result.println("Iterator,Time,Memory(KB),CPU(%)");
+ LOG.info("Result will be saved to " + Testspace.getPath("output/svt_sw_sample1.csv"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ result.close();
+ }
+
+ @Test
+ public void operationOnSample1() throws Exception{
+ String file = prepareData("svt/ScenarioDesign.odt");
+ for(int i = 0; i < 1000; i++)
+ {
+ System.out.println("This is the " + i + " round");
+ app.dispatch(".uno:Open");
+ submitOpenDlg(file);
+ writer.waitForExistence(10, 2);
+ writer.typeKeys("<down>");
+ writer.typeKeys("<down>");
+ sleep(2);
+
+ writer.menuItem("Table->Split Cells").select();
+ sleep(2);
+ Writer_SplitCellDlg.ok();
+ sleep(2);
+
+ writer.typeKeys("<shift down>");
+ writer.typeKeys("<shift down>");
+ writer.typeKeys("<shift down>");
+ writer.typeKeys("<shift down>");
+ writer.typeKeys("<shift down>");
+ sleep(2);
+ writer.menuItem("Table->Merge Cells").select();
+ sleep(2);
+
+ writer.typeKeys("<enter>");
+// writer.menuItem("Table->Insert->Rows...").select();
+ app.dispatch(".uno:InsertRowDialog");
+ Writer_InsertRowsDlg.ok();
+ sleep(2);
+
+ writer.menuItem("Table->Delete->Rows").select();
+ sleep(2);
+
+ app.dispatch(".uno:InsertColumnDialog");
+ Writer_InsertColumnsDlg.ok();
+ sleep(2);
+
+ writer.menuItem("Table->Delete->Columns").select();
+ sleep(2);
+
+ writer.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);
+ }
+ }
+
+}
Added: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample2.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample2.java?rev=1377607&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample2.java (added)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample2.java Mon Aug 27 08:54:19 2012
@@ -0,0 +1,159 @@
+/**************************************************************
+ *
+ * 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.sw;
+
+import static org.openoffice.test.common.Testspace.prepareData;
+import static testlib.gui.AppUtil.submitOpenDlg;
+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 static org.openoffice.test.vcl.Tester.*;
+
+import testlib.gui.Log;
+
+public class OperationOnSample2 {
+
+ @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_sw_sample2.csv")));
+ String processSoffice = null;
+ if(SystemUtil.isWindows())
+ {
+ processSoffice = ".*soffice\\.exe.*";
+ }
+ else
+ {
+ processSoffice = ".*soffice\\.bin.*";
+ }
+ HashMap<String, Object> proccessInfo = SystemUtil.findProcess(processSoffice);
+ pid = (String)proccessInfo.get("pid");
+ result.println("Iterator,Time,Memory(KB),CPU(%)");
+ LOG.info("Result will be saved to " + Testspace.getPath("output/svt_sw_sample2.csv"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ result.close();
+ }
+
+ @Test
+ public void operationOnSample2() throws Exception {
+ String file = prepareData("svt/complex.odt");
+ String pic = prepareData("svt/Sunset.jpg");
+
+ for(int i = 0; i < 1000; i++)
+ {
+ System.out.println("This is the " + i + " round");
+ app.dispatch(".uno:Open");
+ submitOpenDlg(file);
+ writer.waitForExistence(20, 2);
+
+// Set Paragraph properties
+ app.dispatch(".uno:SelectAll");
+ sleep(2);
+ writer.menuItem("Format->Paragraph...").select();
+ AlignmentTabPage.select();
+ Right.check();
+ sleep(2);
+ VerticalAlignment.select("Bottom");
+ sleep(2);
+ AlignmentTabPage.ok();
+ sleep(2);
+ writer.typeKeys("<ctrl end>");
+ sleep(5);
+
+// Insert Picture from file
+ writer.menuItem("Insert->Picture->From File...").select();
+ sleep(2);
+ FilePicker_Path.setText(pic);
+ sleep(1);
+ FilePicker_Open.click();
+ sleep(5);
+ writer.typeKeys("<esc>");
+ sleep(2);
+
+// Insert OLE Object
+// writer.menuItem("Insert->Object->OLE Object...").select();
+// sleep(2);
+ app.dispatch(".uno:InsertObject");
+ sleep(2);
+ InsertObject.ok();
+ sleep(10);
+ typeKeys("<esc>");
+ sleep(5);
+ typeKeys("<esc>");
+ sleep(5);
+
+// Insert Chart
+ writer.menuItem("Insert->Object->Chart...").select();
+ sleep(5);
+ typeKeys("<esc>");
+ sleep(5);
+ typeKeys("<esc>");
+ sleep(5);
+ typeKeys("<esc>");
+ sleep(5);
+
+// Close file
+ writer.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);
+ }
+ }
+
+}