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

(-)testgui/source/testcase/gui/svt/sc/OperationOnNewSC.java (+196 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
26
27
package testcase.gui.svt.sc;
28
29
import static org.openoffice.test.vcl.Tester.sleep;
30
import static testlib.gui.AppUtil.typeKeys;
31
import static testlib.gui.UIMap.SortOptionsPage;
32
import static testlib.gui.UIMap.SortOptionsPage_RangeContainsColumnLabels;
33
import static testlib.gui.UIMap.SortPage;
34
import static testlib.gui.UIMap.SortPage_Ascending1;
35
import static testlib.gui.UIMap.SortPage_By1;
36
import static testlib.gui.UIMap.app;
37
import static testlib.gui.UIMap.*;
38
39
import java.io.FileOutputStream;
40
import java.io.PrintStream;
41
import java.util.HashMap;
42
43
import org.junit.After;
44
import org.junit.Before;
45
import org.junit.Rule;
46
import org.junit.Test;
47
import org.openoffice.test.OpenOffice;
48
import org.openoffice.test.common.SystemUtil;
49
import static org.openoffice.test.common.Testspace.prepareData;
50
import org.openoffice.test.common.*;
51
52
import testlib.gui.CalcUtil;
53
import testlib.gui.Log;
54
import static testlib.gui.AppUtil.submitSaveDlg;
55
56
public class OperationOnNewSC {
57
	@Rule
58
	public Log LOG = new Log();
59
	
60
	private PrintStream result = null;
61
	
62
	private String pid = null;
63
	
64
	/**
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		OpenOffice.killAll();
70
		app.start();
71
		result = new PrintStream(new FileOutputStream(Testspace.getFile("output/svt_sc_new.csv")));
72
		HashMap<String, Object> proccessInfo = SystemUtil.findProcess(".*(soffice\\.bin|soffice.*-env).*");
73
		pid = (String)proccessInfo.get("pid");
74
		result.println("Iterator,Time,Memory(KB),CPU(%)");
75
		LOG.info("Result will be saved to " + Testspace.getPath("output/svt_sc_new.csv"));
76
	}
77
78
	@After
79
	public void tearDown() throws Exception {
80
		app.close();
81
		result.close();
82
	}
83
	
84
	@Test
85
	public void operationOnNewSC() throws Exception {
86
		String[][] inputStr = {{"3"},{"2"}, {"5"}, {"1"}, {"6"},{"4"}, {"10"}, {"8"}, {"9"}, {"7"}};
87
		String[][] inputStr_InstantFilter = {{ "A" }, { "1" }, { "2" }, { "3" }, { "1" },
88
				{ "2" }, { "3" }, { "1" }, { "2" }, { "3" } };
89
		String pic = prepareData("svt/Sunset.jpg");
90
91
		for(int i = 0; i < 1000; i++)
92
		{
93
			// Data Sort
94
			app.dispatch("private:factory/scalc");
95
			CalcUtil.selectRange("A1");
96
			typeKeys("3<down>2<down>5<down>1<down>6<down>4<down>10<down>8<down>9<down>7");
97
			sleep(1);
98
			app.dispatch(".uno:DataSort");
99
			SortOptionsPage.select();
100
			SortOptionsPage_RangeContainsColumnLabels.uncheck();
101
			SortPage.select();
102
			SortPage_By1.select(1);	// "Column A"
103
			SortPage_Ascending1.check();
104
			SortPage.ok();		
105
			sleep(5);
106
			
107
			//Insert Sheet
108
			app.dispatch(".uno:Insert");
109
			SCAfterCurrentSheet.check();
110
			SCNewSheetName.setText("Instant Filter");
111
			SCInsertSheetDlg.ok();
112
			sleep(5);
113
			
114
			//Standard Filter
115
			CalcUtil.selectRange("A1");
116
			typeKeys("A<down>1<down>2<down>3<down>1<down>2<down>3<down>1<down>2<down>3");
117
			sleep(1);
118
			CalcUtil.selectRange("A1");
119
			app.dispatch(".uno:DataFilterStandardFilter");
120
			sleep(2);
121
			FilterValue1.setText("1");
122
			StandardFilterDlg.ok();
123
			sleep(5);
124
			
125
			//Data Validate
126
			app.dispatch(".uno:Insert");
127
			SCAfterCurrentSheet.check();
128
			SCNewSheetName.setText("Data Validate");
129
			SCInsertSheetDlg.ok();
130
			sleep(5);
131
			CalcUtil.selectRange("B2:E5");
132
			sleep(2);
133
			
134
			app.dispatch(".uno:Validation");
135
			SC_ValidityCriteriaTabpage.select();
136
			SC_ValidityCriteriaAllowList.select("Whole Numbers");
137
			SC_ValidityDecimalCompareOperator.select("greater than");
138
			SC_ValiditySourceInput.setText("1");
139
			SC_ValidityErrorAlertTabPage.select();
140
			SC_ValidityShowErrorMessage.check();
141
			SC_ValidityErrorMessageTitle.setText("Error");
142
			SC_ValidityErrorMessage.setText("Must greater than 1");
143
			SC_ValidityErrorAlertTabPage.ok();
144
			
145
			CalcUtil.selectRange("B2");
146
			typeKeys("0<enter>");
147
			ActiveMsgBox.ok();
148
			sleep(1);
149
			
150
			CalcUtil.selectRange("E5");
151
			typeKeys("1<enter>");
152
			ActiveMsgBox.ok();
153
			sleep(1);
154
			
155
			CalcUtil.selectRange("E2");
156
			typeKeys("2<enter>");
157
			sleep(5);
158
			
159
			//Input cells, insert pics and chart
160
			app.dispatch(".uno:Insert");
161
			SCBeforeCurrentSheet.check();
162
			SCNewSheetName.setText("InsertObjects");
163
			SCInsertSheetDlg.ok();
164
			sleep(5);
165
			calc.menuItem("Insert->Picture->From File...").select();
166
			sleep(2);
167
			FilePicker_Path.setText(pic);
168
			sleep(1);
169
			FilePicker_Open.click();
170
			sleep(5);
171
			typeKeys("<esc>");
172
			sleep(5);
173
			
174
			//Save file and close
175
			String saveTo = "tempSC_New" + i + ".ods";
176
			calc.menuItem("File->Save As...").select();
177
			FileUtil.deleteFile(saveTo);
178
			submitSaveDlg(saveTo);
179
			if(ActiveMsgBox.exists())
180
			{
181
				ActiveMsgBox.yes();
182
				sleep(2);
183
			}
184
			calc.menuItem("File->Close").select();
185
			
186
			HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
187
			String record = i + "," + System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu");
188
			LOG.info("Record: " + record);
189
			result.println(record);
190
			result.flush();
191
			
192
			sleep(3);
193
		}
194
	}
195
196
}
(-)testgui/source/testlib/gui/UIMap.java (+4 lines)
Lines 462-468 Link Here
462
	public static final VclButton SlideAutoAfter = button("SD_HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO");
462
	public static final VclButton SlideAutoAfter = button("SD_HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO");
463
	public static final VclButton ApplyToAllSlides = button("SD_HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL");
463
	public static final VclButton ApplyToAllSlides = button("SD_HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL");
464
	
464
	
465
    //Spreadsheet: Standard Filter Dialog
466
	public static final VclComboBox FilterValue1 = combobox("sc:ComboBox:RID_SCDLG_FILTER:ED_VAL1");
467
	public static final VclDialog StandardFilterDlg = dialog(".uno:DataFilterStandardFilter");
465
	
468
	
466
	
469
	
470
	
467
471
468
}
472
}

Return to issue 120700