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/30 11:27:23 UTC
svn commit: r1378870 [2/6] - in /incubator/ooo/trunk/main/test: ./ inc/ prj/
source/ testcommon/ testcommon/source/org/openoffice/test/common/
testgui/source/testcase/gui/ testgui/source/testcase/gui/bvt/
testgui/source/testcase/gui/formula/catalog/ te...
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java Thu Aug 30 09:27:21 2012
@@ -19,13 +19,10 @@
*
*************************************************************/
-
-
/**
*
*/
-
package testcase.gui.performance.benchmark;
import static org.openoffice.test.vcl.Tester.*;
@@ -36,72 +33,63 @@ import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.HashMap;
+import java.util.Timer;
+import java.util.TimerTask;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.OpenOffice;
-import org.openoffice.test.common.Testspace;
import org.openoffice.test.common.SystemUtil;
-
-import java.util.Date;
-import java.util.Timer;
-import java.util.TimerTask;
+import org.openoffice.test.common.Testspace;
public class Filter {
-// @Rule
-
+ // @Rule
+
public String counterOutput = null;
private String pid = null;
private Timer timer = new Timer();
-
+
@Before
- public void setUp() throws FileNotFoundException{
-
+ public void setUp() throws FileNotFoundException {
+
OpenOffice.killAll();
app.start();
String processSoffice = null;
- if(SystemUtil.isWindows())
- {
+ if (SystemUtil.isWindows()) {
processSoffice = ".*soffice\\.exe.*";
- }
- else
- {
+ } else {
processSoffice = ".*soffice\\.bin.*";
}
HashMap<String, Object> proccessInfo = SystemUtil.findProcess(processSoffice);
- pid = (String)proccessInfo.get("pid");
+ pid = (String) proccessInfo.get("pid");
}
-
+
@Test
- public void pvtFilter()
- {
+ public void pvtFilter() {
String counterOutput = Testspace.getPath("output/output_perfmon");
String pvt_result_path = Testspace.getPath("output/pvt_filter_results.txt");
Testspace.prepareData("pvt_benchmark/output_start.ods", "output/output_start.ods");
-
-
+
try {
- if(SystemUtil.isWindows())
- {
- String counterLists = Testspace.getPath("data/pvt_benchmark/perfmon/counterlist.txt");
+ if (SystemUtil.isWindows()) {
+ String counterLists = Testspace.getPath("data/pvt_benchmark/perfmon/counterlist.txt");
String createCounters = Testspace.getPath("data/pvt_benchmark/perfmon/createCounters.bat");
-
+
Testspace.prepareData("pvt_benchmark/perfmon/counterlist.txt");
Testspace.prepareData("pvt_benchmark/perfmon/createCounters.bat");
- String []cmdargs_start = {"cmd.exe", "/C", "start", createCounters, counterOutput, counterLists};
+ String[] cmdargs_start = { "cmd.exe", "/C", "start", createCounters, counterOutput, counterLists };
java.lang.Runtime.getRuntime().exec(cmdargs_start);
sleep(5);
- }
- else
- {
+ } else {
final FileWriter counterOut = new FileWriter(counterOutput);
counterOut.write("Time,Memory(KB),CPU(%)");
-
- timer.schedule(new TimerTask(){
- public void run(){
+
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
String record = System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu");
try {
@@ -114,22 +102,25 @@ public class Filter {
}
}, 0, 1000);
}
-
+
FileWriter out = new FileWriter(pvt_result_path);
out.write("Test Start: " + System.getProperty("line.separator"));
-
+
HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
-
- for(int i = 0; i < 8; i++)
- {
+
+ for (int i = 0; i < 8; i++) {
System.out.println("This is the " + i + " time");
-// out.write("New Document Result: " + perfNew("Text Document") + System.getProperty("line.separator"));
-// out.flush();
-// out.write("New Presentation Result: " + perfNew("Presentation") + System.getProperty("line.separator"));
-// out.flush();
-// out.write("New Spreadsheet Result: " + perfNew("Spreadsheet") + System.getProperty("line.separator"));
-// out.flush();
-
+ // out.write("New Document Result: " + perfNew("Text Document")
+ // + System.getProperty("line.separator"));
+ // out.flush();
+ // out.write("New Presentation Result: " +
+ // perfNew("Presentation") +
+ // System.getProperty("line.separator"));
+ // out.flush();
+ // out.write("New Spreadsheet Result: " + perfNew("Spreadsheet")
+ // + System.getProperty("line.separator"));
+ // out.flush();
+
out.write(getTime() + "," + "Plain ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p_odf1.2.odt") + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Plain DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p.doc") + System.getProperty("line.separator"));
@@ -146,20 +137,23 @@ public class Filter {
out.flush();
out.write(getTime() + "," + "Complex PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p.ppt") + System.getProperty("line.separator"));
out.flush();
- out.write(getTime() + "," + "Plain ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
+ out.write(getTime() + "," + "Plain ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods")
+ + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Plain XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell.xls") + System.getProperty("line.separator"));
out.flush();
- out.write(getTime() + "," + "Complex ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
+ out.write(getTime() + "," + "Complex ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods")
+ + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Complex XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell.xls") + System.getProperty("line.separator"));
out.flush();
-
+
out.write(getTime() + "," + "Plain ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p_odf1.2.odt", 100) + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Plain DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p.doc", 100) + System.getProperty("line.separator"));
out.flush();
- out.write(getTime() + "," + "Complex ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p_odf1.2.odt", 100) + System.getProperty("line.separator"));
+ out.write(getTime() + "," + "Complex ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p_odf1.2.odt", 100)
+ + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Complex DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p.doc", 95) + System.getProperty("line.separator"));
out.flush();
@@ -167,12 +161,13 @@ public class Filter {
out.flush();
out.write(getTime() + "," + "Plain PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p.ppt", 50) + System.getProperty("line.separator"));
out.flush();
- out.write(getTime() + "," + "Complex ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p_odf1.2.odp", 51) + System.getProperty("line.separator"));
+ out.write(getTime() + "," + "Complex ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p_odf1.2.odp", 51)
+ + System.getProperty("line.separator"));
out.flush();
sleep(5);
out.write(getTime() + "," + "Complex PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p.ppt", 51) + System.getProperty("line.separator"));
out.flush();
-
+
out.write(getTime() + "," + "Plain ODT Save Result: " + perfSave("pvt_benchmark/sw_plain_120p_odf1.2.odt") + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Plain DOC Save Result: " + perfSave("pvt_benchmark/sw_plain_120p.doc") + System.getProperty("line.separator"));
@@ -197,233 +192,197 @@ public class Filter {
out.write(getTime() + "," + "Complex ODS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
out.flush();
out.write(getTime() + "," + "Complex XLS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell.xls") + System.getProperty("line.separator"));
- out.flush();
+ out.flush();
}
out.close();
- if(SystemUtil.isWindows())
- {
+ if (SystemUtil.isWindows()) {
String stopCounters = Testspace.getPath("data/pvt_benchmark/perfmon/stopCounters.bat");
Testspace.prepareData("pvt_benchmark/perfmon/stopCounters.bat");
- String []cmdargs_end = {"cmd.exe", "/C", "start", stopCounters};
+ String[] cmdargs_end = { "cmd.exe", "/C", "start", stopCounters };
java.lang.Runtime.getRuntime().exec(cmdargs_end);
- }
- else
- {
+ } else {
timer.cancel();
}
-
+
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
-
+ }
+
GenerateReports genReport = new GenerateReports();
- genReport.computeResults(pvt_result_path);
-
+ GenerateReports.computeResults(pvt_result_path);
+
}
-
+
public String getTime() {
-
- Date d=new Date();
+
+ Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
- String date=sdf.format(d);
+ String date = sdf.format(d);
return date;
}
- public long perfNew(String fileType)
- {
+ public long perfNew(String fileType) {
System.out.println("New " + fileType);
startcenter.menuItem("File->New->" + fileType).select();
-// startcenter.menuItem("File->New->Spreadsheet").select();
+ // startcenter.menuItem("File->New->Spreadsheet").select();
long tr = System.currentTimeMillis();
-// System.out.println("1: " + tr);
- while(true)
- {
- if(fileType.equals("Text Document"))
- {
- if(writer.exists())
- {
+ // System.out.println("1: " + tr);
+ while (true) {
+ if (fileType.equals("Text Document")) {
+ if (writer.exists()) {
break;
}
}
-
-// else{
- if(fileType.equals("Presentation"))
- {
-// System.out.println("2: " + System.currentTimeMillis());
- if(impress.exists())
- {
-// System.out.println("3: " + System.currentTimeMillis());
- break;
- }
+
+ // else{
+ if (fileType.equals("Presentation")) {
+ // System.out.println("2: " + System.currentTimeMillis());
+ if (impress.exists()) {
+ // System.out.println("3: " + System.currentTimeMillis());
+ break;
}
-// else
-// {
- if(calc.exists())
- {
- break;
- }
-// }
-// }
-
+ }
+ // else
+ // {
+ if (calc.exists()) {
+ break;
+ }
+ // }
+ // }
+
}
-// System.out.println("4: " + System.currentTimeMillis());
+ // System.out.println("4: " + System.currentTimeMillis());
tr = System.currentTimeMillis() - tr;
-
- if(fileType.equals("Text Document"))
- {
+
+ if (fileType.equals("Text Document")) {
writer.menuItem("File->Close").select();
}
-
- if(fileType.equals("Presentation"))
- {
+
+ if (fileType.equals("Presentation")) {
impress.menuItem("File->Close").select();
}
-
- if(fileType.equals("Spreadsheet"))
- {
+
+ if (fileType.equals("Spreadsheet")) {
calc.menuItem("File->Close").select();
}
-
+
return tr;
}
-
- public long perfLoadShow(String fileName)
- {
+
+ public long perfLoadShow(String fileName) {
System.out.println(fileName + " Load Show");
long tr = 0;
String file = Testspace.prepareData(fileName);
startcenter.menuItem("File->Open...").select();
FilePicker_Path.setText(file);
FilePicker_Open.click();
-// submitOpenDlg(file);
+ // submitOpenDlg(file);
tr = System.currentTimeMillis();
- while(true)
- {
- if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
- {
- if(writer.exists())
- {
-// writer.menuItem("File->Close").select();
+ while (true) {
+ if (fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx")) {
+ if (writer.exists()) {
+ // writer.menuItem("File->Close").select();
break;
}
}
-
- if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
- {
- if(impress.exists())
- {
-// impress.menuItem("File->Close").select();
+
+ if (fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx")) {
+ if (impress.exists()) {
+ // impress.menuItem("File->Close").select();
break;
}
}
-
- if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
- {
- if(calc.exists())
- {
-// calc.menuItem("File->Close").select();
+
+ if (fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx")) {
+ if (calc.exists()) {
+ // calc.menuItem("File->Close").select();
break;
}
}
}
tr = System.currentTimeMillis() - tr;
sleep(2);
-
- if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
- {
+
+ if (fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx")) {
writer.menuItem("File->Close").select();
}
-
- if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
- {
+
+ if (fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx")) {
impress.menuItem("File->Close").select();
}
-
- if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
- {
+
+ if (fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx")) {
calc.menuItem("File->Close").select();
}
-
+
return tr;
}
- public long perfLoadFinish(String fileName, int destPage)
- {
+ public long perfLoadFinish(String fileName, int destPage) {
System.out.println(fileName + " Load Finish");
long tr = 0;
String file = Testspace.prepareData(fileName);
startcenter.menuItem("File->Open...").select();
-// submitOpenDlg(file);
+ // submitOpenDlg(file);
FilePicker_Path.setText(file);
FilePicker_Open.click();
tr = System.currentTimeMillis();
- while(true)
- {
- while(!statusbar("FWK_HID_STATUSBAR").exists())
- {
+ while (true) {
+ while (!statusbar("FWK_HID_STATUSBAR").exists()) {
;
}
- if(getLoadedPage(fileName) >= destPage)
- {
+ if (getLoadedPage(fileName) >= destPage) {
break;
}
}
tr = System.currentTimeMillis() - tr;
sleep(5);
-// System.out.println("Load Finish Time: " + tr);
-
- if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
- {
+ // System.out.println("Load Finish Time: " + tr);
+
+ if (fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx")) {
writer.menuItem("File->Close").select();
}
-
- if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
- {
+
+ if (fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx")) {
impress.menuItem("File->Close").select();
}
-
- if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
- {
+
+ if (fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx")) {
calc.menuItem("File->Close").select();
}
return tr;
}
-
- public static int getLoadedPage(String docName)
- {
+
+ public static int getLoadedPage(String docName) {
String tmp = "";
- if(docName.endsWith("odt") || docName.endsWith("doc") || docName.endsWith("docx"))
- {
+ if (docName.endsWith("odt") || docName.endsWith("doc") || docName.endsWith("docx")) {
tmp = statusbar("FWK_HID_STATUSBAR").getItemText(0);
}
- if(docName.endsWith("odp") || docName.endsWith("ppt") || docName.endsWith("pptx"))
- {
+ if (docName.endsWith("odp") || docName.endsWith("ppt") || docName.endsWith("pptx")) {
tmp = statusbar("FWK_HID_STATUSBAR").getItemText(4);
}
- //System.out.println(tmp);
- String s[]= tmp.split("/");
-// System.out.println(Integer.parseInt(s[1].trim()));
+ // System.out.println(tmp);
+ String s[] = tmp.split("/");
+ // System.out.println(Integer.parseInt(s[1].trim()));
return Integer.parseInt(s[1].trim());
}
- public long perfSave(String fileName_i)
- {
+ public long perfSave(String fileName_i) {
System.out.println(fileName_i + " Save");
String fileName = fileName_i.substring(14);
-// System.out.println(fileName);
+ // System.out.println(fileName);
long tr = 0;
sleep(2);
String file = Testspace.prepareData(fileName_i);
startcenter.menuItem("File->Open...").select();
submitOpenDlg(file);
sleep(8);
- if(fileName.startsWith("sw")){
- if(fileName.startsWith("sw_complex")){
+ if (fileName.startsWith("sw")) {
+ if (fileName.startsWith("sw_complex")) {
typeKeys("<ctrl Home>");
- if(fileName.endsWith("odt")){
-// writer.click(180,300);
+ if (fileName.endsWith("odt")) {
+ // writer.click(180,300);
typeKeys("<PageDown>");
sleep(2);
typeKeys("<PageDown>");
@@ -433,95 +392,86 @@ public class Filter {
typeKeys("<Enter>");
sleep(2);
typeKeys("<delete>");
- }else{
-// writer.click(180,300);
-// org.vclauto.Tester.typeKeys("<PGDN pgdn pgdn pgdn pgdn>");
-// org.vclauto.Tester.typeKeys("<DOWN down>");
+ } else {
+ // writer.click(180,300);
+ // org.vclauto.Tester.typeKeys("<PGDN pgdn pgdn pgdn pgdn>");
+ // org.vclauto.Tester.typeKeys("<DOWN down>");
typeKeys("<Enter>");
sleep(2);
-// System.out.println("Enter");
+ // System.out.println("Enter");
typeKeys("<backspace>");
-// System.out.println("backspace");
+ // System.out.println("backspace");
}
- }else{
-// writer.click(180,300);
-// writer.click();
+ } else {
+ // writer.click(180,300);
+ // writer.click();
typeKeys("<enter>");
typeKeys("<backspace>");
}
- }
- else if(fileName.startsWith("sd")){
-// writer.click(436, 326);
-// presenter.click();
-// sleep(2);
-// org.vclauto.Tester.typeKeys("<Enter>");
-// sleep(1);
-// org.vclauto.Tester.typeKeys("<BACKSPACE>");
-// sleep(1);
-// org.vclauto.Tester.typeKeys("<ESC>");
-// sleep(1);
-// org.vclauto.Tester.typeKeys("<ESC>");
-// System.out.println("SD");
+ } else if (fileName.startsWith("sd")) {
+ // writer.click(436, 326);
+ // presenter.click();
+ // sleep(2);
+ // org.vclauto.Tester.typeKeys("<Enter>");
+ // sleep(1);
+ // org.vclauto.Tester.typeKeys("<BACKSPACE>");
+ // sleep(1);
+ // org.vclauto.Tester.typeKeys("<ESC>");
+ // sleep(1);
+ // org.vclauto.Tester.typeKeys("<ESC>");
+ // System.out.println("SD");
impress.menuItem("Insert->Slide").select();
-// System.out.println("Insert slide");
+ // System.out.println("Insert slide");
sleep(5);
impress.menuItem("Edit->Delete Slide").select();
-// System.out.println("Delete slide");
+ // System.out.println("Delete slide");
sleep(5);
-
- }else{
-// writer.click(100, 220);
+
+ } else {
+ // writer.click(100, 220);
typeKeys("1");
typeKeys("<BACKSPACE>");
typeKeys("<Enter>");
typeKeys("<ESC>");
}
sleep(5);
-
-// typeKeys("<ctrl s>");
+
+ // typeKeys("<ctrl s>");
app.dispatch(".uno:Save");
tr = System.currentTimeMillis();
-
+
int index = 0;
- if(fileName.endsWith("odt") || fileName.endsWith("doc") || fileName.endsWith("docx"))
- {
+ if (fileName.endsWith("odt") || fileName.endsWith("doc") || fileName.endsWith("docx")) {
index = 5;
}
- if(fileName.endsWith("odp") || fileName.endsWith("ppt") || fileName.endsWith("pptx"))
- {
+ if (fileName.endsWith("odp") || fileName.endsWith("ppt") || fileName.endsWith("pptx")) {
index = 2;
}
- if(fileName.endsWith("ods") || fileName.endsWith("xls") || fileName.endsWith("xlsx"))
- {
+ if (fileName.endsWith("ods") || fileName.endsWith("xls") || fileName.endsWith("xlsx")) {
index = 4;
}
- while(true)
- {
-// System.out.println(statusbar("FWK_HID_STATUSBAR").getItemText(index));
- if(statusbar("FWK_HID_STATUSBAR").getItemText(index).equals(" "))
- {
+ while (true) {
+ // System.out.println(statusbar("FWK_HID_STATUSBAR").getItemText(index));
+ if (statusbar("FWK_HID_STATUSBAR").getItemText(index).equals(" ")) {
break;
}
}
tr = System.currentTimeMillis() - tr;
-
+
sleep(2);
-
- if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
- {
+
+ if (fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx")) {
writer.menuItem("File->Close").select();
}
-
- if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
- {
+
+ if (fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx")) {
impress.menuItem("File->Close").select();
}
-
- if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
- {
+
+ if (fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx")) {
calc.menuItem("File->Close").select();
}
return tr;
}
-
+
}
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java Thu Aug 30 09:27:21 2012
@@ -19,180 +19,153 @@
*
*************************************************************/
-
-
/**
*
*/
package testcase.gui.performance.benchmark;
-import java.io.File;
+import static org.openoffice.test.vcl.Tester.*;
+import static testlib.gui.AppUtil.*;
+import static testlib.gui.UIMap.*;
+
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
-
-import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.lang.Math;
-import org.junit.Before;
-import org.junit.Test;
import org.openoffice.test.common.FileUtil;
import testlib.gui.CalcUtil;
-import static org.openoffice.test.vcl.Tester.sleep;
-import static org.openoffice.test.vcl.Tester.typeKeys;
-import static testlib.gui.AppUtil.*;
-import static testlib.gui.CalcUtil.*;
-import static testlib.gui.UIMap.*;
-
public class GenerateReports {
- static public void computeResults(String resultDir)
- {
+ static public void computeResults(String resultDir) {
try {
Map<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();
BufferedReader in = new BufferedReader(new FileReader(resultDir));
String line = in.readLine();
String testScenario;
String testResult;
-
- while((line = in.readLine())!= null)
- {
+
+ while ((line = in.readLine()) != null) {
String temp = line.substring(9);
testScenario = temp.substring(0, temp.indexOf(":"));
testResult = temp.substring(temp.indexOf(":") + 2);
System.out.println(testScenario + " " + testResult);
- if(map.containsKey(testScenario))
- {
+ if (map.containsKey(testScenario)) {
map.get(testScenario).add(testResult);
- }
- else
- {
- ArrayList <String> array = new ArrayList<String>();
+ } else {
+ ArrayList<String> array = new ArrayList<String>();
array.add(testResult);
map.put(testScenario, array);
}
-// line = in.readLine();
+ // line = in.readLine();
}
-
-
+
Iterator iter = map.keySet().iterator();
- while(iter.hasNext())
- {
- String key = (String)iter.next();
- ArrayList<String> val = (ArrayList<String>)map.get(key);
-
- if(val.size() < 8)
- {
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ ArrayList<String> val = map.get(key);
+
+ if (val.size() < 8) {
continue;
}
-
- //Remove the first round result;
+
+ // Remove the first round result;
val.remove(0);
val.trimToSize();
-
- //Find the min and max value;
+
+ // Find the min and max value;
Iterator iter1 = val.listIterator();
int min_index = 0, max_index = 0, curr_index = 0;
long min, max, curr_value;
- min = max = Long.parseLong((String)iter1.next());
- while(iter1.hasNext())
- {
+ min = max = Long.parseLong((String) iter1.next());
+ while (iter1.hasNext()) {
curr_index++;
- curr_value = Long.parseLong((String)iter1.next());
- if(curr_value <= min)
- {
+ curr_value = Long.parseLong((String) iter1.next());
+ if (curr_value <= min) {
min = curr_value;
min_index = curr_index;
}
-
- if(curr_value > max)
- {
+
+ if (curr_value > max) {
max = curr_value;
max_index = curr_index;
}
}
-
- if(min_index > max_index)
- {
+
+ if (min_index > max_index) {
val.remove(min_index);
val.remove(max_index);
- }
- else
- {
+ } else {
val.remove(max_index);
val.remove(min_index);
}
-
-
+
System.out.println("Map removed value: ");
- System.out.println("Key: " + key + " ;Value: " + (ArrayList<String>)map.get(key));
-
- //Compute the average and standard deviation value of the 5 left round result
+ System.out.println("Key: " + key + " ;Value: " + map.get(key));
+
+ // Compute the average and standard deviation value of the 5
+ // left round result
Iterator iter2 = val.listIterator();
double average = 0;
long sum = 0;
- while(iter2.hasNext())
- {
-// System.out.println("Result: " + (String)iter2.next());
- sum += Long.parseLong((String)iter2.next());
+ while (iter2.hasNext()) {
+ // System.out.println("Result: " + (String)iter2.next());
+ sum += Long.parseLong((String) iter2.next());
}
-
+
average = sum / 5;
-
+
Iterator iter3 = val.listIterator();
double stdev = 0;
sum = 0;
- while(iter3.hasNext())
- {
- long curr_result = Long.parseLong((String)iter3.next());
+ while (iter3.hasNext()) {
+ long curr_result = Long.parseLong((String) iter3.next());
sum += (curr_result - average) * (curr_result - average);
- }
-
+ }
+
average = average / 1000;
stdev = Math.sqrt(sum / 4) / 1000;
-
+
val.add(Double.toString(average));
val.add(Double.toString(stdev));
-
+
System.out.println(val.size());
}
-
+
String resultOdsFile = new File(System.getProperty("testspace", "../testspace")).getAbsolutePath() + "/output/output_start.ods";
-
+
writeResultToFile(map, resultOdsFile);
-
+
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
-
-
+
}
-
- static void writeResultToFile(Map<String, ArrayList<String>> m, String report_dir)
- {
-// initApp();
+
+ static void writeResultToFile(Map<String, ArrayList<String>> m, String report_dir) {
+ // initApp();
startcenter.menuItem("File->Open...").select();
submitOpenDlg(report_dir);
sleep(10);
-
+
CalcUtil.selectRange("Spread.F1");
calc.menuItem("Insert->Columns").select();
-// SC_InsertColumnsRowsdialog.ok();
+ // SC_InsertColumnsRowsdialog.ok();
sleep(1);
-
-// fillReport(m, "Spread.F13", "New Document Result");
-// fillReport(m, "Spread.F15", "New Presentation Result");
-// fillReport(m, "Spread.F17", "New Spreadsheet Result");
+
+ // fillReport(m, "Spread.F13", "New Document Result");
+ // fillReport(m, "Spread.F15", "New Presentation Result");
+ // fillReport(m, "Spread.F17", "New Spreadsheet Result");
fillReport(m, "Spread.F3", "Plain ODT Load Show Result");
fillReport(m, "Spread.F4", "Complex ODT Load Show Result");
fillReport(m, "Spread.F5", "Plain ODT Load Finish Result");
@@ -225,57 +198,54 @@ public class GenerateReports {
fillReport(m, "Spread.F32", "Complex ODS Save Result");
fillReport(m, "Spread.F33", "Plain XLS Save Result");
fillReport(m, "Spread.F34", "Complex XLS Save Result");
-// fillReport(m, "Spread.F51", "SD-SShow Complex odp Slider Show Result");
-
- //Save the text document
+ // fillReport(m, "Spread.F51",
+ // "SD-SShow Complex odp Slider Show Result");
+
+ // Save the text document
calc.menuItem("File->Save As...").select();
String saveTo = new File(System.getProperty("testspace", "../testspace")).getAbsolutePath() + "/output/output_start_1.ods";
FileUtil.deleteFile(saveTo);
- submitSaveDlg(saveTo);
-// if (dialog("33388").exists(3))
-// dialog("33388").ok();
+ submitSaveDlg(saveTo);
+ // if (dialog("33388").exists(3))
+ // dialog("33388").ok();
sleep(2);
calc.menuItem("File->Exit").select();
-
+
}
-
- static void fillReport(Map<String, ArrayList<String>> m, String cell, String scenario)
- {
- ArrayList <String> raw_data = m.get(scenario);
-
-// Iterator iter1 = raw_data.listIterator();
-// while(iter1.hasNext())
-// {
-// System.out.println(iter1.next());
-// }
-
-// NumberFormat nbf = NumberFormat.getInstance();
-// nbf.setMinimumFractionDigits(2);
-// nbf.setMaximumFractionDigits(2);
+
+ static void fillReport(Map<String, ArrayList<String>> m, String cell, String scenario) {
+ ArrayList<String> raw_data = m.get(scenario);
+
+ // Iterator iter1 = raw_data.listIterator();
+ // while(iter1.hasNext())
+ // {
+ // System.out.println(iter1.next());
+ // }
+
+ // NumberFormat nbf = NumberFormat.getInstance();
+ // nbf.setMinimumFractionDigits(2);
+ // nbf.setMaximumFractionDigits(2);
String result;
- if(raw_data.size() == 1)
- {
+ if (raw_data.size() == 1) {
System.out.println("alsdjf");
result = raw_data.get(0);
- }
- else
- {
-// result = " " + nbf.format(raw_data.get(raw_data.size() - 2)) + "/ " + nbf.format(raw_data.get(raw_data.size() - 1));
- result = new java.text.DecimalFormat("0.00").format(Double.parseDouble(raw_data.get(raw_data.size() - 2))).toString() + "/ " + new java.text.DecimalFormat("0.00").format(Double.parseDouble(raw_data.get(raw_data.size() - 1))).toString();
-// result = raw_data.get(raw_data.size() - 2) + "/ " + raw_data.get(raw_data.size() - 1);
+ } else {
+ // result = " " + nbf.format(raw_data.get(raw_data.size() - 2)) +
+ // "/ " + nbf.format(raw_data.get(raw_data.size() - 1));
+ result = new java.text.DecimalFormat("0.00").format(Double.parseDouble(raw_data.get(raw_data.size() - 2))).toString() + "/ "
+ + new java.text.DecimalFormat("0.00").format(Double.parseDouble(raw_data.get(raw_data.size() - 1))).toString();
+ // result = raw_data.get(raw_data.size() - 2) + "/ " +
+ // raw_data.get(raw_data.size() - 1);
}
CalcUtil.selectRange(cell);
typeKeys(result + "<enter>");
}
-
- static void printMap(Map<String, ArrayList<String>> m)
- {
+
+ static void printMap(Map<String, ArrayList<String>> m) {
Iterator iter = m.keySet().iterator();
- while(iter.hasNext())
- {
- String key = (String)iter.next();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
System.out.println("Key: " + key + "; Value: " + m.get(key));
}
}
}
-
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/cell/InserCells.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/cell/InserCells.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/cell/InserCells.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/cell/InserCells.java Thu Aug 30 09:27:21 2012
@@ -1,27 +1,28 @@
package testcase.gui.sc.cell;
import static org.junit.Assert.*;
-import static testlib.gui.AppUtil.typeKeys;
+import static testlib.gui.AppUtil.*;
import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.openoffice.test.common.Logger;
import testlib.gui.CalcUtil;
-import testlib.gui.Log;
/**
- * Before running the testing class, you need specify the AOO location firstly with system property openoffice.home.
+ * Before running the testing class, you need specify the AOO location firstly
+ * with system property openoffice.home.
+ *
*
- *
*/
public class InserCells {
@Rule
- public Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
@@ -34,107 +35,94 @@ public class InserCells {
public void tearDown() throws Exception {
app.close();
}
-
+
/**
* Shift row and column, insert entire row and column
+ *
* @throws Exception
*/
-
+
@Test
- public void testShiftRowandColumn(){
-
- //Input data to cell range A1:B2
+ public void testShiftRowandColumn() {
+
+ // Input data to cell range A1:B2
CalcUtil.selectRange("A1");
typeKeys("1<right>2<down><left>3<right>4");
-
- //Set expected result after executing shift cell down
- String[][] expectedShiftCellDownResult = new String[][] {
- {"","2"},
- {"1","4"},
- {"3",""},
- };
-
- //Select Cell A1
- CalcUtil.selectRange("Sheet1.A1");
-
- //Launch insert cells dialog via menu
+
+ // Set expected result after executing shift cell down
+ String[][] expectedShiftCellDownResult = new String[][] { { "", "2" }, { "1", "4" }, { "3", "" }, };
+
+ // Select Cell A1
+ CalcUtil.selectRange("Sheet1.A1");
+
+ // Launch insert cells dialog via menu
calc.menuItem("Insert->Cells...").select();
-
- //Select the first option "shift cells down" from dialog
+
+ // Select the first option "shift cells down" from dialog
typeKeys("<enter>");
-
- //Verify results after shift one cell down
+
+ // Verify results after shift one cell down
assertArrayEquals("Verify results after shift one cell down", expectedShiftCellDownResult, CalcUtil.getCellTexts("A1:B3"));
-
- //Set expected result after executing shift cell right
- String[][] expectedShiftCellRightResult = new String[][] {
- {"","1","2"},
- {"3","4",""},
- };
-
+
+ // Set expected result after executing shift cell right
+ String[][] expectedShiftCellRightResult = new String[][] { { "", "1", "2" }, { "3", "4", "" }, };
+
// Undo
calc.menuItem("Edit->Undo: Insert").select();
-
- //Select cell B2
+
+ // Select cell B2
CalcUtil.selectRange("Sheet1.A1");
-
- //Launch insert cells dialog via menu
- calc.menuItem("Insert->Cells...").select();
-
- //Select the second option "shift cells right" from dialog
+
+ // Launch insert cells dialog via menu
+ calc.menuItem("Insert->Cells...").select();
+
+ // Select the second option "shift cells right" from dialog
typeKeys("<down>");
typeKeys("<enter>");
-
- //Verify results after shift one cell right
+
+ // Verify results after shift one cell right
assertArrayEquals("Verify results after shift one cell right", expectedShiftCellRightResult, CalcUtil.getCellTexts("A1:C2"));
-
- //Set expected result after executing insert entire row
- String[][] expectedEntireRowResult = new String[][] {
- {"",""},
- {"1","2"},
- {"3","4"},
- };
-
+
+ // Set expected result after executing insert entire row
+ String[][] expectedEntireRowResult = new String[][] { { "", "" }, { "1", "2" }, { "3", "4" }, };
+
// Undo
calc.menuItem("Edit->Undo: Insert").select();
-
- //Select Cell B2
+
+ // Select Cell B2
CalcUtil.selectRange("Sheet1.A1");
-
- //Launch insert cells dialog via menu
- calc.menuItem("Insert->Cells...").select();
-
- //Select the third option "Entire row" from dialog
+
+ // Launch insert cells dialog via menu
+ calc.menuItem("Insert->Cells...").select();
+
+ // Select the third option "Entire row" from dialog
typeKeys("<down>");
typeKeys("<enter>");
-
- //Verify results after insert entire row
- assertArrayEquals("Verify results after insert entire row", expectedEntireRowResult, CalcUtil.getCellTexts("A1:B3"));
-
- //Set expected result after executing insert entire column
+
+ // Verify results after insert entire row
+ assertArrayEquals("Verify results after insert entire row", expectedEntireRowResult, CalcUtil.getCellTexts("A1:B3"));
+
+ // Set expected result after executing insert entire column
String[][] expectedEntireColumnResult = new String[][] {
-
- {"","1","2"},
- {"","3","4"},
- };
-
+
+ { "", "1", "2" }, { "", "3", "4" }, };
+
// Undo
calc.menuItem("Edit->Undo: Insert").select();
-
- //Select Cell A1
+
+ // Select Cell A1
CalcUtil.selectRange("Sheet1.A1");
-
- //Launch insert cells dialog via menu
- calc.menuItem("Insert->Cells...").select();
-
- //Select the fourth option "Entire column" from dialog
+
+ // Launch insert cells dialog via menu
+ calc.menuItem("Insert->Cells...").select();
+
+ // Select the fourth option "Entire column" from dialog
typeKeys("<down>");
typeKeys("<enter>");
-
- //Verify the results after inserting entire column
- assertArrayEquals("Verify the results after inserting entire column", expectedEntireColumnResult, CalcUtil.getCellTexts("A1:C2"));
-
-
+
+ // Verify the results after inserting entire column
+ assertArrayEquals("Verify the results after inserting entire column", expectedEntireColumnResult, CalcUtil.getCellTexts("A1:C2"));
+
}
}
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/chart/ChartDialogSetting.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/chart/ChartDialogSetting.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/chart/ChartDialogSetting.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/chart/ChartDialogSetting.java Thu Aug 30 09:27:21 2012
@@ -19,22 +19,19 @@
*
*************************************************************/
-
-
/**
*
*/
package testcase.gui.sc.chart;
+import static org.junit.Assert.*;
import static testlib.gui.UIMap.*;
import org.junit.After;
-import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import testlib.gui.Log;
+import org.openoffice.test.common.Logger;
/**
* Test the setting about chart dialog in spreadsheet
@@ -42,7 +39,7 @@ import testlib.gui.Log;
public class ChartDialogSetting {
@Rule
- public Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
@@ -56,7 +53,7 @@ public class ChartDialogSetting {
@After
public void tearDown() throws Exception {
-
+
}
/**