View | Details | Raw Unified | Return to issue 120722
Collapse All | Expand All

(-)testgui/source/testcase/gui/svt/sw/OperationOnSample1.java (+143 lines)
Line 0 Link Here
1
/**************************************************************
2
 * 
3
 * Licensed to the Apache Software Foundation (ASF) under one
4
 * or more contributor license agreements.  See the NOTICE file
5
 * distributed with this work for additional information
6
 * regarding copyright ownership.  The ASF licenses this file
7
 * to you under the Apache License, Version 2.0 (the
8
 * "License"); you may not use this file except in compliance
9
 * with the License.  You may obtain a copy of the License at
10
 * 
11
 *   http://www.apache.org/licenses/LICENSE-2.0
12
 * 
13
 * Unless required by applicable law or agreed to in writing,
14
 * software distributed under the License is distributed on an
15
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
 * KIND, either express or implied.  See the License for the
17
 * specific language governing permissions and limitations
18
 * under the License.
19
 * 
20
 *************************************************************/
21
22
/**
23
 * 
24
 */
25
package testcase.gui.svt.sw;
26
27
import static org.openoffice.test.common.Testspace.prepareData;
28
import static testlib.gui.AppUtil.submitOpenDlg;
29
import static testlib.gui.UIMap.app;
30
import static testlib.gui.UIMap.writer;
31
import static testlib.gui.UIMap.*;
32
33
import java.io.FileOutputStream;
34
import java.io.PrintStream;
35
import java.util.HashMap;
36
37
import org.junit.After;
38
import org.junit.Before;
39
import org.junit.Rule;
40
import org.junit.Test;
41
import org.openoffice.test.OpenOffice;
42
import org.openoffice.test.common.SystemUtil;
43
import org.openoffice.test.common.Testspace;
44
import static org.openoffice.test.vcl.Tester.*;
45
46
import testlib.gui.Log;
47
48
public class OperationOnSample1 {
49
	
50
	@Rule
51
	public Log LOG = new Log();
52
	
53
	private PrintStream result = null;
54
	
55
	private String pid = null;
56
	
57
	/**
58
	 * @throws java.lang.Exception
59
	 */
60
	@Before
61
	public void setUp() throws Exception {
62
		OpenOffice.killAll();
63
		app.start();
64
		result = new PrintStream(new FileOutputStream(Testspace.getFile("output/svt_sw_sample1.csv")));
65
		String processSoffice = null;
66
		if(SystemUtil.isWindows())
67
		{
68
			processSoffice = ".*soffice\\.exe.*";
69
		}
70
		else 
71
		{
72
			processSoffice = ".*soffice\\.bin.*";
73
		}
74
		HashMap<String, Object> proccessInfo = SystemUtil.findProcess(processSoffice);
75
		pid = (String)proccessInfo.get("pid");
76
		result.println("Iterator,Time,Memory(KB),CPU(%)");
77
		LOG.info("Result will be saved to " + Testspace.getPath("output/svt_sw_sample1.csv"));
78
	}
79
80
	@After
81
	public void tearDown() throws Exception {
82
		app.close();
83
		result.close();
84
	}
85
	
86
	@Test
87
	public void operationOnSample1() throws Exception{
88
		String file = prepareData("svt/ScenarioDesign.odt");
89
		for(int i = 0; i < 1000; i++)
90
		{
91
			System.out.println("This is the " + i + " round");
92
			app.dispatch(".uno:Open");
93
			submitOpenDlg(file);
94
			writer.waitForExistence(10, 2);
95
			writer.typeKeys("<down>");
96
			writer.typeKeys("<down>");
97
			sleep(2);
98
			
99
			writer.menuItem("Table->Split Cells").select();
100
			sleep(2);
101
			Writer_SplitCellDlg.ok();
102
			sleep(2);
103
			
104
			writer.typeKeys("<shift down>");
105
			writer.typeKeys("<shift down>");
106
			writer.typeKeys("<shift down>");
107
			writer.typeKeys("<shift down>");
108
			writer.typeKeys("<shift down>");
109
			sleep(2);
110
			writer.menuItem("Table->Merge Cells").select();
111
			sleep(2);
112
			
113
			writer.typeKeys("<enter>");
114
//			writer.menuItem("Table->Insert->Rows...").select();
115
			app.dispatch(".uno:InsertRowDialog");
116
			Writer_InsertRowsDlg.ok();
117
			sleep(2);
118
			
119
			writer.menuItem("Table->Delete->Rows").select();
120
			sleep(2);
121
			
122
			app.dispatch(".uno:InsertColumnDialog");
123
			Writer_InsertColumnsDlg.ok();
124
			sleep(2);
125
			
126
			writer.menuItem("Table->Delete->Columns").select();
127
			sleep(2);
128
			
129
			writer.menuItem("File->Close").select();
130
			ActiveMsgBox.no();
131
			sleep(2);
132
			
133
			HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
134
			String record = i + "," + System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu");
135
			LOG.info("Record: " + record);
136
			result.println(record);
137
			result.flush();
138
			
139
			sleep(3);
140
		}
141
	}
142
143
}
(-)testgui/source/testcase/gui/svt/sw/OperationOnSample2.java (+159 lines)
Line 0 Link Here
1
/**************************************************************
2
 * 
3
 * Licensed to the Apache Software Foundation (ASF) under one
4
 * or more contributor license agreements.  See the NOTICE file
5
 * distributed with this work for additional information
6
 * regarding copyright ownership.  The ASF licenses this file
7
 * to you under the Apache License, Version 2.0 (the
8
 * "License"); you may not use this file except in compliance
9
 * with the License.  You may obtain a copy of the License at
10
 * 
11
 *   http://www.apache.org/licenses/LICENSE-2.0
12
 * 
13
 * Unless required by applicable law or agreed to in writing,
14
 * software distributed under the License is distributed on an
15
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
 * KIND, either express or implied.  See the License for the
17
 * specific language governing permissions and limitations
18
 * under the License.
19
 * 
20
 *************************************************************/
21
22
/**
23
 * 
24
 */
25
package testcase.gui.svt.sw;
26
27
import static org.openoffice.test.common.Testspace.prepareData;
28
import static testlib.gui.AppUtil.submitOpenDlg;
29
import static testlib.gui.UIMap.app;
30
import static testlib.gui.UIMap.writer;
31
import static testlib.gui.UIMap.*;
32
33
import java.io.FileOutputStream;
34
import java.io.PrintStream;
35
import java.util.HashMap;
36
37
import org.junit.After;
38
import org.junit.Before;
39
import org.junit.Rule;
40
import org.junit.Test;
41
import org.openoffice.test.OpenOffice;
42
import org.openoffice.test.common.SystemUtil;
43
import org.openoffice.test.common.Testspace;
44
import static org.openoffice.test.vcl.Tester.*;
45
46
import testlib.gui.Log;
47
48
public class OperationOnSample2 {
49
	
50
	@Rule
51
	public Log LOG = new Log();
52
	
53
	private PrintStream result = null;
54
	
55
	private String pid = null;
56
	
57
	/**
58
	 * @throws java.lang.Exception
59
	 */
60
	@Before
61
	public void setUp() throws Exception {
62
		OpenOffice.killAll();
63
		app.start();
64
		result = new PrintStream(new FileOutputStream(Testspace.getFile("output/svt_sw_sample2.csv")));
65
		String processSoffice = null;
66
		if(SystemUtil.isWindows())
67
		{
68
			processSoffice = ".*soffice\\.exe.*";
69
		}
70
		else 
71
		{
72
			processSoffice = ".*soffice\\.bin.*";
73
		}
74
		HashMap<String, Object> proccessInfo = SystemUtil.findProcess(processSoffice);
75
		pid = (String)proccessInfo.get("pid");
76
		result.println("Iterator,Time,Memory(KB),CPU(%)");
77
		LOG.info("Result will be saved to " + Testspace.getPath("output/svt_sw_sample2.csv"));
78
	}
79
80
	@After
81
	public void tearDown() throws Exception {
82
		app.close();
83
		result.close();
84
	}
85
	
86
	@Test
87
	public void operationOnSample2() throws Exception {
88
		String file = prepareData("svt/complex.odt");
89
		String pic = prepareData("svt/Sunset.jpg");
90
		
91
		for(int i = 0; i < 1000; i++)
92
		{
93
			System.out.println("This is the " + i + " round");
94
			app.dispatch(".uno:Open");
95
			submitOpenDlg(file);
96
			writer.waitForExistence(20, 2);
97
			
98
//	Set Paragraph properties		
99
			app.dispatch(".uno:SelectAll");
100
			sleep(2);
101
			writer.menuItem("Format->Paragraph...").select();
102
			AlignmentTabPage.select();
103
			Right.check();
104
			sleep(2);
105
			VerticalAlignment.select("Bottom");
106
			sleep(2);
107
			AlignmentTabPage.ok();
108
			sleep(2);
109
			writer.typeKeys("<ctrl end>");
110
			sleep(5);
111
			
112
// Insert Picture from file
113
			writer.menuItem("Insert->Picture->From File...").select();
114
			sleep(2);
115
			FilePicker_Path.setText(pic);
116
			sleep(1);
117
			FilePicker_Open.click();
118
			sleep(5);
119
			writer.typeKeys("<esc>");
120
			sleep(2);
121
			
122
// Insert OLE Object
123
//			writer.menuItem("Insert->Object->OLE Object...").select();
124
//			sleep(2);
125
			app.dispatch(".uno:InsertObject");
126
			sleep(2);
127
			InsertObject.ok();
128
			sleep(10);
129
			typeKeys("<esc>");
130
			sleep(5);
131
			typeKeys("<esc>");
132
			sleep(5);
133
				
134
// Insert Chart
135
			writer.menuItem("Insert->Object->Chart...").select();
136
			sleep(5);
137
			typeKeys("<esc>");
138
			sleep(5);
139
			typeKeys("<esc>");
140
			sleep(5);
141
			typeKeys("<esc>");
142
			sleep(5);
143
144
// Close file
145
			writer.menuItem("File->Close").select();
146
			ActiveMsgBox.no();
147
			sleep(2);
148
149
			HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
150
			String record = i + "," + System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu");
151
			LOG.info("Record: " + record);
152
			result.println(record);
153
			result.flush();
154
			
155
			sleep(3);
156
		}
157
	}
158
159
}

Return to issue 120722