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

(-)src/testcase/sc/validity/ValiditySampleFile.java (+116 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
package testcase.sc.validity;
25
26
import static testlib.AppUtil.submitOpenDlg;
27
import static testlib.AppUtil.testFile;
28
import static testlib.AppUtil.typeKeys;
29
import static testlib.UIMap.*;
30
import static org.junit.Assert.*;
31
import static org.openoffice.test.vcl.Tester.typeKeys;
32
import org.junit.After;
33
import org.junit.Before;
34
import org.junit.Rule;
35
import org.junit.Test;
36
import testlib.CalcUtil;
37
import testlib.Log;
38
39
public class ValiditySampleFile {
40
41
	@Rule
42
	public Log LOG = new Log();
43
44
	@Before
45
	public void setUp() throws Exception {
46
		app.start();
47
	}
48
49
	@After
50
	public void tearDown() throws Exception {
51
		app.close();
52
	}
53
54
	/**
55
	 * Test open MS 2003 spreadsheet with ignore blank validity.
56
	 * 
57
	 * @throws Exception
58
	 */
59
	@Test
60
	public void testFFCIgnoreBlank() throws Exception{
61
		// Open sample file
62
		String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls");
63
		app.dispatch(".uno:Open", 3);
64
		submitOpenDlg(file);
65
		calc.waitForExistence(10, 2);
66
67
		CalcUtil.selectRange("D5");
68
		SC_InputBar_Input.activate();
69
		for(int i=1;i<=10;i++)
70
			typeKeys("<backspace>");
71
		typeKeys("<enter>");
72
73
		assertEquals("",CalcUtil.getCellText("D5"));
74
	}
75
76
	/**
77
	 * Test open MS 2003 spreadsheet with ignore blank validity.
78
	 * 
79
	 * @throws Exception
80
	 */
81
	@Test
82
	public void testFFCNotIgnoreBlank() throws Exception{
83
		//open sample file
84
		String file = testFile("sc/FFC252FFCSC_XML_Datarange0205.xls");
85
		app.dispatch(".uno:Open", 3);
86
		submitOpenDlg(file);
87
		calc.waitForExistence(10, 2);
88
89
		CalcUtil.selectRange("F5");
90
		SC_InputBar_Input.activate();
91
		typeKeys("<backspace><enter>");
92
93
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
94
		ActiveMsgBox.ok();
95
		assertEquals("8",CalcUtil.getCellText("F5"));
96
	}
97
98
	/**
99
	 * test Cell is not locked after switch from validity cell to source cells
100
	 */
101
	@Test
102
	public void testNotLockCellFromValidityCell() {
103
		//open sample file on data path
104
		String file = testFile("sc/sampledata.ods");
105
		app.dispatch(".uno:Open", 3);
106
		submitOpenDlg(file);
107
		calc.waitForExistence(10, 2);
108
109
		CalcUtil.selectRange("Sheet1.F19");
110
		typeKeys("d<enter>");
111
		CalcUtil.selectRange("Sheet1.F17");
112
		typeKeys("Test<enter>");
113
114
		assertEquals("Test",CalcUtil.getCellText("F17"));
115
	}
116
}
(-)src/testcase/sc/validity/ValidityDialogSetting.java (+639 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
package testcase.sc.validity;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.io.File;
30
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
35
import org.junit.Before;
36
import org.junit.Rule;
37
import org.junit.Ignore;
38
import org.junit.Test;
39
import org.openoffice.test.vcl.IDList;
40
import org.openoffice.test.vcl.widgets.VclMessageBox;
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
46
public class ValidityDialogSetting {
47
	private static IDList idList = new IDList(new File("./ids"));
48
	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
49
50
	@Rule
51
	public Log LOG = new Log();
52
53
	@Before
54
	public void setUp() throws Exception {
55
		app.start();
56
57
		// New a spreadsheet, select cell range, open Validity dialog
58
		startcenter.menuItem("File->New->Spreadsheet").select();
59
		CalcUtil.selectRange("Sheet1.A1:C5");
60
		calc.menuItem("Data->Validity...").select();
61
	}
62
63
	@After
64
	public void tearDown() throws Exception {
65
		app.close();
66
	}
67
68
	/**
69
	 * test Allow not between Date type in Validity.
70
	 */
71
	@Test
72
	public void testAllowDateNotBetween() {
73
		SC_ValidityCriteriaTabpage.select();
74
		SC_ValidityCriteriaAllowList.select("Date");
75
		SC_ValidityDecimalCompareOperator.select("not between");
76
		SC_ValiditySourceInput.setText("01/01/08");
77
		SC_ValidityMaxValueInput.setText("03/01/08");
78
		SC_ValidityErrorAlertTabPage.select();
79
		SC_ValidityShowErrorMessage.check();
80
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
81
		SC_ValidityErrorMessage.setText("Invalid value");
82
		SC_ValidityErrorAlertTabPage.ok();
83
84
		CalcUtil.selectRange("Sheet1.A1");
85
		SC_InputBar_Input.activate();
86
		typeKeys("12/31/07");
87
		typeKeys("<enter>");
88
		assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1"));
89
90
		CalcUtil.selectRange("Sheet1.A2");
91
		SC_InputBar_Input.activate();
92
		typeKeys("03/02/08");
93
		typeKeys("<enter>");
94
		assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2"));
95
96
		CalcUtil.selectRange("Sheet1.A3");
97
		SC_InputBar_Input.activate();
98
		typeKeys("01/01/08");
99
		typeKeys("<enter>");
100
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
101
		ActiveMsgBox.ok();
102
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
103
104
		CalcUtil.selectRange("Sheet1.A4");
105
		SC_InputBar_Input.activate();
106
		typeKeys("03/01/08");
107
		typeKeys("<enter>");
108
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
109
		ActiveMsgBox.ok();
110
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
111
112
		CalcUtil.selectRange("Sheet1.A5");
113
		SC_InputBar_Input.activate();
114
		typeKeys("01/02/08");
115
		typeKeys("<enter>");
116
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
117
		ActiveMsgBox.ok();
118
		assertEquals("",CalcUtil.getCellText("Sheet1.A5"));
119
120
		CalcUtil.selectRange("Sheet1.B1");
121
		SC_InputBar_Input.activate();
122
		typeKeys("02/29/08");
123
		typeKeys("<enter>");
124
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
125
		ActiveMsgBox.ok();
126
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
127
128
		CalcUtil.selectRange("Sheet1.B2");
129
		SC_InputBar_Input.activate();
130
		typeKeys("test");
131
		typeKeys("<enter>");
132
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
133
		ActiveMsgBox.ok();
134
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
135
136
		CalcUtil.selectRange("Sheet1.B3");
137
		SC_InputBar_Input.activate();
138
		typeKeys("39448");
139
		typeKeys("<enter>");
140
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
141
		ActiveMsgBox.ok();
142
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
143
	}
144
145
	/**
146
	 * test Allow Decimal equal in Validity.
147
	 */
148
	@Test
149
	public void testAllowDecimalEqual() {
150
151
		SC_ValidityCriteriaTabpage.select();
152
		SC_ValidityCriteriaAllowList.select("Decimal");
153
		SC_ValidityDecimalCompareOperator.select("equal");
154
		SC_ValiditySourceInput.setText("0.33333333");
155
		SC_ValidityErrorAlertTabPage.select();
156
		SC_ValidityShowErrorMessage.check();
157
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
158
		SC_ValidityErrorMessage.setText("Invalid value");
159
		SC_ValidityErrorAlertTabPage.ok();
160
161
		CalcUtil.selectRange("Sheet1.A1");
162
		SC_InputBar_Input.activate();
163
		typeKeys("0.33333333");
164
		typeKeys("<enter>");
165
		assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A1"));
166
167
		CalcUtil.selectRange("Sheet1.A2");
168
		SC_InputBar_Input.activate();
169
		typeKeys("=1/3");
170
		typeKeys("<enter>");
171
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
172
		ActiveMsgBox.ok();
173
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
174
175
		CalcUtil.selectRange("Sheet1.A3");
176
		SC_InputBar_Input.activate();
177
		typeKeys("0.3");
178
		typeKeys("<enter>");
179
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
180
		ActiveMsgBox.ok();
181
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
182
183
		CalcUtil.selectRange("Sheet1.A4");
184
		SC_InputBar_Input.activate();
185
		typeKeys("0.333333333");
186
		typeKeys("<enter>");
187
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
188
		ActiveMsgBox.ok();
189
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
190
191
		CalcUtil.selectRange("Sheet1.B2");
192
		SC_InputBar_Input.activate();
193
		typeKeys("test");
194
		typeKeys("<enter>");
195
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
196
		ActiveMsgBox.ok();
197
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
198
	}
199
200
	/**
201
	 * test Allow Text length,  greater than or equal to  in Validity.
202
	 */
203
	@Test
204
	public void testAllowGreaterTextLength() {
205
206
		SC_ValidityCriteriaTabpage.select();
207
		SC_ValidityCriteriaAllowList.select("Text length");
208
		SC_ValidityDecimalCompareOperator.select("greater than or equal to");
209
		SC_ValiditySourceInput.setText("10");
210
		SC_ValidityErrorAlertTabPage.select();
211
		SC_ValidityShowErrorMessage.check();
212
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
213
		SC_ValidityErrorMessage.setText("Invalid value");
214
		SC_ValidityErrorAlertTabPage.ok();
215
216
		CalcUtil.selectRange("Sheet1.A1");
217
		SC_InputBar_Input.activate();
218
		typeKeys("testtesttesttest");
219
		typeKeys("<enter>");
220
		assertEquals("testtesttesttest",CalcUtil.getCellText("Sheet1.A1"));
221
222
		CalcUtil.selectRange("Sheet1.A2");
223
		SC_InputBar_Input.activate();
224
		typeKeys("test test ");
225
		typeKeys("<enter>");
226
		assertEquals("test test ",CalcUtil.getCellText("Sheet1.A2"));
227
228
		CalcUtil.selectRange("Sheet1.A4");
229
		SC_InputBar_Input.activate();
230
		typeKeys(" ");
231
		typeKeys("<enter>");
232
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
233
		ActiveMsgBox.ok();
234
		assertEquals("",CalcUtil.getCellText("Sheet1.A4"));
235
236
		CalcUtil.selectRange("Sheet1.A3");
237
		SC_InputBar_Input.activate();
238
		typeKeys("Testatest");
239
		typeKeys("<enter>");
240
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
241
		ActiveMsgBox.ok();
242
		assertEquals("",CalcUtil.getCellText("Sheet1.A3"));
243
	}
244
245
	/**
246
	 * test Allow Text length,  less than  in Validity.
247
	 */
248
	@Ignore("Bug 93128")
249
	public void testAllowLessThanTextLength() {
250
251
		calc.menuItem("Data->Validity...").select();
252
253
		SC_ValidityCriteriaTabpage.select();
254
		SC_ValidityCriteriaAllowList.select("Text length");
255
		SC_ValidityDecimalCompareOperator.select("less than");
256
		SC_ValiditySourceInput.setText("10");
257
258
		SC_ValidityInputHelpTabPage.select();
259
		SC_ValidityInputHelpCheckbox.check();
260
		SC_ValidityInputHelpTitle.setText("Help Info Title");
261
		SC_ValidityHelpMessage.setText("help info");
262
263
		SC_ValidityErrorAlertTabPage.select();
264
		SC_ValidityShowErrorMessage.check();
265
		SC_ValidityErrorAlertActionList.select("Information");
266
		SC_ValidityErrorMessageTitle.setText("Notes to enter");
267
		SC_ValidityErrorMessage.setText("Invalid value");
268
		SC_ValidityErrorAlertTabPage.ok();
269
270
		CalcUtil.selectRange("Sheet1.A1");
271
		SC_InputBar_Input.activate();
272
		typeKeys("testtesttesttest<enter>");
273
		ActiveMsgBox.ok();
274
		assertEquals("testtesttesttest",CalcUtil.getCellText("Sheet1.A1"));
275
276
		CalcUtil.selectRange("Sheet1.A2");
277
		SC_InputBar_Input.activate();
278
		typeKeys("sfsafsddddddd<enter>");
279
		ActiveMsgBox.cancel();
280
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
281
282
		CalcUtil.selectRange("Sheet1.A2");
283
		SC_InputBar_Input.activate();
284
		typeKeys("10<enter>");
285
		assertEquals("10",CalcUtil.getCellText("Sheet1.A2"));
286
287
		CalcUtil.selectRange("Sheet1.A3");
288
		SC_InputBar_Input.activate();
289
		typeKeys("ok<enter>");
290
		assertEquals("ok",CalcUtil.getCellText("Sheet1.A3"));
291
	}
292
293
	/**
294
	 * test Allow list.
295
	 */
296
	@Test
297
	public void testAllowListSpecialChar() {
298
299
		SC_ValidityCriteriaTabpage.select();
300
		SC_ValidityCriteriaAllowList.select("List");
301
		SC_ValidityEntries.focus();
302
		typeKeys("a");
303
		typeKeys("<enter>");
304
		typeKeys("b");
305
		SC_ValidityErrorAlertTabPage.select();
306
		SC_ValidityShowErrorMessage.check();
307
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
308
		SC_ValidityErrorMessage.setText("Invalid value");
309
		SC_ValidityCriteriaTabpage.select();
310
		SC_ValidityCriteriaTabpage.ok();
311
312
		calc.rightClick(1, 1);
313
		typeKeys("<shift s>");
314
		typeKeys("<down><enter>");	// Choose a
315
		assertEquals("a",CalcUtil.getCellText("Sheet1.A1"));
316
317
		CalcUtil.selectRange("Sheet1.B2");
318
		SC_InputBar_Input.activate();
319
		typeKeys("test");
320
		typeKeys("<enter>");
321
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
322
		ActiveMsgBox.ok();
323
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
324
	}
325
326
	/**
327
	 * test Allow time between  in Validity.
328
	 */
329
	@Test
330
	public void testAllowTimeBetween() {
331
332
		SC_ValidityCriteriaTabpage.select();
333
		SC_ValidityCriteriaAllowList.select("Time");
334
		SC_ValidityDecimalCompareOperator.select("between");
335
		SC_ValiditySourceInput.setText("27:00");
336
		SC_ValidityMaxValueInput.setText("21:00");
337
		SC_ValidityErrorAlertTabPage.select();
338
		SC_ValidityShowErrorMessage.check();
339
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
340
		SC_ValidityErrorMessage.setText("Invalid value");
341
		SC_ValidityErrorAlertTabPage.ok();
342
343
		CalcUtil.selectRange("Sheet1.A1");
344
		SC_InputBar_Input.activate();
345
		typeKeys("21:00");
346
		typeKeys("<enter>");
347
		assertEquals("09:00:00 PM",CalcUtil.getCellText("Sheet1.A1"));
348
349
		CalcUtil.selectRange("Sheet1.A2");
350
		SC_InputBar_Input.activate();
351
		typeKeys("27:00");
352
		typeKeys("<enter>");
353
		assertEquals("27:00:00",CalcUtil.getCellText("Sheet1.A2"));
354
355
		CalcUtil.selectRange("Sheet1.A3");
356
		SC_InputBar_Input.activate();
357
		typeKeys("1.125");
358
		typeKeys("<enter>");
359
		assertEquals("1.125",CalcUtil.getCellText("Sheet1.A3"));
360
361
		CalcUtil.selectRange("Sheet1.A4");
362
		SC_InputBar_Input.activate();
363
		typeKeys("0.875");
364
		typeKeys("<enter>");
365
		assertEquals("0.875",CalcUtil.getCellText("Sheet1.A4"));
366
367
		CalcUtil.selectRange("Sheet1.B1");
368
		SC_InputBar_Input.activate();
369
		typeKeys("03:00:01");
370
		typeKeys("<enter>");
371
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
372
		ActiveMsgBox.ok();
373
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
374
375
		CalcUtil.selectRange("Sheet1.B2");
376
		SC_InputBar_Input.activate();
377
		typeKeys("20:59:59");
378
		typeKeys("<enter>");
379
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
380
		ActiveMsgBox.ok();
381
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
382
383
		CalcUtil.selectRange("Sheet1.B3");
384
		SC_InputBar_Input.activate();
385
		typeKeys("1.126");
386
		typeKeys("<enter>");
387
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
388
		ActiveMsgBox.ok();
389
		assertEquals("",CalcUtil.getCellText("Sheet1.B3"));
390
391
		CalcUtil.selectRange("Sheet1.B4");
392
		SC_InputBar_Input.activate();
393
		typeKeys("0.874");
394
		typeKeys("<enter>");
395
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
396
		ActiveMsgBox.ok();
397
		assertEquals("",CalcUtil.getCellText("Sheet1.B4"));
398
399
		CalcUtil.selectRange("Sheet1.C1");
400
		SC_InputBar_Input.activate();
401
		typeKeys("test");
402
		typeKeys("<enter>");
403
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
404
		ActiveMsgBox.ok();
405
		assertEquals("",CalcUtil.getCellText("Sheet1.C1"));
406
407
		CalcUtil.selectRange("Sheet1.C2");
408
		SC_InputBar_Input.activate();
409
		typeKeys("24:00");
410
		typeKeys("<enter>");
411
		assertEquals("24:00:00",CalcUtil.getCellText("Sheet1.C2"));
412
413
		CalcUtil.selectRange("Sheet1.C3");
414
		SC_InputBar_Input.activate();
415
		typeKeys("12:00");
416
		typeKeys("<enter>");
417
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
418
		ActiveMsgBox.ok();
419
		assertEquals("",CalcUtil.getCellText("Sheet1.C3"));
420
	}
421
422
	/**
423
	 * test Allow time Greater than and equal to  in Validity.
424
	 */
425
	@Test
426
	public void testAllowTimeGreaterThan() {
427
428
		SC_ValidityCriteriaTabpage.select();
429
		SC_ValidityCriteriaAllowList.select("Time");
430
		SC_ValidityDecimalCompareOperator.select("greater than or equal to");
431
		SC_ValiditySourceInput.setText("8:00");
432
433
		SC_ValidityErrorAlertTabPage.select();
434
		SC_ValidityShowErrorMessage.check();
435
		SC_ValidityErrorAlertActionList.select("Warning");
436
437
		SC_ValidityErrorMessageTitle.setText("warning to enter");
438
		SC_ValidityErrorMessage.setText("Invalid value");
439
		SC_ValidityErrorAlertTabPage.ok();
440
441
		CalcUtil.selectRange("Sheet1.A1");
442
		SC_InputBar_Input.activate();
443
		typeKeys("7:30");
444
		typeKeys("<enter>");
445
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
446
		ActiveMsgBox.ok();
447
		assertEquals("07:30:00 AM",CalcUtil.getCellText("Sheet1.A1"));
448
449
		CalcUtil.selectRange("Sheet1.A2");
450
		SC_InputBar_Input.activate();
451
		typeKeys("6:00");
452
		typeKeys("<enter>");
453
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
454
		ActiveMsgBox.cancel();
455
		assertEquals("",CalcUtil.getCellText("Sheet1.A2"));
456
457
		CalcUtil.selectRange("Sheet1.A3");
458
		SC_InputBar_Input.activate();
459
		typeKeys("8:00");
460
		typeKeys("<enter>");
461
		assertEquals("08:00:00 AM",CalcUtil.getCellText("Sheet1.A3"));
462
	}
463
464
	/**
465
	 * test Allow whole number, less than or equal to in Validity.
466
	 */
467
	@Test
468
	public void testAllowWholeNumLessThan() {
469
470
		SC_ValidityCriteriaTabpage.select();
471
		SC_ValidityCriteriaAllowList.select("Whole Numbers");
472
		SC_ValidityDecimalCompareOperator.select("less than or equal");
473
		SC_ValiditySourceInput.setText("100");
474
		SC_ValidityErrorAlertTabPage.select();
475
		SC_ValidityShowErrorMessage.check();
476
		SC_ValidityErrorMessageTitle.setText("Stop to enter");
477
		SC_ValidityErrorMessage.setText("Invalid value");
478
		SC_ValidityErrorAlertTabPage.ok();
479
480
		CalcUtil.selectRange("Sheet1.A1");
481
		SC_InputBar_Input.activate();
482
		typeKeys("99");
483
		typeKeys("<enter>");
484
		assertEquals("99",CalcUtil.getCellText("Sheet1.A1"));
485
486
		CalcUtil.selectRange("Sheet1.A2");
487
		SC_InputBar_Input.activate();
488
		typeKeys("100");
489
		typeKeys("<enter>");
490
		assertEquals("100",CalcUtil.getCellText("Sheet1.A2"));
491
492
		CalcUtil.selectRange("Sheet1.B1");
493
		SC_InputBar_Input.activate();
494
		typeKeys("101");
495
		typeKeys("<enter>");
496
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
497
		ActiveMsgBox.ok();
498
		assertEquals("",CalcUtil.getCellText("Sheet1.B1"));
499
500
		CalcUtil.selectRange("Sheet1.B2");
501
		SC_InputBar_Input.activate();
502
		typeKeys("45.5");
503
		typeKeys("<enter>");
504
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
505
		ActiveMsgBox.ok();
506
		assertEquals("",CalcUtil.getCellText("Sheet1.B2"));
507
508
		CalcUtil.selectRange("Sheet1.C1");
509
		SC_InputBar_Input.activate();
510
		typeKeys("test");
511
		typeKeys("<enter>");
512
		assertEquals("Invalid value",ActiveMsgBox.getMessage());
513
		ActiveMsgBox.ok();
514
		assertEquals("",CalcUtil.getCellText("Sheet1.C1"));
515
	}
516
517
	/**
518
	 * test default message of Error Alert in Validity.
519
	 */
520
	@Test
521
	public void testDefaultErrorAlertMessage() {
522
523
		SC_ValidityCriteriaTabpage.select();
524
		SC_ValidityCriteriaAllowList.select("Decimal");
525
		SC_ValidityDecimalCompareOperator.select("equal");
526
		SC_ValiditySourceInput.setText("1");
527
528
		SC_ValidityErrorAlertTabPage.select();
529
		SC_ValidityShowErrorMessage.check();
530
		SC_ValidityErrorAlertActionList.select("Stop");
531
		SC_ValidityErrorAlertTabPage.ok();
532
533
		CalcUtil.selectRange("Sheet1.A1");
534
		SC_InputBar_Input.activate();
535
		typeKeys("13");
536
		typeKeys("<enter>");
537
		assertEquals("OpenOffice.org Calc",ActiveMsgBox.getCaption());
538
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
539
		ActiveMsgBox.ok();
540
		assertEquals("",CalcUtil.getCellText("Sheet1.A1"));
541
	}
542
543
	/**
544
	 * test uncheck Error Alert in Validity.
545
	 */
546
	@Test
547
	public void testUncheckErrorAlert() {
548
549
		SC_ValidityCriteriaTabpage.select();
550
		SC_ValidityCriteriaAllowList.select("Decimal");
551
		SC_ValidityDecimalCompareOperator.select("equal");
552
		SC_ValiditySourceInput.setText("1");
553
554
		SC_ValidityErrorAlertTabPage.select();
555
		SC_ValidityShowErrorMessage.uncheck();
556
		SC_ValidityErrorAlertActionList.select("Stop");
557
		SC_ValidityErrorAlertTabPage.ok();
558
559
		CalcUtil.selectRange("Sheet1.A1");
560
		SC_InputBar_Input.activate();
561
		typeKeys("13");
562
		typeKeys("<enter>");
563
		assertEquals("13",CalcUtil.getCellText("Sheet1.A1"));
564
	}
565
566
	/**
567
	 * test Cell range source picker in Validity. Input from Edit Box.
568
	 */
569
	@Test
570
	public void testValidityCellRangeSourcePicker() {
571
572
		SC_ValidityCriteriaTabpage.select();
573
		SC_ValidityCriteriaAllowList.select("Cell range");
574
		SC_ValiditySourcePicker.click();
575
		assertEquals(false,SC_ValidityCriteriaAllowList.exists());
576
		SC_ValiditySourceInput.setText("$Sheet1.$E$2:$G$5");
577
		SC_ValiditySourcePicker.click();
578
		assertEquals(true,SC_ValidityCriteriaAllowList.exists());
579
580
		SC_ValidityErrorAlertTabPage.select();
581
		SC_ValidityShowErrorMessage.check();
582
		SC_ValidityErrorAlertActionList.select("Stop");
583
		SC_ValidityErrorAlertTabPage.ok();
584
585
		// calc.focus();
586
		CalcUtil.selectRange("Sheet1.E2");
587
		SC_InputBar_Input.activate();
588
		typeKeys("test");
589
		typeKeys("<enter>");
590
591
		CalcUtil.selectRange("Sheet1.A1");
592
		SC_InputBar_Input.activate();
593
		typeKeys("test32");
594
		typeKeys("<enter>");
595
		assertEquals("Invalid value.",ActiveMsgBox.getMessage());
596
		ActiveMsgBox.ok();
597
		assertEquals("",CalcUtil.getCellText("Sheet1.A1"));		
598
599
		CalcUtil.selectRange("Sheet1.B1");
600
		SC_InputBar_Input.activate();
601
		typeKeys("test");
602
		typeKeys("<enter>");
603
		assertEquals("test",CalcUtil.getCellText("Sheet1.B1"));
604
	}
605
606
	/**
607
	 * test Allow Blank cell Checkbox in Validity.
608
	 */
609
	@Test
610
	public void testAllowBlankCells() {
611
		SC_ValidityCriteriaTabpage.select();
612
		SC_ValidityCriteriaAllowList.select("Cell range");
613
		SC_ValiditySourceInput.setText("$E$1:$E$5");
614
		SC_ValidityAllowBlankCells.check();
615
		SC_ValidityCriteriaTabpage.ok();
616
617
		CalcUtil.selectRange("Sheet1.E1");
618
		typeKeys("A<enter>A<enter>A<enter>A<enter>A<enter>");
619
620
		CalcUtil.selectRange("Sheet1.A1");
621
		typeKeys("A<enter>");
622
		CalcUtil.selectRange("Sheet1.D1");
623
		SC_InputBar_Input.activate();
624
		typeKeys("<backspace><enter>");
625
		assertEquals("",CalcUtil.getCellText("Sheet1.D1"));
626
627
		CalcUtil.selectRange("Sheet1.B1");
628
		calc.menuItem("Data->Validity...").select();
629
		SC_ValidityCriteriaTabpage.select();
630
		SC_ValidityAllowBlankCells.uncheck();
631
		typeKeys("<enter>");
632
633
		CalcUtil.selectRange("Sheet1.B1");
634
		SC_InputBar_Input.activate();
635
		typeKeys("<backspace><enter>");
636
		typeKeys("<enter>");
637
	}
638
}
639
(-)src/testcase/sc/chart/ChartDialogSetting.java (+83 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.sc.chart;
28
29
import static testlib.UIMap.*;
30
import org.junit.After;
31
import static org.junit.Assert.*;
32
import org.junit.Before;
33
import org.junit.Rule;
34
import org.junit.Test;
35
import testlib.Log;
36
37
/**
38
 * Test the setting about chart dialog in spreadsheet
39
 */
40
public class ChartDialogSetting {
41
42
	@Rule
43
	public Log LOG = new Log();
44
45
	@Before
46
	public void setUp() throws Exception {
47
		app.start();
48
49
		// Create a new spreadsheet document
50
		startcenter.menuItem("File->New->Spreadsheet").select();
51
	}
52
53
	@After
54
	public void tearDown() throws Exception {
55
		app.close();
56
	}
57
58
	/**
59
	 * Test cancel and back button in chart wizard dialog
60
	 * 
61
	 * @throws java.lang.Exception
62
	 */
63
	@Test
64
	public void testChartDialogCancelBack() {
65
		calc.menuItem("Insert->Chart...").select();
66
		WizardNextButton.click();
67
		assertTrue(ChartRangeChooseTabPage.isEnabled());
68
		WizardBackButton.click();
69
		assertTrue(ChartTypeChooseTabPage.isEnabled());
70
		Chart_Wizard.cancel();
71
		assertFalse(Chart_Wizard.exists());
72
	}
73
74
	/**
75
	 * Verify Chart Wizard dialog title words
76
	 */
77
	@Test
78
	public void testChartWizardTitle() {
79
		calc.menuItem("Insert->Chart...").select();
80
		assertEquals("Chart Wizard",Chart_Wizard.getText());
81
		Chart_Wizard.cancel();
82
	}
83
}
(-)src/testcase/sw/table/Table.java (+90 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.sw.table;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
import static org.junit.Assert.*;
32
import org.junit.After;
33
import org.junit.Before;
34
import org.junit.Rule;
35
import org.junit.Test;
36
import org.openoffice.test.common.SystemUtil;
37
38
import testlib.Log;
39
40
/**
41
 *
42
 */
43
public class Table {
44
45
	@Rule
46
	public Log LOG = new Log();
47
48
	@Before
49
	public void setUp() throws Exception {
50
		app.start();
51
	}
52
53
	@After
54
	public void tearDown() throws Exception {
55
		app.close();
56
	}
57
58
	/**
59
	 * Test convert table to text in text document
60
	 * @throws Exception
61
	 */
62
	@Test
63
	public void testConvertTableToText() throws Exception{
64
65
		//Create a new text document
66
		startcenter.menuItem("File->New->Text Document").select();
67
		sleep(3);
68
69
		// Insert a table and input some data
70
		writer.menuItem("Insert->Table...").select();
71
		writer_InsertTable.ok();
72
		writer.focus();
73
		typeKeys("1<right>2<right>3<right>4");
74
		sleep(1);
75
76
		// Convert table to text
77
		writer.menuItem("Table->Convert->Table to Text...").select();
78
		assertTrue("Convert Table to Text dialog pop up", writer_ConvertTableToTextDlg.exists());
79
		typeKeys("<enter>");
80
		sleep(1);
81
82
		// Verify if text is converted successfully
83
		writer.menuItem("Edit->Select All").select();
84
		app.dispatch(".uno:Copy");
85
		if (SystemUtil.isWindows())
86
			assertEquals("Converted text", "1\t2\r\n3\t4\r\n", app.getClipboard());	// windows�лس�������\r\n
87
		else
88
			assertEquals("Converted text", "1\t2\n3\t4\n", app.getClipboard());
89
	}
90
}
(-)src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java (+171 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.sd.headerandfooter;
28
29
import static testlib.AppUtil.fullPath;
30
import static testlib.AppUtil.openStartcenter;
31
import static testlib.AppUtil.submitSaveDlg;
32
import static testlib.AppUtil.submitOpenDlg;
33
import static testlib.AppUtil.testFile;
34
import static testlib.UIMap.*;
35
import static org.junit.Assert.*;
36
import static org.openoffice.test.vcl.Tester.*;
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.common.FileUtil;
42
import testlib.Log;
43
44
public class OpenDocumentWithHeaderFooter {
45
46
	@Rule
47
	public Log LOG = new Log();
48
49
	@Before
50
	public void setUp() throws Exception {
51
		app.start();
52
	}
53
54
	@After
55
	public void tearDown() throws Exception {
56
		app.close();
57
	}
58
59
	/**
60
	 * Test open AOO3.4 presentation with header and footer.
61
	 * edit and save to ODP
62
	 * @throws Exception
63
	 */
64
	@Test
65
	public void testOpenAOO34WithHeaderFooter() throws Exception{
66
		//open sample file
67
		String file = testFile("sd/AOO3.4HeaderFooter.odp");
68
		app.dispatch(".uno:Open");
69
		submitOpenDlg(file);
70
71
		//check after reopen		
72
		impress.menuItem("View->Header and Footer...").select();
73
		sleep(1);
74
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
75
		assertEquals("fixed date",SD_FixedDateAndTimeOnSlideInput.getText());
76
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
77
		assertEquals("footer test",SD_FooterTextOnSlideInput.getText());
78
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
79
80
		SD_SlideNumAsFooterOnSlide.uncheck();
81
		SD_ApplyToAllButtonOnSlideFooter.click();
82
83
		//save to odp and reopen
84
		impress.menuItem("File->Save As...").select();
85
		String saveTo2 = fullPath("temp/" + "AOO3.4HeaderFooter.odp");
86
		FileUtil.deleteFile(saveTo2);
87
		submitSaveDlg(saveTo2);	
88
		impress.menuItem("File->Close").select();
89
		sleep(1);
90
91
		openStartcenter();
92
		app.dispatch(".uno:Open");
93
		String openFrom2=fullPath("temp/" + "AOO3.4HeaderFooter.odp");
94
		submitOpenDlg(openFrom2);
95
96
		impress.menuItem("View->Header and Footer...").select();
97
		sleep(1);
98
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
99
		//end-save to odp and reopen
100
	}
101
102
	/**
103
	 * Test open ppt file with header and footer.
104
	 * edit and save to PPT/ODP
105
	 * @throws Exception
106
	 */
107
	@Test
108
	public void testOpenPPTWithHeaderFooter() throws Exception{
109
		//open sample file
110
		String file = testFile("sd/gfdd.ppt");
111
		app.dispatch(".uno:Open");
112
		submitOpenDlg(file);
113
114
		//check after reopen		
115
		impress.menuItem("View->Header and Footer...").select();
116
		sleep(1);
117
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
118
		assertEquals("testdte",SD_FixedDateAndTimeOnSlideInput.getText());
119
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
120
		assertEquals("yesy",SD_FooterTextOnSlideInput.getText());
121
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
122
123
		SD_SlideNumAsFooterOnSlide.uncheck();
124
		SD_ApplyToAllButtonOnSlideFooter.click();
125
126
		//save to ppt and reopen
127
		impress.menuItem("File->Save As...").select();
128
		String saveTo = fullPath("temp/" + "gfdd.ppt");
129
		FileUtil.deleteFile(saveTo);
130
		submitSaveDlg(saveTo);	
131
		if (AlienFormatDlg.exists(3))
132
			AlienFormatDlg.ok();
133
		sleep(1);
134
		impress.menuItem("File->Close").select();
135
		sleep(1);
136
137
		openStartcenter();
138
		app.dispatch(".uno:Open");
139
		String openFrom=fullPath("temp/" + "gfdd.ppt");
140
		submitOpenDlg(openFrom);
141
142
		impress.menuItem("View->Header and Footer...").select();
143
		sleep(1);
144
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
145
		//end-save to ppt and reopen
146
147
		//close Header and Footer dialog.
148
		SD_ApplyButtonOnSlideFooter.focus();
149
		typeKeys("<tab>");
150
		typeKeys("<enter>");
151
		//end
152
153
		//save to odp and reopen
154
		impress.menuItem("File->Save As...").select();
155
		String saveTo2 = fullPath("temp/" + "gfdd.odp");
156
		FileUtil.deleteFile(saveTo2);
157
		submitSaveDlg(saveTo2);	
158
		impress.menuItem("File->Close").select();
159
		sleep(1);
160
161
		openStartcenter();
162
		app.dispatch(".uno:Open");
163
		String openFrom2=fullPath("temp/" + "gfdd.odp");
164
		submitOpenDlg(openFrom2);
165
166
		impress.menuItem("View->Header and Footer...").select();
167
		sleep(1);
168
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
169
		//end-save to odp and reopen
170
	}
171
}
(-)src/testcase/sc/sort/SortDialogSetting.java (+1160 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.sc.sort;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
import static org.junit.Assert.*;
32
import static org.openoffice.test.vcl.Tester.*;
33
import org.junit.After;
34
import org.junit.Before;
35
import org.junit.Ignore;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.common.FileUtil;
39
import testlib.CalcUtil;
40
import testlib.Log;
41
42
/**
43
 * Test Data->Sort dialog setting
44
 */
45
public class SortDialogSetting {
46
47
	@Rule
48
	public Log LOG = new Log();
49
50
	@Before
51
	public void setUp() throws Exception {
52
		app.start();
53
54
		// Create a new spreadsheet document
55
		startcenter.menuItem("File->New->Spreadsheet").select();
56
	}
57
58
	@After
59
	public void tearDown() throws Exception {
60
		app.close();
61
	}
62
63
	/**
64
	 * Test sort with options setting: case sensitive 
65
	 * @throws Exception
66
	 */
67
	@Test
68
	public void testSortOptionsCaseSensitive() throws Exception{
69
70
		// Input some data: A1~A6: 1ColumnName,D,C,B,A,a
71
		String[][] data = new String[][] {
72
				{"D"},
73
				{"C"},
74
				{"B"},
75
				{"A"},
76
				{"a"},
77
		};
78
		String[][] expectedSortedResult = new String[][] {
79
				{"a"},
80
				{"A"},
81
				{"B"},
82
				{"C"},
83
				{"D"},
84
		};
85
		CalcUtil.selectRange("A1");
86
		typeKeys("1ColumnName<down>D<down>C<down>B<down>A<down>a<down>");
87
		CalcUtil.selectRange("A6");
88
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
89
90
		// "Data->Sort...", choose "Ascending", check "Case sensitive"
91
		calc.menuItem("Data->Sort...").select();
92
		SortOptionsPage.select();
93
		SortOptionsPage_CaseSensitive.check();
94
		SortOptionsPage.ok();		
95
96
		// Verify sorted result
97
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
98
99
		// Uodo/redo
100
		calc.menuItem("Edit->Undo: Sort").select();
101
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A2:A6"));
102
		calc.menuItem("Edit->Redo: Sort").select();
103
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
104
105
		// Save and close document
106
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCaseSensitive.ods");
107
		calc.menuItem("File->Save As...").select();
108
		FileUtil.deleteFile(saveTo);
109
		submitSaveDlg(saveTo);	
110
		calc.menuItem("File->Close").select();
111
		openStartcenter();
112
113
		// Reopen and verify sorted result
114
		startcenter.menuItem("File->Open...").select();
115
		submitOpenDlg(saveTo);
116
		calc.waitForExistence(10, 2);
117
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6"));
118
	}
119
120
	/**
121
	 * Test sort with options setting: copy sort result to
122
	 * @throws Exception
123
	 */
124
	@Ignore("Bug 119035")
125
	public void testSortOptionsCopyResultTo() throws Exception{
126
127
		// Input some data
128
		//		String[][] data = new String[][] {
129
		//				{"3", "D"},
130
		//				{"5", "FLK"},
131
		//				{"4", "E"},
132
		//				{"2", "BC"},
133
		//				{"6", "GE"},
134
		//				{"1", "AB"},
135
		//		};
136
		String[][] expectedSortedResult = new String[][] {
137
				{"1", "AB"},
138
				{"2", "BC"},
139
				{"3", "D"},
140
				{"4", "E"},
141
				{"5", "FLK"},
142
				{"6", "GE"},
143
		};
144
		CalcUtil.selectRange("A1");
145
		typeKeys("3<down>5<down>4<down>2<down>6<down>1");
146
		CalcUtil.selectRange("B1");
147
		typeKeys("D<down>FLK<down>E<down>BC<down>GE<down>AB");
148
149
		// Data->Sort..., choose "Ascending", check "Copy sort results to:"
150
		calc.menuItem("Data->Sort...").select();
151
		SortOptionsPage.select();
152
		SortOptionsPage_CopyResultTo.check();
153
		SortOptionsPage_CopyResultToEdit.setText("$Sheet3.$A4");
154
		SortOptionsPage.ok();
155
156
		// Verify sorted result
157
		assertArrayEquals("Copy sorted result to", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
158
159
		// Uodo/redo
160
		calc.menuItem("Edit->Undo: Sort").select();
161
		assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet3.$A4"));
162
		calc.menuItem("Edit->Redo: Sort").select();
163
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
164
165
		// Move focus to sheet2 then select a cell range, Insert->Names->Define...
166
		CalcUtil.selectRange("$Sheet2.$A1:$B3");
167
		calc.menuItem("Insert->Names->Define...").select();
168
		DefineNamesDlg_NameEdit.setText("cellRange");
169
		DefineNamesDlg.ok();
170
171
		// Set focus to the original data, Data->Sort...
172
		CalcUtil.selectRange("$Sheet1.$B1");
173
		calc.menuItem("Data->Sort...").select();
174
		SortOptionsPage.select();
175
		SortOptionsPage_CopyResultTo.check();
176
		SortOptionsPage_CopyResultToCellRange.select("cellRange");
177
		SortOptionsPage.ok();		
178
179
		// Verify sorted result
180
		assertArrayEquals("Copy sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
181
182
		// Uodo/redo
183
		calc.menuItem("Edit->Undo: Sort").select();
184
		assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet2.$A1"));
185
		calc.menuItem("Edit->Redo: Sort").select();
186
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
187
188
		// Save and close document
189
		String saveTo = fullPath("temp/" + "RowsSortWithOptionsCopyResultTo.ods");
190
		calc.menuItem("File->Save As...").select();
191
		FileUtil.deleteFile(saveTo);
192
		submitSaveDlg(saveTo);	
193
		calc.menuItem("File->Close").select();
194
		openStartcenter();
195
196
		// Reopen and verify sorted result
197
		startcenter.menuItem("File->Open...").select();
198
		submitOpenDlg(saveTo);
199
		calc.waitForExistence(10, 2);
200
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9"));
201
		assertArrayEquals("Saved sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6"));
202
	}
203
204
	/**
205
	 * Test sort criteria: sort first by
206
	 * @throws Exception
207
	 */
208
	@Test
209
	public void testSortCriteriaSortFirstBy() throws Exception{
210
211
		// Input some data
212
		String[][] data = new String[][] {
213
				{"3", "D"},
214
				{"5", "FLK"},
215
				{"4", "E"},
216
				{"2", "BC"},
217
				{"6", "GE"},
218
				{"1", "AB"},
219
		};
220
		String[][] expectedResultSortByColumnBAscending = new String[][] {
221
				{"1", "AB"},
222
				{"2", "BC"},
223
				{"3", "D"},
224
				{"4", "E"},
225
				{"5", "FLK"},
226
				{"6", "GE"},
227
		};
228
		String[][] expectedResultSortByColumnADescending = new String[][] {
229
				{"6", "GE"},
230
				{"5", "FLK"},
231
				{"4", "E"},
232
				{"3", "D"},
233
				{"2", "BC"},
234
				{"1", "AB"},
235
		};
236
		CalcUtil.selectRange("A1");
237
		typeKeys("3<down>5<down>4<down>2<down>6<down>1");
238
		CalcUtil.selectRange("B1");
239
		typeKeys("D<down>FLK<down>E<down>BC<down>GE<down>AB");
240
241
		// "Data->Sort...", choose "Ascending", sort first by Column B
242
		calc.menuItem("Data->Sort...").select();
243
		SortPage_Ascending1.check();
244
		SortPage_By1.select("Column B");
245
		SortPage.ok();
246
247
		// Verify sorted result
248
		assertArrayEquals("Sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6"));
249
250
		// Uodo/redo
251
		calc.menuItem("Edit->Undo: Sort").select();
252
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6"));
253
		calc.menuItem("Edit->Redo: Sort").select();
254
		assertArrayEquals("Redo sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6"));
255
		calc.menuItem("Edit->Undo: Sort").select();
256
257
		// Save and close document
258
		String saveTo = fullPath("temp/" + "SortCriteriaSortFirstBy.ods");
259
		calc.menuItem("File->Save As...").select();
260
		FileUtil.deleteFile(saveTo);
261
		submitSaveDlg(saveTo);	
262
		calc.menuItem("File->Close").select();
263
		openStartcenter();
264
265
		// Reopen, "Data->Sort...", choose "Descending", sort first by Column A
266
		startcenter.menuItem("File->Open...").select();
267
		submitOpenDlg(saveTo);
268
		calc.waitForExistence(10, 2);
269
		calc.menuItem("Data->Sort...").select();
270
		SortPage_Descending1.check();
271
		SortPage_By1.select("Column A");
272
		SortPage.ok();		
273
274
		// Verify sorted result
275
		assertArrayEquals("Saved sorted result", expectedResultSortByColumnADescending, CalcUtil.getCellTexts("A1:B6"));
276
	}	
277
278
	/**
279
	 * Test sort criteria: sort second by
280
	 * @throws Exception
281
	 */
282
	@Test
283
	public void testSortCriteriaSortSecondBy() throws Exception{
284
285
		// Input some data
286
		String[][] data = new String[][] {
287
				{"3", "D"},
288
				{"5", "FLK"},
289
				{"4", "E"},
290
				{"1", "AB"},
291
				{"6", "GE"},
292
				{"2", "AB"},
293
		};
294
		String[][] expectedResultSortFirstByB = new String[][] {
295
				{"1", "AB"},
296
				{"2", "AB"},
297
				{"3", "D"},
298
				{"4", "E"},
299
				{"5", "FLK"},
300
				{"6", "GE"},
301
		};
302
		String[][] expectedResultSortSecondByA= new String[][] {
303
				{"2", "AB"},
304
				{"1", "AB"},
305
				{"3", "D"},
306
				{"4", "E"},
307
				{"5", "FLK"},
308
				{"6", "GE"},
309
		};
310
		CalcUtil.selectRange("A1");
311
		typeKeys("3<down>5<down>4<down>1<down>6<down>2");
312
		CalcUtil.selectRange("B1");
313
		typeKeys("D<down>FLK<down>E<down>AB<down>GE<down>AB");
314
315
		// "Data->Sort...", choose "Ascending", sort first by Column B
316
		calc.menuItem("Data->Sort...").select();
317
		SortPage_Ascending1.check();
318
		SortPage_By1.select("Column B");
319
		SortPage.ok();
320
321
		// Verify sorted result
322
		assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6"));
323
324
		// Uodo/redo
325
		calc.menuItem("Edit->Undo: Sort").select();
326
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6"));
327
		calc.menuItem("Edit->Redo: Sort").select();
328
		assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6"));
329
		calc.menuItem("Edit->Undo: Sort").select();
330
331
		// Save and close document
332
		String saveTo = fullPath("temp/" + "SortCriteriaSortSecondBy.ods");
333
		calc.menuItem("File->Save As...").select();
334
		FileUtil.deleteFile(saveTo);
335
		submitSaveDlg(saveTo);	
336
		calc.menuItem("File->Close").select();
337
		openStartcenter();
338
339
		// Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column A "Descending"
340
		startcenter.menuItem("File->Open...").select();
341
		submitOpenDlg(saveTo);
342
		calc.waitForExistence(10, 2);
343
		calc.menuItem("Data->Sort...").select();
344
		SortPage_By1.select("Column B");
345
		SortPage_Ascending1.check();
346
		SortPage_By2.select("Column A");
347
		SortPage_Descending2.check();
348
		SortPage.ok();
349
350
		// Verify sorted result
351
		assertArrayEquals("Saved sorted result", expectedResultSortSecondByA, CalcUtil.getCellTexts("A1:B6"));
352
	}	
353
354
	/**
355
	 * Test sort criteria: sort third by
356
	 * @throws Exception
357
	 */
358
	@Test
359
	public void testSortCriteriaSortThirdBy() throws Exception{
360
361
		// Input some data
362
		String[][] data = new String[][] {
363
				{"3", "AB", "2"},
364
				{"8", "FLK", "5"},
365
				{"6", "E", "4"},
366
				{"1", "AB", "1"},
367
				{"9", "GE", "6"},
368
				{"2", "AB", "2"},
369
				{"7", "EFYU", "7"},
370
				{"5", "DS", "8"},
371
				{"4", "AB", "1"},
372
		};
373
		String[][] expectedResultSortFirstByB = new String[][] {
374
				{"3", "AB", "2"},
375
				{"1", "AB", "1"},
376
				{"2", "AB", "2"},
377
				{"4", "AB", "1"},
378
				{"5", "DS", "8"},
379
				{"6", "E", "4"},
380
				{"7", "EFYU", "7"},
381
				{"8", "FLK", "5"},
382
				{"9", "GE", "6"},
383
		};
384
		String[][] expectedResultSortSecondByC= new String[][] {
385
				{"3", "AB", "2"},
386
				{"2", "AB", "2"},
387
				{"1", "AB", "1"},
388
				{"4", "AB", "1"},
389
				{"5", "DS", "8"},
390
				{"6", "E", "4"},
391
				{"7", "EFYU", "7"},
392
				{"8", "FLK", "5"},
393
				{"9", "GE", "6"},
394
		};
395
		String[][] expectedResultSortThirdByA= new String[][] {
396
				{"3", "AB", "2"},
397
				{"2", "AB", "2"},
398
				{"4", "AB", "1"},
399
				{"1", "AB", "1"},
400
				{"5", "DS", "8"},
401
				{"6", "E", "4"},
402
				{"7", "EFYU", "7"},
403
				{"8", "FLK", "5"},
404
				{"9", "GE", "6"},
405
		};
406
		CalcUtil.selectRange("A1");
407
		typeKeys("3<down>8<down>6<down>1<down>9<down>2<down>7<down>5<down>4");
408
		CalcUtil.selectRange("B1");
409
		typeKeys("AB<down>FLK<down>E<down>AB<down>GE<down>AB<down>EFYU<down>DS<down>AB");
410
		CalcUtil.selectRange("C1");
411
		typeKeys("2<down>5<down>4<down>1<down>6<down>2<down>7<down>8<down>1");
412
		sleep(0.5);
413
414
		// "Data->Sort...", choose "Ascending", sort first by Column B
415
		calc.menuItem("Data->Sort...").select();
416
		SortPage_By1.select("Column B");
417
		SortPage_Ascending1.check();
418
		SortPage.ok();
419
420
		// Verify sorted result
421
		assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9"));
422
423
		// Uodo/redo
424
		calc.menuItem("Edit->Undo: Sort").select();
425
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:C9"));
426
		calc.menuItem("Edit->Redo: Sort").select();
427
		assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9"));
428
		calc.menuItem("Edit->Undo: Sort").select();
429
430
		// Save and close document
431
		String saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy.ods");
432
		calc.menuItem("File->Save As...").select();
433
		FileUtil.deleteFile(saveTo);
434
		submitSaveDlg(saveTo);	
435
		calc.menuItem("File->Close").select();
436
		openStartcenter();
437
438
		// Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending"
439
		startcenter.menuItem("File->Open...").select();
440
		submitOpenDlg(saveTo);
441
		calc.waitForExistence(10, 2);
442
		calc.menuItem("Data->Sort...").select();
443
		SortPage_By1.select("Column B");
444
		SortPage_Ascending1.check();
445
		SortPage_By2.select("Column C");
446
		SortPage_Descending2.check();
447
		SortPage.ok();
448
449
		// Verify sorted result
450
		assertArrayEquals("Sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9"));
451
452
		// "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending", sort third by Column A "Descending"
453
		calc.menuItem("Data->Sort...").select();
454
		SortPage_By1.select("Column B");
455
		SortPage_Ascending1.check();
456
		SortPage_By2.select("Column C");
457
		SortPage_Descending2.check();
458
		SortPage_By3.select("Column A");
459
		SortPage_Descending3.check();
460
		SortPage.ok();
461
462
		// Verify sorted result
463
		assertArrayEquals("Sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));	
464
465
		// Uodo/redo
466
		calc.menuItem("Edit->Undo: Sort").select();
467
		assertArrayEquals("Undo sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9"));
468
		calc.menuItem("Edit->Redo: Sort").select();
469
		assertArrayEquals("Redo sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));
470
471
		// Save and close document
472
		saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy1.ods");
473
		calc.menuItem("File->Save As...").select();
474
		FileUtil.deleteFile(saveTo);
475
		submitSaveDlg(saveTo);	
476
		calc.menuItem("File->Close").select();
477
		openStartcenter();
478
479
		// Reopen and verify data sort is not lost
480
		startcenter.menuItem("File->Open...").select();
481
		submitOpenDlg(saveTo);
482
		calc.waitForExistence(10, 2);
483
		assertArrayEquals("Saved sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9"));	
484
	}	
485
486
	/**
487
	 * Test sort options: custom sort order, predefined in preferences from copy list
488
	 * @throws Exception
489
	 */
490
	@Test
491
	public void testSortOptionsCustomSortOrderPredefineFromCopyList() throws Exception{
492
493
		// Dependencies start
494
		CalcUtil.selectRange("A1");
495
		typeKeys("red<down>yellow<down>blue<down>green<down>white<down>black");
496
		CalcUtil.selectRange("A1:A6");
497
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
498
499
		// Select the cell range, "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists"
500
		CalcUtil.selectRange("A1:A6");
501
		app.dispatch(".uno:OptionsTreeDialog");
502
		// Select "Sort Lists": start. Shrink the tree list and select
503
		OptionsDlgList.select(0);
504
		typeKeys("<left>");
505
		for (int i=0; i<6; i++) {
506
			typeKeys("<down><left>");	
507
		}
508
		OptionsDlgList.select(3);
509
		typeKeys("<right>");
510
		OptionsDlgList.select(7);
511
		// Select "Sort Lists": end
512
513
		// Click "Copy" button, "OK", close the document		
514
		OptionsDlg_SortListsTabCopy.click();
515
		OptionsDlg.ok();
516
		calc.menuItem("File->Close").select();
517
		MsgBox_AdditionalRowsNotSaved.no();
518
		// Dependencies end
519
520
		// Create a new spreadsheet document
521
		startcenter.menuItem("File->New->Spreadsheet").select();
522
523
		// Input some data
524
		String[][] data = new String[][] {
525
				{"Color"},
526
				{"black"},
527
				{"yellow"},
528
				{"blue"},
529
				{"black"},
530
				{"white"},
531
				{"red"},
532
		};
533
		String[][] expectedResultNoCustomSortOrder = new String[][] {
534
				{"Color"},
535
				{"black"},
536
				{"black"},
537
				{"blue"},
538
				{"red"},
539
				{"white"},
540
				{"yellow"},
541
		};
542
		String[][] expectedResultCustomSortOrder = new String[][] {
543
				{"Color"},
544
				{"red"},
545
				{"yellow"},
546
				{"blue"},
547
				{"white"},
548
				{"black"},
549
				{"black"},
550
		};
551
		CalcUtil.selectRange("A1");
552
		typeKeys("Color<down>black<down>yellow<down>blue<down>black<down>white<down>red");
553
		CalcUtil.selectRange("A2:A7");
554
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
555
556
		// "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color
557
		CalcUtil.selectRange("A1:A7");
558
		calc.menuItem("Data->Sort...").select();
559
		SortOptionsPage.select();
560
		SortOptionsPage_RangeContainsColumnLabels.check();
561
		SortOptionsPage_CustomSortOrder.uncheck();
562
		SortPage.select();
563
		SortPage_By1.select("Color");
564
		SortPage_Ascending1.check();
565
		SortPage.ok();	
566
567
		// Verify sorted result
568
		assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
569
570
		// Uodo/redo
571
		calc.menuItem("Edit->Undo: Sort").select();
572
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
573
		calc.menuItem("Edit->Redo: Sort").select();
574
		assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
575
		calc.menuItem("Edit->Undo: Sort").select();
576
577
		// Copy original data to sheet2
578
		CalcUtil.selectRange("A1:A7");
579
		calc.menuItem("Edit->Copy").select();
580
		CalcUtil.selectRange("Sheet2.A1");
581
		calc.menuItem("Edit->Paste").select();		
582
583
		// "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color
584
		calc.menuItem("Data->Sort...").select();
585
		SortOptionsPage.select();
586
		SortOptionsPage_RangeContainsColumnLabels.check();
587
		SortOptionsPage_CustomSortOrder.check();
588
		SortOptionsPage_CustomSortOrderList.select("red,yellow,blue,green,white,black");
589
		SortPage.select();
590
		SortPage_By1.select("Color");
591
		SortPage_Ascending1.check();
592
		SortPage.ok();	
593
594
		// Verify sorted result
595
		assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
596
597
		// Uodo/redo
598
		calc.menuItem("Edit->Undo: Sort").select();
599
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
600
		calc.menuItem("Edit->Redo: Sort").select();
601
		assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
602
603
		// Save and close document
604
		String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromCopyList.ods");
605
		calc.menuItem("File->Save As...").select();
606
		FileUtil.deleteFile(saveTo);
607
		submitSaveDlg(saveTo);	
608
		calc.menuItem("File->Close").select();
609
		openStartcenter();
610
611
		// Reopen and verify sorted result
612
		startcenter.menuItem("File->Open...").select();
613
		submitOpenDlg(saveTo);
614
		calc.waitForExistence(10, 2);
615
		assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
616
		assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
617
	}	
618
619
	/**
620
	 * Test sort options: custom sort order, predefined in preferences from new list
621
	 * @throws Exception
622
	 */
623
	@Test
624
	public void testSortOptionsCustomSortOrderPredefineFromNewList() throws Exception{
625
626
		// Dependencies start
627
		// "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists"
628
		app.dispatch(".uno:OptionsTreeDialog");
629
		// Select "Sort Lists": start. Shrink the tree list and select
630
		OptionsDlgList.select(0);
631
		typeKeys("<left>");
632
		for (int i=0; i<6; i++) {
633
			typeKeys("<down><left>");	
634
		}
635
		OptionsDlgList.select(3);
636
		typeKeys("<right>");
637
		OptionsDlgList.select(7);
638
		// Select "Sort Lists": end
639
640
		// Click "New" button, input "white,red,yellow,blue,green,black", press "Add" and "OK", close the document		
641
		OptionsDlg_SortListsTabNew.click();
642
		typeKeys("white,red,yellow,blue,green,black");
643
		OptionsDlg_SortListsTabAdd.click();
644
		sleep(0.5);
645
		OptionsDlg.ok();
646
		calc.menuItem("File->Close").select();
647
		// Dependencies end
648
649
		// Create a new spreadsheet document
650
		startcenter.menuItem("File->New->Spreadsheet").select();
651
		sleep(3);
652
653
		// Input some data
654
		String[][] data = new String[][] {
655
				{"Color"},
656
				{"black"},
657
				{"yellow"},
658
				{"blue"},
659
				{"black"},
660
				{"white"},
661
				{"red"},
662
		};
663
		String[][] expectedResultNoCustomSortOrder = new String[][] {
664
				{"Color"},
665
				{"black"},
666
				{"black"},
667
				{"blue"},
668
				{"red"},
669
				{"white"},
670
				{"yellow"},
671
		};
672
		String[][] expectedResultCustomSortOrder = new String[][] {
673
				{"Color"},
674
				{"white"},
675
				{"red"},
676
				{"yellow"},
677
				{"blue"},
678
				{"black"},
679
				{"black"},
680
		};
681
		CalcUtil.selectRange("A1");
682
		typeKeys("Color<down>black<down>yellow<down>blue<down>black<down>white<down>red");
683
		CalcUtil.selectRange("A2:A7");
684
		app.dispatch(".uno:ChangeCaseToLower");	// In case SC capitalize first letter automatically
685
686
		// "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color
687
		CalcUtil.selectRange("A1:A7");
688
		calc.menuItem("Data->Sort...").select();
689
		SortOptionsPage.select();
690
		SortOptionsPage_RangeContainsColumnLabels.check();
691
		SortOptionsPage_CustomSortOrder.uncheck();
692
		SortPage.select();
693
		SortPage_By1.select("Color");
694
		SortPage_Ascending1.check();
695
		SortPage.ok();	
696
697
		// Verify sorted result
698
		assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
699
700
		// Uodo/redo
701
		calc.menuItem("Edit->Undo: Sort").select();
702
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
703
		calc.menuItem("Edit->Redo: Sort").select();
704
		assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
705
		calc.menuItem("Edit->Undo: Sort").select();
706
707
		// Copy original data to sheet2
708
		CalcUtil.selectRange("A1:A7");
709
		calc.menuItem("Edit->Copy").select();
710
		CalcUtil.selectRange("Sheet2.A1");
711
		calc.menuItem("Edit->Paste").select();		
712
713
		// "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color
714
		calc.menuItem("Data->Sort...").select();
715
		SortOptionsPage.select();
716
		SortOptionsPage_RangeContainsColumnLabels.check();
717
		SortOptionsPage_CustomSortOrder.check();
718
		SortOptionsPage_CustomSortOrderList.select("white,red,yellow,blue,green,black");
719
		SortPage.select();
720
		SortPage_By1.select("Color");
721
		SortPage_Ascending1.check();
722
		SortPage.ok();	
723
724
		// Verify sorted result
725
		assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
726
727
		// Uodo/redo
728
		calc.menuItem("Edit->Undo: Sort").select();
729
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7"));
730
		calc.menuItem("Edit->Redo: Sort").select();
731
		assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7"));
732
733
		// Save and close document
734
		String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromNewList.ods");
735
		calc.menuItem("File->Save As...").select();
736
		FileUtil.deleteFile(saveTo);
737
		submitSaveDlg(saveTo);	
738
		calc.menuItem("File->Close").select();
739
		openStartcenter();
740
741
		// Reopen and verify sorted result
742
		startcenter.menuItem("File->Open...").select();
743
		submitOpenDlg(saveTo);
744
		calc.waitForExistence(10, 2);
745
		assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
746
		assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
747
	}	
748
749
	/**
750
	 * Test sort options: sort columns, direction "Left to right"
751
	 * @throws Exception
752
	 */
753
	@Test
754
	public void testSortOptionsDirectionSortColumns() throws Exception{
755
756
		// Input some data
757
		String[][] data = new String[][] {
758
				{"Units", "7", "27", "4", "12", "3", "6"},
759
		};
760
		String[][] expectedSortedResult = new String[][] {
761
				{"Units", "3", "4", "6", "7", "12", "27"},
762
		};
763
		CalcUtil.selectRange("A1");
764
		typeKeys("Units<right>7<right>27<right>4<right>12<right>3<right>6");
765
766
		// "Data->Sort...", check "Range contains column labels", "Left to right", sort first by"Units", "Ascending"
767
		calc.menuItem("Data->Sort...").select();
768
		SortOptionsPage.select();
769
		SortOptionsPage_RangeContainsColumnLabels.check();
770
		SortOptionsPage_LeftToRight.check();
771
		SortPage.select();
772
		SortPage_By1.select("Units");
773
		SortPage_Ascending1.check();
774
		SortPage.ok();		
775
776
		// Verify sorted result
777
		assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
778
779
		// Uodo/redo
780
		calc.menuItem("Edit->Undo: Sort").select();
781
		assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:G1"));
782
		calc.menuItem("Edit->Redo: Sort").select();
783
		assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
784
785
		// Save and close document
786
		String saveTo = fullPath("temp/" + "SortOptionsDirectionSortColumns.ods");
787
		calc.menuItem("File->Save As...").select();
788
		FileUtil.deleteFile(saveTo);
789
		submitSaveDlg(saveTo);	
790
		calc.menuItem("File->Close").select();
791
		openStartcenter();
792
793
		// Reopen and verify sorted result
794
		startcenter.menuItem("File->Open...").select();
795
		submitOpenDlg(saveTo);
796
		calc.waitForExistence(10, 2);
797
		assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1"));
798
	}
799
800
	/**
801
	 * Test sort options: "Include formats"
802
	 * @throws Exception
803
	 */
804
	@Test
805
	public void testSortOptionsIncludeFormats() throws Exception{
806
807
		// Create a new spreadsheet document
808
809
		String[][] dataWithCurrencyFormats = new String[][] {
810
				{"Units"},
811
				{"$32.00"},
812
				{"57.00 \u20ac"},
813
				{"\u20a4 74"},
814
				{"R$ 50.00"},
815
				{"\u062c.\u0645. 27"},
816
				{"7.00 \u0440\u0443\u0431"},
817
		};
818
		String[][] expectedSortedResultIncludeFormat = new String[][] {
819
				{"Units"},
820
				{"7.00 \u0440\u0443\u0431"},
821
				{"\u062c.\u0645. 27"},
822
				{"$32.00"},
823
				{"R$ 50.00"},
824
				{"57.00 \u20ac"},
825
				{"\u20a4 74"},
826
		};
827
		String[][] expectedSortedResultExcludeFormat = new String[][] {
828
				{"Units"},
829
				{"$7.00"},
830
				{"27.00 \u20ac"},
831
				{"\u20a4 32"},
832
				{"R$ 50.00"},
833
				{"\u062c.\u0645. 57"},
834
				{"74.00 \u0440\u0443\u0431"},
835
		};
836
837
		// Input source data
838
		String file = testFile("sc/SortOptionsIncludeFormats.ods");
839
		//		String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls");
840
		app.dispatch(".uno:Open", 3);
841
		submitOpenDlg(file);
842
		calc.waitForExistence(10, 2);
843
844
		assertArrayEquals("source", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
845
846
		//		CalcUtil.selectRange("A1");
847
		//		typeKeys("Units<down>$32.00<down>57.00 \u20ac<down>\u20a4 74<down>R$ 50.00<down>\u062c.\u0645. 27.00<down>7.00 \u0440\u0443\u0431.");
848
849
		//		// Set Currency formats
850
		//		CalcUtil.selectRange("A2");
851
		//		typeKeys("<ctrl 1>");
852
		////		calc.menuItem("Fortmat->Cells...").select(); error: can not find item "Format"
853
		//		FormatCellsDlg_NumbersPage.select();
854
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
855
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("$ English (USA)");
856
		//		FormatCellsDlg_NumbersPage.ok();
857
		//		CalcUtil.selectRange("A3");
858
		//		typeKeys("<ctrl 1>");
859
		//		FormatCellsDlg_NumbersPage.select();
860
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
861
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20ac Spanish (Spain)");
862
		//		FormatCellsDlg_NumbersPage.ok();
863
		//		CalcUtil.selectRange("A4");
864
		//		typeKeys("<ctrl 1>");
865
		//		FormatCellsDlg_NumbersPage.select();
866
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
867
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20a4 Latin");
868
		//		FormatCellsDlg_NumbersPage.ok();		
869
		//		CalcUtil.selectRange("A5");
870
		//		typeKeys("<ctrl 1>");
871
		//		FormatCellsDlg_NumbersPage.select();
872
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
873
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("R$ Portuguese (Brazil)");
874
		//		FormatCellsDlg_NumbersPage.ok();	
875
		//		CalcUtil.selectRange("A6");
876
		//		typeKeys("<ctrl 1>");
877
		//		FormatCellsDlg_NumbersPage.select();
878
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
879
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u062c.\u0645. Arabic (Egypt)");
880
		//		FormatCellsDlg_NumbersPage.ok();	
881
		//		CalcUtil.selectRange("A7");
882
		//		typeKeys("<ctrl 1>");
883
		//		FormatCellsDlg_NumbersPage.select();
884
		//		FormatCellsDlg_NumbersPageCategory.select("Currency");
885
		//		FormatCellsDlg_NumbersPageCurrencyFormat.select("\u0440\u0443\u0431. Russian");
886
		//		FormatCellsDlg_NumbersPage.ok();	
887
888
		// "Data->Sort...", check "Range contains column labels", check "Include formats", sort first by "Units", "Ascending"
889
		calc.menuItem("Data->Sort...").select();
890
		SortOptionsPage.select();
891
		SortOptionsPage_RangeContainsColumnLabels.check();
892
		SortOptionsPage_IncludeFormats.check();
893
		SortPage.select();
894
		SortPage_By1.select("Units");
895
		SortPage_Ascending1.check();
896
		SortPage.ok();		
897
898
		// Verify sorted result
899
		assertArrayEquals("Sorted result include formats", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7"));
900
901
		// Uodo/redo
902
		calc.menuItem("Edit->Undo: Sort").select();
903
		assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
904
		calc.menuItem("Edit->Redo: Sort").select();
905
		assertArrayEquals("Redo sorted result", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7"));
906
		calc.menuItem("Edit->Undo: Sort").select();
907
908
		// Copy the original data to sheet2
909
		CalcUtil.selectRange("A1:A7");
910
		calc.menuItem("Edit->Copy").select();
911
		CalcUtil.selectRange("Sheet2.A1");
912
		calc.menuItem("Edit->Paste").select();		
913
914
		// "Data->Sort...", check "Range contains column labels", uncheck "Include formats", sort first by "Units", "Ascending"
915
		calc.menuItem("Data->Sort...").select();
916
		SortOptionsPage.select();
917
		SortOptionsPage_RangeContainsColumnLabels.check();
918
		SortOptionsPage_IncludeFormats.uncheck();
919
		SortPage.select();
920
		SortPage_By1.select("Units");
921
		SortPage_Ascending1.check();
922
		SortPage.ok();		
923
924
		// Verify sorted result
925
		assertArrayEquals("Sorted result exclude formats", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7"));	
926
927
		// Uodo/redo
928
		calc.menuItem("Edit->Undo: Sort").select();
929
		assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7"));
930
		calc.menuItem("Edit->Redo: Sort").select();
931
		assertArrayEquals("Redo sorted result", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7"));
932
933
		// Save and close document
934
		String saveTo = fullPath("temp/" + "SortOptionsIncludeFormats.ods");
935
		calc.menuItem("File->Save As...").select();
936
		FileUtil.deleteFile(saveTo);
937
		submitSaveDlg(saveTo);	
938
		calc.menuItem("File->Close").select();
939
		openStartcenter();
940
941
		// Reopen and verify sorted result
942
		startcenter.menuItem("File->Open...").select();
943
		submitOpenDlg(saveTo);
944
		calc.waitForExistence(10, 2);
945
		assertArrayEquals("Original data", dataWithCurrencyFormats, CalcUtil.getCellTexts("$Sheet1.$A1:$A7"));
946
		assertArrayEquals("Saved sorted result exclude format", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("$Sheet2.$A1:$A7"));
947
	}
948
949
	/**
950
	 * Test sort options: multiple sort, data overlap
951
	 * @throws Exception
952
	 */
953
	@Test
954
	public void testSortOptionsMultipleSortDataOverlap() throws Exception{
955
956
		// Input some data
957
		String[][] data1 = new String[][] {
958
				{"D"},
959
				{"C"},
960
				{"B"},
961
				{"A"},
962
				{"E"},
963
		};
964
		String[][] expectedSortedResult1 = new String[][] {
965
				{"A"},
966
				{"B"},
967
				{"C"},
968
				{"D"},
969
				{"E"},
970
		};
971
		String[][] data2 = new String[][] {
972
				{"4"},
973
				{"2"},
974
				{"5"},
975
				{"1"},
976
				{"3"},
977
		};
978
		String[][] expectedSortedResultDataOverlap = new String[][] {
979
				{"A"},
980
				{"B"},
981
				{"C"},
982
				{"1"},
983
				{"2"},
984
				{"3"},
985
				{"4"},
986
				{"5"},
987
		};
988
		CalcUtil.selectRange("A1");
989
		typeKeys("D<down>C<down>B<down>A<down>E");
990
991
		// "Data->Sort...", uncheck "Range contains column labels", sort first by "Column A", "Ascending"
992
		calc.menuItem("Data->Sort...").select();
993
		SortOptionsPage.select();
994
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
995
		SortPage.select();
996
		SortPage_By1.select("Column A");
997
		SortPage_Ascending1.check();
998
		SortPage.ok();		
999
1000
		// Verify sorted result
1001
		assertArrayEquals("Sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1002
1003
		// Uodo/redo
1004
		calc.menuItem("Edit->Undo: Sort").select();
1005
		assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5"));
1006
		calc.menuItem("Edit->Redo: Sort").select();
1007
		assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1008
1009
		// Input data2 into same sheet, data1 and data2 are not overlapped
1010
		CalcUtil.selectRange("G10");
1011
		typeKeys("4<down>2<down>5<down>1<down>3");
1012
1013
		// Focus on data2, "Data->Sort...", "Copy result to" partially overlap with data1, sort first by "Column G", "Ascending"
1014
		CalcUtil.selectRange("G10");
1015
		calc.menuItem("Data->Sort...").select();
1016
		SortOptionsPage.select();
1017
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
1018
		SortOptionsPage_CopyResultTo.check();
1019
		SortOptionsPage_CopyResultToEdit.setText("A4");
1020
		SortPage.select();
1021
		SortPage_By1.select("Column G");
1022
		SortPage_Ascending1.check();
1023
		SortPage.ok();			
1024
1025
		// Verify sorted result
1026
		assertArrayEquals("Sorted result data overlap", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8"));
1027
1028
		// Save and close document
1029
		String saveTo = fullPath("temp/" + "SortOptionsMultipleSortDataOverlap.ods");
1030
		calc.menuItem("File->Save As...").select();
1031
		FileUtil.deleteFile(saveTo);
1032
		submitSaveDlg(saveTo);	
1033
		calc.menuItem("File->Close").select();
1034
		openStartcenter();
1035
1036
		// Reopen and verify sorted result
1037
		startcenter.menuItem("File->Open...").select();
1038
		submitOpenDlg(saveTo);
1039
		calc.waitForExistence(10, 2);
1040
		assertArrayEquals("Saved sorted result", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8"));
1041
		assertArrayEquals("Original data2", data2, CalcUtil.getCellTexts("G10:G14"));
1042
	}
1043
1044
	/**
1045
	 * Test sort options: multiple sort, no data overlap, sort parameter saved correctly
1046
	 * @throws Exception
1047
	 */
1048
	@Test
1049
	public void testSortOptionsMultipleSortSortParameterSaved() throws Exception{
1050
1051
		// Input some data
1052
		String[][] data1 = new String[][] {
1053
				{"D"},
1054
				{"C"},
1055
				{"B"},
1056
				{"A"},
1057
				{"E"},
1058
		};
1059
		String[][] expectedSortedResult1 = new String[][] {
1060
				{"A"},
1061
				{"B"},
1062
				{"C"},
1063
				{"D"},
1064
				{"E"},
1065
		};
1066
		String[][] data2 = new String[][] {
1067
				{"Numbers"},
1068
				{"4"},
1069
				{"2"},
1070
				{"5"},
1071
				{"1"},
1072
				{"3"},
1073
		};
1074
		String[][] expectedSortedResult2 = new String[][] {
1075
				{"Numbers"},
1076
				{"1"},
1077
				{"2"},
1078
				{"3"},
1079
				{"4"},
1080
				{"5"},
1081
		};
1082
		CalcUtil.selectRange("A1");
1083
		typeKeys("D<down>C<down>B<down>A<down>E");
1084
1085
		// "Data->Sort...", uncheck "Range contains column labels", check "Case sensitive" and "Include formats", sort first by "Column A", "Ascending"
1086
		calc.menuItem("Data->Sort...").select();
1087
		SortOptionsPage.select();
1088
		SortOptionsPage_RangeContainsColumnLabels.uncheck();
1089
		SortOptionsPage_CaseSensitive.check();
1090
		SortOptionsPage_IncludeFormats.check();
1091
		SortPage.select();
1092
		SortPage_By1.select("Column A");
1093
		SortPage_Ascending1.check();
1094
		SortPage.ok();		
1095
1096
		// Verify sorted result
1097
		assertArrayEquals("Sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1098
1099
		// Uodo/redo
1100
		calc.menuItem("Edit->Undo: Sort").select();
1101
		assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5"));
1102
		calc.menuItem("Edit->Redo: Sort").select();
1103
		assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1104
1105
		// Input data2 into same sheet, data1 and data2 are not overlapped
1106
		CalcUtil.selectRange("G10");
1107
		typeKeys("Numbers<down>4<down>2<down>5<down>1<down>3");
1108
1109
		// Focus on data2, "Data->Sort...", check "Range contains column labels", uncheck "Case sensitive" and "Include formats", sort first by "Numbers", "Ascending"
1110
		CalcUtil.selectRange("G10");
1111
		calc.menuItem("Data->Sort...").select();
1112
		SortOptionsPage.select();
1113
		SortOptionsPage_RangeContainsColumnLabels.check();
1114
		SortOptionsPage_CaseSensitive.uncheck();
1115
		SortOptionsPage_IncludeFormats.uncheck();
1116
		SortPage.select();
1117
		SortPage_By1.select("Numbers");
1118
		SortPage_Ascending1.check();
1119
		SortPage.ok();			
1120
1121
		// Verify sorted result
1122
		assertArrayEquals("Sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
1123
1124
		// Uodo/redo
1125
		calc.menuItem("Edit->Undo: Sort").select();
1126
		assertArrayEquals("Undo sorted result", data2, CalcUtil.getCellTexts("G10:G15"));
1127
		calc.menuItem("Edit->Redo: Sort").select();
1128
		assertArrayEquals("Redo sorted result", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
1129
1130
		// Open sort dialog, check its setting
1131
		calc.menuItem("Data->Sort...").select();
1132
		SortOptionsPage.select();
1133
		assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked());
1134
		assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked());
1135
		assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked());
1136
		SortOptionsPage.ok();		
1137
1138
		// Save and close document
1139
		String saveTo = fullPath("temp/" + "SortOptionsMultipleSortParameterSaved.ods");
1140
		calc.menuItem("File->Save As...").select();
1141
		FileUtil.deleteFile(saveTo);
1142
		submitSaveDlg(saveTo);	
1143
		calc.menuItem("File->Close").select();
1144
		openStartcenter();
1145
1146
		// Reopen and verify sorted result and sort parameters
1147
		startcenter.menuItem("File->Open...").select();
1148
		submitOpenDlg(saveTo);
1149
		calc.waitForExistence(10, 2);
1150
		assertArrayEquals("Saved sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5"));
1151
		assertArrayEquals("Saved sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15"));
1152
		calc.menuItem("Data->Sort...").select();
1153
		SortOptionsPage.select();
1154
		assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked());
1155
		assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked());
1156
		assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked());
1157
		SortOptionsPage.ok();	
1158
	}
1159
1160
}
(-)src/testcase/sc/filter/Fitler.java (+72 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.sc.filter;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
import org.junit.Before;
35
import org.junit.Ignore;
36
import org.junit.Rule;
37
import testlib.CalcUtil;
38
import testlib.Log;
39
40
/**
41
 * Test cases about Data->Filter in spreadsheet
42
 */
43
public class Fitler {
44
45
	@Rule
46
	public Log LOG = new Log();
47
48
	@Before
49
	public void setUp() throws Exception {
50
		app.start();
51
52
		// Create a new spreadsheet document
53
		startcenter.menuItem("File->New->Spreadsheet").select();
54
	}
55
56
	@After
57
	public void tearDown() throws Exception {
58
		app.close();
59
	}
60
61
	/**
62
	 * 
63
	 * Verify Chart Wizard dialog title words
64
	 */
65
	@Ignore("Bug 120076")
66
	public void testAutoFilterWithPlusSign() {
67
		String expect ="2+";
68
		CalcUtil.selectRange("A1");
69
		typeKeys(expect + "<enter>");
70
		assertEquals(expect,CalcUtil.getCellText("A1"));
71
	}
72
}
(-)src/testcase/sc/datapilot/DataPivotTable.java (+1661 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.sc.datapilot;
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
31
import org.junit.After;
32
import static org.junit.Assert.*;
33
import static org.openoffice.test.vcl.Tester.*;
34
import org.junit.Before;
35
import org.junit.Ignore;
36
import org.junit.Rule;
37
import org.openoffice.test.common.SystemUtil;
38
import testlib.CalcUtil;
39
import testlib.Log;
40
41
/**
42
 * Test Data->Pivot Table
43
 * Test cases in this class are unavailable. Because these test cases are based on symphony.
44
 * DataPilot of symphony is totally different from PivotTable of AOO.
45
 * Keep this class to track the test point.
46
 * TODO: Add test cases about Pivot Table.
47
 */
48
public class DataPivotTable {
49
50
	@Rule
51
	public Log LOG = new Log();
52
53
	@Before
54
	public void setUp() throws Exception {
55
		app.start();
56
	}
57
58
	@After
59
	public void tearDown() throws Exception {
60
		app.close();
61
	}
62
63
	/**
64
	 * 
65
	 * Verify copy and paste Data Pilot Table
66
	 */
67
	@Ignore("DataPilot in symphony is totally not the same in AOO")
68
	public void testCopyPasteDataPilotTable() {
69
		//Open the sample file
70
		String file = testFile("source_data01.ods");
71
		startcenter.menuItem("File->Open...").select();
72
		submitOpenDlg(file);
73
		sleep(2);
74
75
		//Create DataPilotTable and verify the content
76
		CalcUtil.selectRange("A1:E27");
77
		calc.menuItem("Data->DataPilot->Start...").select();		
78
		CreateDataPilotTableDialog.ok();
79
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
80
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
81
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
82
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
83
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
84
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
85
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
86
87
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
88
			DataPilotAutomaticallyUpdateCheckBox.check();
89
		}
90
91
		//Add field into every area
92
		DataPilotFieldSelect.click(1, 1);
93
		DataPilotFieldSelect.openContextMenu();
94
		menuItem("Add to Page").select();
95
		assertEquals("Locale",CalcUtil.getCellText("A1"));
96
		sleep(1);
97
98
		DataPilotFieldSelect.click(1,30);
99
		DataPilotFieldSelect.openContextMenu();
100
		menuItem("Add to Column").select();
101
		assertEquals("Name",CalcUtil.getCellText("A3"));
102
		sleep(1);
103
104
		DataPilotFieldSelect.click(1,50);
105
		DataPilotFieldSelect.openContextMenu();
106
		menuItem("Add to Row").select();
107
		assertEquals("Date",CalcUtil.getCellText("A4"));
108
		sleep(1);
109
110
		DataPilotFieldSelect.click(1,70);
111
		DataPilotFieldSelect.openContextMenu();
112
		menuItem("Add to Data by->Sum").select();
113
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
114
		assertEquals("266773",CalcUtil.getCellText("J23"));
115
		sleep(1);
116
117
		//Copy and paste the data pilot table and verify the content
118
		CalcUtil.selectRange("A1:J24");
119
		typeKeys("<$copy>");
120
121
		CalcUtil.selectRange("A26");
122
		typeKeys("<$paste>");
123
		assertEquals("Locale",CalcUtil.getCellText("A26"));
124
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
125
		assertEquals("Name",CalcUtil.getCellText("B28"));
126
		assertEquals("Date",CalcUtil.getCellText("A29"));
127
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
128
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
129
		assertEquals("266773",CalcUtil.getCellText("J48"));
130
		sleep(1);
131
132
		CalcUtil.selectRange("A1:J24");
133
		typeKeys("<$copy>");
134
		CalcUtil.selectRange("$A.$A29");
135
		typeKeys("<$paste>");
136
		assertEquals("Locale",CalcUtil.getCellText("A29"));
137
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A31"));
138
		assertEquals("Name",CalcUtil.getCellText("B31"));
139
		assertEquals("Date",CalcUtil.getCellText("A32"));
140
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
141
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
142
		assertEquals("266773",CalcUtil.getCellText("J51"));
143
	}
144
145
	/**
146
	 * 
147
	 * Verify that DP panel will be synchronized with table while add fields on panel.
148
	 */
149
	@Ignore("DataPilot in symphony is totally not the same in AOO")
150
	public void testDataPilotAddFieldsAutoUpdate() {
151
		//open the sample file Create DataPilotTable and verify the content
152
		String file = testFile("source_data01.ods");
153
		startcenter.menuItem("File->Open...").select();
154
		submitOpenDlg(file);
155
		sleep(2);
156
		CalcUtil.selectRange("A1:E27");
157
		calc.menuItem("Data->DataPilot->Start...").select();
158
		CreateDataPilotTableDialog.ok();
159
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
160
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
161
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
162
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
163
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
164
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
165
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
166
167
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
168
			DataPilotAutomaticallyUpdateCheckBox.check();
169
170
		}
171
		sleep(1);
172
173
		//Add field into every area
174
		DataPilotFieldSelect.click(1, 30);
175
		DataPilotFieldSelect.openContextMenu();
176
		menuItem("Add to Column").select();
177
		assertEquals("Name",CalcUtil.getCellText("A1"));
178
		sleep(1);
179
180
		DataPilotFieldSelect.click(1,50);
181
		DataPilotFieldSelect.openContextMenu();
182
		menuItem("Add to Row").select();
183
		assertEquals("Date",CalcUtil.getCellText("A2"));
184
		sleep(1);
185
186
		DataPilotFieldSelect.drag(1, 1, 184, 80);
187
		assertEquals("Locale",CalcUtil.getCellText("A1"));
188
		sleep(1);
189
190
		typeKeys("<$undo>");
191
		assertEquals("",CalcUtil.getCellText("A1"));
192
		sleep(1);
193
194
		typeKeys("<$redo>");
195
		assertEquals("Locale",CalcUtil.getCellText("A1"));
196
		sleep(1);
197
198
		DataPilotFieldSelect.click(1,70);
199
		DataPilotFieldSelect.openContextMenu();
200
		menuItem("Add to Data by->Sum").select();
201
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
202
		assertEquals("266773",CalcUtil.getCellText("J23"));
203
		sleep(1);
204
205
		typeKeys("<$undo>");
206
		assertEquals("",CalcUtil.getCellText("A3"));
207
		sleep(1);
208
209
		typeKeys("<$redo>");
210
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
211
		assertEquals("266773",CalcUtil.getCellText("J23"));
212
		sleep(1);
213
	}
214
215
	/**
216
	 * 
217
	 * Verify that DP panel will be synchronized with table while add fields on panel.
218
	 */
219
	@Ignore("DataPilot in symphony is totally not the same in AOO")
220
	public void testDataPilotAddFieldsManualUpdate() {
221
		//open the sample file Create DataPilotTable and verify the content
222
		String file = testFile("source_data01.ods");
223
		startcenter.menuItem("File->Open...").select();
224
		submitOpenDlg(file);
225
		sleep(2);
226
		CalcUtil.selectRange("A1:E27");
227
		calc.menuItem("Data->DataPilot->Start...").select();
228
		CreateDataPilotTableDialog.ok();
229
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
230
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
231
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
232
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
233
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
234
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
235
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
236
237
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
238
			DataPilotAutomaticallyUpdateCheckBox.check();
239
240
		}
241
242
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
243
244
		sleep(1);
245
		DataPilotFieldSelect.click(1, 30);
246
		DataPilotFieldSelect.openContextMenu();
247
		menuItem("Add to Column").select();
248
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
249
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
250
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
251
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
252
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
253
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
254
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
255
		sleep(1);
256
257
		DataPilotFieldSelect.click(1,50);
258
		DataPilotFieldSelect.openContextMenu();
259
		menuItem("Add to Row").select();
260
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
261
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
262
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
263
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
264
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
265
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
266
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
267
		sleep(1);
268
269
		CalcUtil.selectRange("B20");
270
		ActiveMsgBox.yes();
271
		sleep(1);
272
		assertEquals("Name",CalcUtil.getCellText("B1"));
273
		assertEquals("Date",CalcUtil.getCellText("A2"));
274
275
		DataPilotFieldSelect.drag(1, 1, 184, 80);
276
		assertEquals("Name",CalcUtil.getCellText("B1"));
277
		assertEquals("Date",CalcUtil.getCellText("A2"));
278
		sleep(1);
279
280
		DataPilotFieldSelect.click(1,70);
281
		DataPilotFieldSelect.openContextMenu();
282
		menuItem("Add to Data by->Sum").select();
283
		assertEquals("Name",CalcUtil.getCellText("B1"));
284
		assertEquals("Date",CalcUtil.getCellText("A2"));
285
		sleep(1);
286
287
		DataPilotTableUpdateButton.click();
288
		assertEquals("Locale",CalcUtil.getCellText("A1"));
289
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
290
		assertEquals("266773",CalcUtil.getCellText("J23"));
291
		sleep(1);
292
293
294
		typeKeys("<$undo>");
295
		assertEquals("Name",CalcUtil.getCellText("B1"));
296
		assertEquals("Date",CalcUtil.getCellText("A2"));
297
		sleep(1);
298
299
300
		typeKeys("<$redo>");
301
		assertEquals("Locale",CalcUtil.getCellText("A1"));
302
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
303
		assertEquals("266773",CalcUtil.getCellText("J23"));
304
		sleep(1);
305
306
		DataPilotAutomaticallyUpdateCheckBox.check();
307
		assertTrue(DataPilotAutomaticallyUpdateCheckBox.isChecked());
308
	}
309
310
	/**
311
	 * 
312
	 * Verify that DP panel will be synchronized with table while add fields on panel.
313
	 */
314
	@Ignore("DataPilot in symphony is totally not the same in AOO")
315
	public void testDataPilotChangeDataFieldOptionAutoUpdate() {
316
		//open the sample file Create DataPilotTable and verify the content
317
		String file = testFile("source_data01.ods");
318
		startcenter.menuItem("File->Open...").select();
319
		submitOpenDlg(file);
320
		sleep(2);
321
		CalcUtil.selectRange("A1:E27");
322
		calc.menuItem("Data->DataPilot->Start...").select();
323
		CreateDataPilotTableDialog.ok();
324
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
325
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
326
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
327
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
328
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
329
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
330
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
331
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
332
			DataPilotAutomaticallyUpdateCheckBox.check();
333
334
		}
335
		sleep(1);
336
337
		DataPilotFieldSelect.click(1, 1);
338
		DataPilotFieldSelect.openContextMenu();
339
		menuItem("Add to Column").select();
340
		assertEquals("Locale",CalcUtil.getCellText("A1"));
341
		sleep(1);
342
343
		DataPilotFieldSelect.click(1,30);
344
		DataPilotFieldSelect.openContextMenu();
345
		menuItem("Add to Column").select();
346
		assertEquals("Name",CalcUtil.getCellText("B1"));
347
		sleep(1);
348
349
		DataPilotFieldSelect.click(1,50);
350
		DataPilotFieldSelect.openContextMenu();
351
		menuItem("Add to Row").select();
352
		assertEquals("Date",CalcUtil.getCellText("A3"));
353
		sleep(1);
354
355
		DataPilotFieldSelect.click(1,70);
356
		DataPilotFieldSelect.openContextMenu();
357
		menuItem("Add to Row").select();
358
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
359
		sleep(1);
360
361
		DataPilotFieldSelect.click(1,90);
362
		DataPilotFieldSelect.openContextMenu();
363
		menuItem("Add to Data by->Sum").select();
364
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
365
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
366
		sleep(1);
367
368
		//Change Locale option settings, and verify it
369
		String target = "New Locale";
370
		DataPilotColumnArea.click(1,1);
371
		DataPilotColumnArea.openContextMenu();
372
		menuItem("Field Option").select();
373
		DataPilotFieldOptionFieldTabPageDialog.select();
374
		DataPilotFieldDisplayNameEditBox.setText(target);
375
		sleep(1);
376
377
		DataPilotFieldOptionFiledSubtotalsPage.select();
378
		sleep(1);
379
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
380
		sleep(1);
381
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
382
		sleep(1);
383
384
		DataPilotFieldOptionSortTabPageDialog.select();
385
386
387
		DataPilotFieldOptionSortDescendingRadioButton.check();
388
		DataPilotFieldOptionFieldTabPageDialog.select();
389
		DataPilotFieldOptionFieldTabPageDialog.ok();
390
		sleep(1);
391
392
		assertEquals("New Locale",CalcUtil.getCellText("C1"));
393
		assertEquals("USA",CalcUtil.getCellText("C2"));
394
		assertEquals("USA Count - Amount",CalcUtil.getCellInput("H2"));
395
		assertEquals("17",CalcUtil.getCellInput("H30"));
396
		assertEquals("China Count - Amount",CalcUtil.getCellInput("L2"));
397
		assertEquals("9",CalcUtil.getCellInput("L30"));
398
		assertEquals("32779.17",CalcUtil.getCellInput("M30"));
399
400
		DataPilotColumnArea.click(1,30);
401
		DataPilotColumnArea.openContextMenu();
402
		menuItem("Field Option").select();
403
		DataPilotFieldOptionFieldTabPageDialog.select();
404
		DataPilotFieldShowItemWithoutDataCheckBox.check();
405
		DataPilotFieldOptionFieldTabPageDialog.ok();
406
		assertEquals("Emmy Ma",CalcUtil.getCellText("F3"));
407
		assertEquals("32779.17",CalcUtil.getCellInput("U30"));
408
409
		CalcUtil.selectRange("C1");
410
		SpreadSheetCells.openContextMenu();
411
		menuItem("Field Option...").select();
412
		DataPilotFieldOptionFieldTabPageDialog.select();
413
		DataPilotFieldDisplayNameEditBox.setText("Locale");
414
		DataPilotFieldOptionFiledSubtotalsPage.select();
415
		DataPilotFieldOptionSubTotalsNeverRadioButton.check();
416
		sleep(1);
417
		DataPilotFieldOptionSortTabPageDialog.select();
418
		DataPilotFieldOptionSortAscendingRadioButton.check();
419
		DataPilotFieldOptionFieldTabPageDialog.select();
420
		DataPilotFieldOptionFieldTabPageDialog.ok();
421
422
		assertEquals("Locale",CalcUtil.getCellText("C1"));
423
		assertEquals("China",CalcUtil.getCellText("C2"));
424
		assertEquals("USA",CalcUtil.getCellText("K2"));
425
		assertEquals("32779.17",CalcUtil.getCellInput("S30"));
426
427
428
		CalcUtil.selectRange("D1");
429
		SpreadSheetCells.openContextMenu();
430
		menuItem("Field Option...").select();
431
		DataPilotFieldOptionFieldTabPageDialog.select();
432
		DataPilotFieldShowItemWithoutDataCheckBox.uncheck();
433
		DataPilotFieldOptionFieldTabPageDialog.ok();
434
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
435
	}
436
437
	/**
438
	 * 
439
	 * Verify that Verify the Drag/Move function of Grouped field 
440
	 */
441
	@Ignore("DataPilot in symphony is totally not the same in AOO")
442
	public void testDragMoveFunctionOfGroupedField() {
443
		String file = testFile("source_data01.ods");
444
		startcenter.menuItem("File->Open...").select();
445
		submitOpenDlg(file);
446
		sleep(2);
447
		CalcUtil.selectRange("A1:E27");
448
		calc.menuItem("Data->DataPilot->Start...").select();
449
		CreateDataPilotTableDialog.ok();
450
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
451
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
452
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
453
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
454
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
455
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
456
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
457
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
458
			DataPilotAutomaticallyUpdateCheckBox.check();
459
460
		}
461
462
		DataPilotFieldSelect.click(1, 1);
463
		DataPilotFieldSelect.openContextMenu();
464
		menuItem("Add to Page").select();
465
		assertEquals("Locale",CalcUtil.getCellText("A1"));
466
		sleep(1);
467
468
		DataPilotFieldSelect.click(1,30);
469
		DataPilotFieldSelect.openContextMenu();
470
		menuItem("Add to Column").select();
471
		assertEquals("Name",CalcUtil.getCellText("A3"));
472
		sleep(1);
473
474
		DataPilotFieldSelect.click(1,50);
475
		DataPilotFieldSelect.openContextMenu();
476
		menuItem("Add to Row").select();
477
		assertEquals("Date",CalcUtil.getCellText("A4"));
478
		sleep(1);
479
480
		DataPilotFieldSelect.click(1,70);
481
		DataPilotFieldSelect.openContextMenu();
482
		menuItem("Add to Data by->Sum").select();
483
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
484
		assertEquals("266773",CalcUtil.getCellText("J23"));
485
		sleep(1);
486
487
		CalcUtil.selectRange("B4:C4");
488
		SpreadSheetCells.openContextMenu();
489
		menuItem("Group->Group Selected Items").select();
490
		assertEquals("Name2",CalcUtil.getCellText("B3"));
491
		assertEquals("Name",CalcUtil.getCellText("C3"));
492
		assertEquals("Group1",CalcUtil.getCellText("D4"));
493
		assertEquals("266773",CalcUtil.getCellText("J24"));
494
		sleep(1);
495
496
		DataPilotColumnArea.click(1,1);
497
		DataPilotColumnArea.openContextMenu();
498
		menuItem("Move to Row").select();
499
		assertEquals("Name2",CalcUtil.getCellText("B4"));
500
		assertEquals("Group1",CalcUtil.getCellText("B6"));
501
		assertEquals("266773",CalcUtil.getCellText("K31"));
502
		sleep(1);
503
504
		typeKeys("<$undo>");
505
		assertEquals("Name2",CalcUtil.getCellText("B3"));
506
		assertEquals("Name",CalcUtil.getCellText("C3"));
507
		assertEquals("Group1",CalcUtil.getCellText("D4"));
508
		assertEquals("266773",CalcUtil.getCellText("J24"));
509
		sleep(1);
510
511
		typeKeys("<$redo>");
512
		assertEquals("Name2",CalcUtil.getCellText("B4"));
513
		assertEquals("Group1",CalcUtil.getCellText("B6"));
514
		assertEquals("266773",CalcUtil.getCellText("K31"));
515
	}
516
517
	/**
518
	 * 
519
	 * Verify that DP panel while switch focus among tables with same/different source range.
520
	 */
521
	@Ignore("DataPilot in symphony is totally not the same in AOO")
522
	public void testHideShowPanel() {
523
		String file = testFile("source_data01.ods");
524
		startcenter.menuItem("File->Open...").select();
525
		submitOpenDlg(file);
526
		sleep(2);
527
		CalcUtil.selectRange("A1:E27");
528
		calc.menuItem("Data->DataPilot->Start...").select();		
529
		CreateDataPilotTableDialog.ok();
530
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
531
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
532
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
533
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
534
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
535
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
536
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
537
538
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
539
			DataPilotAutomaticallyUpdateCheckBox.check();
540
		}
541
542
		DataPilotFieldSelect.click(1, 1);
543
		DataPilotFieldSelect.openContextMenu();
544
		menuItem("Add to Page").select();
545
		assertEquals("Locale",CalcUtil.getCellText("A1"));
546
		sleep(1);
547
548
		DataPilotFieldSelect.click(1,30);
549
		DataPilotFieldSelect.openContextMenu();
550
		menuItem("Add to Column").select();
551
		assertEquals("Name",CalcUtil.getCellText("A3"));
552
		sleep(1);
553
554
		DataPilotFieldSelect.click(1,50);
555
		DataPilotFieldSelect.openContextMenu();
556
		menuItem("Add to Row").select();
557
		assertEquals("Date",CalcUtil.getCellText("A4"));
558
		sleep(1);
559
560
		DataPilotFieldSelect.click(1,70);
561
		DataPilotFieldSelect.openContextMenu();
562
		menuItem("Add to Data by->Sum").select();
563
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
564
		assertEquals("266773",CalcUtil.getCellText("J23"));
565
		sleep(1);
566
567
		CalcUtil.selectRange("A1:J24");
568
		typeKeys("<$copy>");
569
570
		CalcUtil.selectRange("A26");
571
		typeKeys("<$paste>");
572
		assertEquals("Locale",CalcUtil.getCellText("A26"));
573
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
574
		assertEquals("Name",CalcUtil.getCellText("B28"));
575
		assertEquals("Date",CalcUtil.getCellText("A29"));
576
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
577
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
578
		assertEquals("266773",CalcUtil.getCellText("J48"));
579
		sleep(1);
580
581
		CalcUtil.selectRange("A1");
582
		SpreadSheetCells.openContextMenu();
583
		menuItem("Show DataPilot Panel").select();
584
		assertFalse(DataPilotPanel.exists());
585
		sleep(1);
586
587
		CalcUtil.selectRange("A1");
588
		SpreadSheetCells.openContextMenu();
589
		menuItem("Show DataPilot Panel").select();
590
		assertTrue(DataPilotPanel.exists());
591
		sleep(1);
592
593
		DataPilotPanel.close();
594
		assertFalse(DataPilotPanel.exists());
595
		sleep(1);
596
597
		CalcUtil.selectRange("A26");
598
		DataPilotButton.click();
599
		sleep(1);
600
		assertTrue(DataPilotPanel.exists());
601
		assertEquals("Locale",CalcUtil.getCellText("A26"));
602
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
603
		assertEquals("Name",CalcUtil.getCellText("B28"));
604
		assertEquals("Date",CalcUtil.getCellText("A29"));
605
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
606
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
607
		assertEquals("266773",CalcUtil.getCellText("J48"));
608
	}
609
610
	/**
611
	 * 
612
	 * Verify that DP panel will be synchronized with table while add fields on panel.
613
	 */
614
	@Ignore("DataPilot in symphony is totally not the same in AOO")
615
	public void testMoveFieldInSameAreaManualUpdate() {
616
		String file = testFile("source_data01.ods");
617
		startcenter.menuItem("File->Open...").select();
618
		submitOpenDlg(file);
619
		sleep(2);
620
		CalcUtil.selectRange("A1:E27");
621
		calc.menuItem("Data->DataPilot->Start...").select();
622
		CreateDataPilotTableDialog.ok();
623
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
624
			DataPilotAutomaticallyUpdateCheckBox.check();
625
626
		}
627
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
628
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
629
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
630
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
631
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
632
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
633
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
634
		sleep(1);
635
636
		DataPilotFieldSelect.click(1, 1);
637
		DataPilotFieldSelect.openContextMenu();
638
		menuItem("Add to Column").select();
639
		assertEquals("Locale",CalcUtil.getCellText("A1"));
640
		sleep(1);
641
642
		DataPilotFieldSelect.click(1,30);
643
		DataPilotFieldSelect.openContextMenu();
644
		menuItem("Add to Column").select();
645
		assertEquals("Name",CalcUtil.getCellText("B1"));
646
		sleep(1);
647
648
		DataPilotFieldSelect.click(1,50);
649
		DataPilotFieldSelect.openContextMenu();
650
		menuItem("Add to Row").select();
651
		assertEquals("Date",CalcUtil.getCellText("A3"));
652
		sleep(1);
653
654
		DataPilotFieldSelect.click(1,70);
655
		DataPilotFieldSelect.openContextMenu();
656
		menuItem("Add to Row").select();
657
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
658
		sleep(1);
659
660
		DataPilotFieldSelect.click(1,90);
661
		DataPilotFieldSelect.openContextMenu();
662
		menuItem("Add to Data by->Sum").select();
663
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
664
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
665
		sleep(1);
666
667
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
668
		DataPilotColumnArea.drag(1, 1, 1, 60);
669
		assertEquals("Name",CalcUtil.getCellText("D1"));
670
		assertEquals("Locale",CalcUtil.getCellText("C1"));
671
		sleep(1);
672
673
		DataPilotPaneRowArea.drag(1,1, 1, 60);
674
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
675
		assertEquals("Date",CalcUtil.getCellText("A3"));
676
		sleep(1);
677
678
		CalcUtil.selectRange("A33");
679
		ActiveMsgBox.yes();
680
		assertEquals("Name",CalcUtil.getCellText("C1"));
681
		assertEquals("Locale",CalcUtil.getCellText("D1"));
682
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
683
		assertEquals("Date",CalcUtil.getCellText("B3"));
684
		sleep(1);
685
686
		DataPilotColumnArea.click(1,1);
687
		DataPilotColumnArea.openContextMenu();
688
		menuItem("Move Down").select();
689
		assertEquals("Name",CalcUtil.getCellText("C1"));
690
		assertEquals("Locale",CalcUtil.getCellText("D1"));
691
		sleep(1);
692
693
		DataPilotPaneRowArea.click(1,30);
694
		DataPilotPaneRowArea.openContextMenu();
695
		menuItem("Move Up").select();
696
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
697
		assertEquals("Date",CalcUtil.getCellText("B3"));
698
		sleep(1);
699
700
		CalcUtil.selectRange("A33");
701
		ActiveMsgBox.yes();
702
		assertEquals("Name",CalcUtil.getCellText("D1"));
703
		assertEquals("Locale",CalcUtil.getCellText("C1"));
704
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
705
		assertEquals("Date",CalcUtil.getCellText("A3"));
706
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
707
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
708
		DataPilotAutomaticallyUpdateCheckBox.check();
709
		sleep(1);
710
	}
711
712
	/**
713
	 * 
714
	 * Verify that DP panel will be synchronized with table while move fields on panel.
715
	 */
716
	@Ignore("DataPilot in symphony is totally not the same in AOO")
717
	public void testMoveFieldToOtherAreaAutoUpdate() {
718
		String file = testFile("source_data01.ods");
719
		startcenter.menuItem("File->Open...").select();
720
		submitOpenDlg(file);
721
		sleep(2);
722
		CalcUtil.selectRange("A1:E27");
723
		calc.menuItem("Data->DataPilot->Start...").select();
724
		CreateDataPilotTableDialog.ok();
725
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
726
			DataPilotAutomaticallyUpdateCheckBox.check();
727
728
		}
729
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
730
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
731
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
732
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
733
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
734
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
735
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
736
		sleep(1);
737
738
		DataPilotFieldSelect.click(1, 1);
739
		DataPilotFieldSelect.openContextMenu();
740
		menuItem("Add to Column").select();
741
		assertEquals("Locale",CalcUtil.getCellText("A1"));
742
		sleep(1);
743
744
		DataPilotFieldSelect.click(1,30);
745
		DataPilotFieldSelect.openContextMenu();
746
		menuItem("Add to Column").select();
747
		assertEquals("Name",CalcUtil.getCellText("B1"));
748
		sleep(1);
749
750
		DataPilotFieldSelect.click(1,50);
751
		DataPilotFieldSelect.openContextMenu();
752
		menuItem("Add to Row").select();
753
		assertEquals("Date",CalcUtil.getCellText("A3"));
754
		sleep(1);
755
756
		DataPilotFieldSelect.click(1,70);
757
		DataPilotFieldSelect.openContextMenu();
758
		menuItem("Add to Row").select();
759
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
760
		sleep(1);
761
762
		DataPilotFieldSelect.click(1,90);
763
		DataPilotFieldSelect.openContextMenu();
764
		menuItem("Add to Data by->Sum").select();
765
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
766
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
767
		sleep(1);
768
769
		DataPilotPaneRowArea.drag(1,1, 1, -50);
770
		assertEquals("Date",CalcUtil.getCellText("D1"));
771
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
772
		sleep(1);
773
774
		DataPilotColumnArea.click(1,50);
775
		DataPilotColumnArea.openContextMenu();
776
		menuItem("Move to Row").select();
777
		assertEquals("Date",CalcUtil.getCellText("B3"));
778
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
779
		sleep(1);
780
781
		typeKeys("<$undo>");
782
		assertEquals("Date",CalcUtil.getCellText("D1"));
783
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
784
		sleep(1);
785
786
		typeKeys("<$redo>");
787
		assertEquals("Date",CalcUtil.getCellText("B3"));
788
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
789
	}
790
791
	/**
792
	 * 
793
	 * Verify that DP panel will be synchronized with table while move fields on panel.
794
	 */
795
	@Ignore("DataPilot in symphony is totally not the same in AOO")
796
	public void testMoveFieldToOtherAreaDiscardChange() {
797
		String file = testFile("source_data01.ods");
798
		startcenter.menuItem("File->Open...").select();
799
		submitOpenDlg(file);
800
		sleep(2);
801
		CalcUtil.selectRange("A1:E27");
802
		calc.menuItem("Data->DataPilot->Start...").select();
803
		CreateDataPilotTableDialog.ok();
804
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
805
			DataPilotAutomaticallyUpdateCheckBox.check();
806
807
		}
808
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
809
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
810
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
811
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
812
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
813
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
814
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
815
		sleep(1);
816
817
		DataPilotFieldSelect.click(1, 1);
818
		DataPilotFieldSelect.openContextMenu();
819
		menuItem("Add to Column").select();
820
		assertEquals("Locale",CalcUtil.getCellText("A1"));
821
		sleep(1);
822
823
		DataPilotFieldSelect.click(1,30);
824
		DataPilotFieldSelect.openContextMenu();
825
		menuItem("Add to Column").select();
826
		assertEquals("Name",CalcUtil.getCellText("B1"));
827
		sleep(1);
828
829
		DataPilotFieldSelect.click(1,50);
830
		DataPilotFieldSelect.openContextMenu();
831
		menuItem("Add to Row").select();
832
		assertEquals("Date",CalcUtil.getCellText("A3"));
833
		sleep(1);
834
835
		DataPilotFieldSelect.click(1,70);
836
		DataPilotFieldSelect.openContextMenu();
837
		menuItem("Add to Row").select();
838
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
839
		sleep(1);
840
841
		DataPilotFieldSelect.click(1,90);
842
		DataPilotFieldSelect.openContextMenu();
843
		menuItem("Add to Data by->Sum").select();
844
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
845
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
846
		sleep(1);
847
848
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
849
850
		DataPilotPaneRowArea.drag(1,1, 1, -50);
851
		assertEquals("Date",CalcUtil.getCellText("A3"));
852
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
853
		sleep(1);
854
855
		CalcUtil.selectRange("B33");
856
		ActiveMsgBox.yes();
857
		assertEquals("Date",CalcUtil.getCellText("D1"));
858
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
859
		sleep(1);
860
861
		DataPilotColumnArea.click(1,50);
862
		DataPilotColumnArea.openContextMenu();
863
		menuItem("Move to Row").select();
864
		assertEquals("Date",CalcUtil.getCellText("D1"));
865
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
866
867
		CalcUtil.selectRange("B33");
868
		ActiveMsgBox.yes();
869
		assertEquals("Date",CalcUtil.getCellText("B3"));
870
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
871
		sleep(1);
872
873
		DataPilotAutomaticallyUpdateCheckBox.check();
874
	}
875
876
	/**
877
	 * 
878
	 * Verify that DP panel will be synchronized with table while move table.
879
	 * After the field name get changed, when you refresh the data, the DataPilot table will change to empty table
880
	 * if you create table small than the empty table, the table size will get larger
881
	 * if there is another DataPilot table exist in the larger range, there will pop a warning.
882
	 */
883
	@Ignore("DataPilot in symphony is totally not the same in AOO")
884
	public void testMoveTableNarrowSpaceToShowTheTable() {
885
		String file = testFile("source_data01.ods");
886
		startcenter.menuItem("File->Open...").select();
887
		submitOpenDlg(file);
888
		sleep(2);
889
		CalcUtil.selectRange("A1:E27");
890
		calc.menuItem("Data->DataPilot->Start...").select();
891
		CreateDataPilotTableDialog.ok();
892
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
893
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
894
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
895
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
896
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
897
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
898
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
899
900
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
901
			DataPilotAutomaticallyUpdateCheckBox.check();
902
		}
903
904
		DataPilotFieldSelect.click(1, 1);
905
		DataPilotFieldSelect.openContextMenu();
906
		menuItem("Add to Page").select();
907
		assertEquals("Locale",CalcUtil.getCellText("A1"));
908
		sleep(1);
909
910
		CalcUtil.selectRange("A1:B4");
911
		typeKeys("<$copy>");
912
		CalcUtil.selectRange("C1");
913
		typeKeys("<$paste>");
914
		sleep(1);
915
916
		CalcUtil.selectRange("$A.A1");
917
		typeKeys("New Locale" + "<enter>");
918
919
		CalcUtil.selectRange("$DataPilot_A_1.A1");
920
		SpreadSheetCells.openContextMenu();
921
		menuItem("Refresh Data").select();
922
		ActiveMsgBox.ok();
923
924
		CalcUtil.selectRange("A1:B4");
925
		SpreadSheetCells.drag(80, 45, 80, 350);
926
927
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B20"));
928
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B22"));
929
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B23"));
930
		assertEquals("Page Area",CalcUtil.getCellText("B25"));
931
		assertEquals("Row Area",CalcUtil.getCellText("B28"));
932
		assertEquals("Column Area",CalcUtil.getCellText("D27"));
933
		assertEquals("Data Area",CalcUtil.getCellText("D29"));
934
		DataPilotPanel.close();
935
		sleep(1);
936
937
		CalcUtil.selectRange("C1:D4");
938
		SpreadSheetCells.drag(210, 50, 10, 50);
939
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
940
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
941
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
942
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
943
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
944
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
945
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
946
	}
947
948
	/**
949
	 * 
950
	 * Verify the data pilot result table refresh after source data changed
951
	 */
952
	@Ignore("DataPilot in symphony is totally not the same in AOO")
953
	public void testOneMRowDataPilotRefresh() {
954
		String file = testFile("source_data01.ods");
955
		startcenter.menuItem("File->Open...").select();
956
		submitOpenDlg(file);
957
		sleep(2);
958
		calc.maximize();
959
		CalcUtil.selectRange("A1:E27");
960
		typeKeys("<$copy>");
961
		CalcUtil.selectRange("A1048540");
962
		typeKeys("<$paste>");
963
		calc.menuItem("Data->DataPilot->Start...").select();
964
		DataPilotTableToExistPlaceRadioButton.check();
965
		assertTrue(DataPilotTableToExistPlaceRadioButton.isChecked());
966
		DataPilotTableToExistPlaceEditBox.setText("$A.$F$1048540");
967
		CreateDataPilotTableDialog.ok();
968
		sleep(1);
969
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
970
			DataPilotAutomaticallyUpdateCheckBox.check();
971
972
		}
973
		DataPilotFieldSelect.click(1, 1);
974
		DataPilotFieldSelect.openContextMenu();
975
		menuItem("Add to Page").select();
976
		assertEquals("Locale",CalcUtil.getCellText("F1048540"));
977
		sleep(1);
978
979
		DataPilotFieldSelect.click(1,30);
980
		DataPilotFieldSelect.openContextMenu();
981
		menuItem("Add to Column").select();
982
		assertEquals("Name",CalcUtil.getCellText("F1048542"));
983
		sleep(1);
984
985
		DataPilotFieldSelect.click(1,50);
986
		DataPilotFieldSelect.openContextMenu();
987
		menuItem("Add to Row").select();
988
		assertEquals("Date",CalcUtil.getCellText("F1048543"));
989
		sleep(1);
990
991
		DataPilotFieldSelect.click(1,70);
992
		DataPilotFieldSelect.openContextMenu();
993
		menuItem("Add to Data by->Sum").select();
994
		assertEquals("Sum - Order Number",CalcUtil.getCellText("F1048542"));
995
		assertEquals("266773",CalcUtil.getCellText("O1048562"));
996
		sleep(1);
997
998
		CalcUtil.selectRange("D1048541");
999
		typeKeys("10000<enter>");
1000
		sleep(1);
1001
1002
		CalcUtil.selectRange("O1048562");
1003
		calc.menuItem("Data->DataPilot->Refresh").select();
1004
		assertEquals("266525",CalcUtil.getCellText("O1048562"));
1005
	}
1006
1007
	/**
1008
	 * 
1009
	 * Verify that DP panel will be synchronized with table while remove fields on panel.
1010
	 */
1011
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1012
	public void testRemoveFieldsDiscardChange() {
1013
		String file = testFile("source_data01.ods");
1014
		startcenter.menuItem("File->Open...").select();
1015
		submitOpenDlg(file);
1016
		sleep(2);
1017
		CalcUtil.selectRange("A1:E27");
1018
		calc.menuItem("Data->DataPilot->Start...").select();
1019
		CreateDataPilotTableDialog.ok();
1020
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1021
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1022
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1023
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1024
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1025
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1026
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1027
1028
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1029
			DataPilotAutomaticallyUpdateCheckBox.check();
1030
		}
1031
1032
		DataPilotFieldSelect.click(1, 1);
1033
		DataPilotFieldSelect.openContextMenu();
1034
		menuItem("Add to Page").select();
1035
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1036
		sleep(1);
1037
1038
		DataPilotFieldSelect.click(1,30);
1039
		DataPilotFieldSelect.openContextMenu();
1040
		menuItem("Add to Column").select();
1041
		assertEquals("Name",CalcUtil.getCellText("A3"));
1042
		sleep(1);
1043
1044
		DataPilotFieldSelect.click(1,50);
1045
		DataPilotFieldSelect.openContextMenu();
1046
		menuItem("Add to Row").select();
1047
		assertEquals("Date",CalcUtil.getCellText("A4"));
1048
		sleep(1);
1049
1050
		DataPilotFieldSelect.click(1,70);
1051
		DataPilotFieldSelect.openContextMenu();
1052
		menuItem("Add to Data by->Sum").select();
1053
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1054
		assertEquals("266773",CalcUtil.getCellText("J23"));
1055
		sleep(1);
1056
1057
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
1058
1059
		DataPilotColumnArea.drag(1, 1, -30, 1);
1060
		assertEquals("Name",CalcUtil.getCellText("B3"));
1061
		assertEquals("266773",CalcUtil.getCellText("J23"));
1062
		sleep(1);
1063
1064
		DataPilotPaneRowArea.click(1,1);
1065
		DataPilotPaneRowArea.openContextMenu();
1066
		menuItem("Remove").select();
1067
		assertEquals("Date",CalcUtil.getCellText("A4"));
1068
		assertEquals("266773",CalcUtil.getCellText("J23"));
1069
		sleep(1);
1070
1071
		DataPilotPanePageArea.drag(1, 1, -30, 1);
1072
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1073
		assertEquals("266773",CalcUtil.getCellText("J23"));
1074
		sleep(1);
1075
1076
		DataPiloPaneDataArea.openContextMenu();
1077
		menuItem("Remove").select();
1078
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1079
		assertEquals("266773",CalcUtil.getCellText("J23"));
1080
1081
		CalcUtil.selectRange("B25");
1082
		ActiveMsgBox.yes();
1083
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1084
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1085
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1086
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1087
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1088
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1089
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1090
1091
		DataPilotAutomaticallyUpdateCheckBox.check();
1092
	}
1093
1094
	/**
1095
	 * 
1096
	 * Verify the Remove function of Grouped field 
1097
	 */
1098
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1099
	public void testRemoveFunctionOfGroupedField() {
1100
		String file = testFile("source_data01.ods");
1101
		startcenter.menuItem("File->Open...").select();
1102
		submitOpenDlg(file);
1103
		sleep(2);
1104
		CalcUtil.selectRange("A1:E27");
1105
		calc.menuItem("Data->DataPilot->Start...").select();		
1106
		CreateDataPilotTableDialog.ok();
1107
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1108
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1109
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1110
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1111
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1112
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1113
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1114
1115
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1116
			DataPilotAutomaticallyUpdateCheckBox.check();
1117
		}
1118
1119
		DataPilotFieldSelect.click(1, 1);
1120
		DataPilotFieldSelect.openContextMenu();
1121
		menuItem("Add to Page").select();
1122
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1123
		sleep(1);
1124
1125
		DataPilotFieldSelect.click(1,30);
1126
		DataPilotFieldSelect.openContextMenu();
1127
		menuItem("Add to Column").select();
1128
		assertEquals("Name",CalcUtil.getCellText("A3"));
1129
		sleep(1);
1130
1131
		DataPilotFieldSelect.click(1,50);
1132
		DataPilotFieldSelect.openContextMenu();
1133
		menuItem("Add to Row").select();
1134
		assertEquals("Date",CalcUtil.getCellText("A4"));
1135
		sleep(1);
1136
1137
		DataPilotFieldSelect.click(1,70);
1138
		DataPilotFieldSelect.openContextMenu();
1139
		menuItem("Add to Data by->Sum").select();
1140
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1141
		assertEquals("266773",CalcUtil.getCellText("J23"));
1142
		sleep(1);
1143
1144
		CalcUtil.selectRange("B4:C4");
1145
		SpreadSheetCells.openContextMenu();
1146
		menuItem("Group->Group Selected Items").select();
1147
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1148
		assertEquals("Name",CalcUtil.getCellText("C3"));
1149
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1150
		assertEquals("266773",CalcUtil.getCellText("J24"));
1151
		sleep(1);
1152
1153
		CalcUtil.selectRange("D4");
1154
		SpreadSheetCells.openContextMenu();
1155
		menuItem("Group->Ungroup").select();
1156
		assertEquals("Name",CalcUtil.getCellText("B3"));
1157
		assertEquals("",CalcUtil.getCellText("C3"));
1158
		assertEquals("Bill Zhang",CalcUtil.getCellText("D4"));
1159
		assertEquals("266773",CalcUtil.getCellText("J23"));
1160
	}
1161
1162
	/**
1163
	 * 
1164
	 * Verify that DP panel will be synchronized with table while rename fields on panel.
1165
	 */
1166
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1167
	public void testRenameFieldAutoUpdate() {
1168
		String file = testFile("source_data01.ods");
1169
		startcenter.menuItem("File->Open...").select();
1170
		submitOpenDlg(file);
1171
		sleep(2);
1172
		CalcUtil.selectRange("A1:E27");
1173
		calc.menuItem("Data->DataPilot->Start...").select();
1174
		CreateDataPilotTableDialog.ok();
1175
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1176
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1177
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1178
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1179
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1180
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1181
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1182
1183
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1184
			DataPilotAutomaticallyUpdateCheckBox.check();
1185
		}
1186
1187
		DataPilotFieldSelect.click(1, 1);
1188
		DataPilotFieldSelect.openContextMenu();
1189
		menuItem("Add to Page").select();
1190
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1191
		sleep(1);
1192
1193
		DataPilotFieldSelect.click(1,30);
1194
		DataPilotFieldSelect.openContextMenu();
1195
		menuItem("Add to Column").select();
1196
		assertEquals("Name",CalcUtil.getCellText("A3"));
1197
		sleep(1);
1198
1199
		DataPilotFieldSelect.click(1,50);
1200
		DataPilotFieldSelect.openContextMenu();
1201
		menuItem("Add to Row").select();
1202
		assertEquals("Date",CalcUtil.getCellText("A4"));
1203
		sleep(1);
1204
1205
		DataPilotFieldSelect.click(1,70);
1206
		DataPilotFieldSelect.openContextMenu();
1207
		menuItem("Add to Data by->Sum").select();
1208
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1209
		assertEquals("266773",CalcUtil.getCellText("J23"));
1210
		sleep(1);
1211
1212
		DataPilotPanePageArea.click(1,1);
1213
		DataPilotPanePageArea.openContextMenu();
1214
		menuItem("Field Option").select();
1215
		DataPilotFieldDisplayNameEditBox.setText("New Locale");
1216
		DataPilotFieldOptionFieldTabPageDialog.ok();
1217
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
1218
		sleep(1);
1219
1220
		typeKeys("<$undo>");
1221
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1222
		sleep(1);
1223
1224
		typeKeys("<$redo>");
1225
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
1226
		sleep(1);
1227
1228
		CalcUtil.selectRange("B3");
1229
		SpreadSheetCells.openContextMenu();
1230
		menuItem("Field Option...").select();
1231
		DataPilotFieldDisplayNameEditBox.setText("New Name");
1232
		DataPilotFieldOptionFieldTabPageDialog.ok();
1233
		assertEquals("New Name",CalcUtil.getCellText("B3"));
1234
		sleep(1);
1235
1236
		typeKeys("<$undo>");
1237
		assertEquals("Name",CalcUtil.getCellText("B3"));
1238
		sleep(1);
1239
1240
		typeKeys("<$redo>");
1241
		assertEquals("New Name",CalcUtil.getCellText("B3"));
1242
		sleep(1);
1243
1244
		CalcUtil.selectRange("A4");
1245
		SpreadSheetCells.openContextMenu();
1246
		menuItem("Field Option...").select();
1247
		DataPilotFieldDisplayNameEditBox.setText("New Date");
1248
		DataPilotFieldOptionFieldTabPageDialog.ok();
1249
		assertEquals("New Date",CalcUtil.getCellText("A4"));
1250
		sleep(1);
1251
1252
		typeKeys("<$undo>");
1253
		assertEquals("Date",CalcUtil.getCellText("A4"));
1254
		sleep(1);
1255
1256
		typeKeys("<$redo>");
1257
		assertEquals("New Date",CalcUtil.getCellText("A4"));
1258
		sleep(1);
1259
1260
		DataPiloPaneDataArea.openContextMenu();
1261
		menuItem("Field Option").select();
1262
		DataPilotFieldDisplayNameEditBox.setText("New Sum - Order Number");
1263
		DataPilotFieldOptionFieldTabPageDialog.ok();
1264
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
1265
		sleep(1);
1266
1267
		typeKeys("<$undo>");
1268
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1269
		sleep(1);
1270
1271
		typeKeys("<$redo>");
1272
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
1273
		sleep(1);
1274
	}
1275
1276
	/**
1277
	 * 
1278
	 * Verify that DP panel will be synchronized with table while add fields on panel.
1279
	 */
1280
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1281
	public void testSortFunctionInGroupedField() {
1282
		String file = testFile("source_data01.ods");
1283
		startcenter.menuItem("File->Open...").select();
1284
		submitOpenDlg(file);
1285
		sleep(2);
1286
		CalcUtil.selectRange("A1:E27");
1287
		calc.menuItem("Data->DataPilot->Start...").select();		
1288
		CreateDataPilotTableDialog.ok();
1289
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1290
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1291
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1292
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1293
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1294
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1295
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1296
1297
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1298
			DataPilotAutomaticallyUpdateCheckBox.check();
1299
		}
1300
1301
		DataPilotFieldSelect.click(1, 1);
1302
		DataPilotFieldSelect.openContextMenu();
1303
		menuItem("Add to Page").select();
1304
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1305
		sleep(1);
1306
1307
		DataPilotFieldSelect.click(1,30);
1308
		DataPilotFieldSelect.openContextMenu();
1309
		menuItem("Add to Column").select();
1310
		assertEquals("Name",CalcUtil.getCellText("A3"));
1311
		sleep(1);
1312
1313
		DataPilotFieldSelect.click(1,50);
1314
		DataPilotFieldSelect.openContextMenu();
1315
		menuItem("Add to Row").select();
1316
		assertEquals("Date",CalcUtil.getCellText("A4"));
1317
		sleep(1);
1318
1319
		DataPilotFieldSelect.click(1,70);
1320
		DataPilotFieldSelect.openContextMenu();
1321
		menuItem("Add to Data by->Sum").select();
1322
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1323
		assertEquals("266773",CalcUtil.getCellText("J23"));
1324
		sleep(1);
1325
1326
		CalcUtil.selectRange("B4:C4");
1327
		SpreadSheetCells.openContextMenu();
1328
		menuItem("Group->Group Selected Items").select();
1329
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1330
		assertEquals("Name",CalcUtil.getCellInput("C3"));
1331
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1332
		assertEquals("266773",CalcUtil.getCellText("J24"));
1333
		sleep(1);
1334
1335
		CalcUtil.selectRange("B3");
1336
		SpreadSheetCells.openContextMenu();
1337
		menuItem("Field Option...").select();
1338
		DataPilotFieldOptionSortTabPageDialog.select();
1339
1340
		DataPilotFieldOptionSortDescendingRadioButton.check();
1341
		DataPilotFieldOptionFieldTabPageDialog.select();
1342
		DataPilotFieldOptionFieldTabPageDialog.ok();
1343
		sleep(1);
1344
1345
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
1346
		assertEquals("Group1",CalcUtil.getCellText("F4"));
1347
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
1348
		assertEquals("266773",CalcUtil.getCellText("J24"));
1349
1350
		typeKeys("<$undo>");
1351
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1352
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1353
		assertEquals("Kevin Wang",CalcUtil.getCellText("I4"));
1354
		assertEquals("266773",CalcUtil.getCellText("J24"));
1355
		sleep(1);
1356
1357
		typeKeys("<$redo>");
1358
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
1359
		assertEquals("Group1",CalcUtil.getCellText("F4"));
1360
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
1361
		assertEquals("266773",CalcUtil.getCellText("J24"));
1362
	}
1363
1364
	/**
1365
	 * 
1366
	 * Verify that DP panel will be synchronized with table while add fields on panel.
1367
	 */
1368
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1369
	public void testSubtotalsFunctionInGroupedField() {
1370
		String file = testFile("source_data01.ods");
1371
		startcenter.menuItem("File->Open...").select();
1372
		submitOpenDlg(file);
1373
		sleep(2);
1374
		CalcUtil.selectRange("A1:E27");
1375
		calc.menuItem("Data->DataPilot->Start...").select();		
1376
		CreateDataPilotTableDialog.ok();
1377
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1378
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1379
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1380
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1381
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1382
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1383
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1384
1385
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1386
			DataPilotAutomaticallyUpdateCheckBox.check();
1387
		}
1388
1389
		DataPilotFieldSelect.click(1, 1);
1390
		DataPilotFieldSelect.openContextMenu();
1391
		menuItem("Add to Page").select();
1392
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1393
		sleep(1);
1394
1395
		DataPilotFieldSelect.click(1,30);
1396
		DataPilotFieldSelect.openContextMenu();
1397
		menuItem("Add to Column").select();
1398
		assertEquals("Name",CalcUtil.getCellText("A3"));
1399
		sleep(1);
1400
1401
		DataPilotFieldSelect.click(1,50);
1402
		DataPilotFieldSelect.openContextMenu();
1403
		menuItem("Add to Row").select();
1404
		assertEquals("Date",CalcUtil.getCellText("A4"));
1405
		sleep(1);
1406
1407
		DataPilotFieldSelect.click(1,70);
1408
		DataPilotFieldSelect.openContextMenu();
1409
		menuItem("Add to Data by->Sum").select();
1410
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
1411
		assertEquals("266773",CalcUtil.getCellText("J23"));
1412
		sleep(1);
1413
1414
		CalcUtil.selectRange("B4:C4");
1415
		SpreadSheetCells.openContextMenu();
1416
		menuItem("Group->Group Selected Items").select();
1417
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1418
		assertEquals("Name",CalcUtil.getCellText("C3"));
1419
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1420
		assertEquals("266773",CalcUtil.getCellText("J24"));
1421
		sleep(1);
1422
1423
		CalcUtil.selectRange("B3");
1424
		SpreadSheetCells.openContextMenu();
1425
		menuItem("Field Option...").select();
1426
		DataPilotFieldOptionFiledSubtotalsPage.select();
1427
		sleep(1);
1428
1429
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
1430
1431
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
1432
		sleep(1);
1433
		DataPilotFieldOptionFieldTabPageDialog.select();
1434
		DataPilotFieldOptionFieldTabPageDialog.ok();
1435
1436
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
1437
		assertEquals("5",CalcUtil.getCellText("C24"));
1438
1439
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
1440
		assertEquals("2",CalcUtil.getCellText("E24"));
1441
1442
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
1443
		assertEquals("9",CalcUtil.getCellText("H24"));
1444
1445
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
1446
		assertEquals("1",CalcUtil.getCellText("J24"));
1447
1448
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
1449
		assertEquals("2",CalcUtil.getCellText("L24"));
1450
1451
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
1452
		assertEquals("4",CalcUtil.getCellText("N24"));
1453
1454
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
1455
		assertEquals("3",CalcUtil.getCellText("P24"));
1456
		assertEquals("266773",CalcUtil.getCellText("Q24"));
1457
		sleep(1);
1458
1459
		typeKeys("<$undo>");
1460
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
1461
		assertEquals("20518",CalcUtil.getCellText("C24"));
1462
1463
		assertEquals("",CalcUtil.getCellText("E4"));
1464
		assertEquals("20528",CalcUtil.getCellText("E24"));
1465
1466
		assertEquals("Joe Liu",CalcUtil.getCellText("H4"));
1467
		assertEquals("41056",CalcUtil.getCellText("H24"));
1468
1469
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
1470
		assertEquals("266773",CalcUtil.getCellText("J24"));
1471
1472
		assertEquals("",CalcUtil.getCellText("L4"));
1473
		assertEquals("",CalcUtil.getCellText("L24"));
1474
1475
		assertEquals("",CalcUtil.getCellText("N4"));
1476
		assertEquals("",CalcUtil.getCellText("N24"));
1477
1478
		assertEquals("",CalcUtil.getCellText("P4"));
1479
		assertEquals("",CalcUtil.getCellText("P24"));
1480
		assertEquals("",CalcUtil.getCellText("Q24"));
1481
		sleep(1);
1482
1483
		typeKeys("<$redo>");
1484
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
1485
		assertEquals("5",CalcUtil.getCellText("C24"));
1486
1487
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
1488
		assertEquals("2",CalcUtil.getCellText("E24"));
1489
1490
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
1491
		assertEquals("9",CalcUtil.getCellText("H24"));
1492
1493
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
1494
		assertEquals("1",CalcUtil.getCellText("J24"));
1495
1496
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
1497
		assertEquals("2",CalcUtil.getCellText("L24"));
1498
1499
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
1500
		assertEquals("4",CalcUtil.getCellText("N24"));
1501
1502
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
1503
		assertEquals("3",CalcUtil.getCellText("P24"));
1504
		assertEquals("266773",CalcUtil.getCellText("Q24"));
1505
	}
1506
1507
	/**
1508
	 * 
1509
	 * Verify that DP panel will be synchronized with table while add fields on panel.
1510
	 */
1511
	@Ignore("DataPilot in symphony is totally not the same in AOO")
1512
	public void testTopNFunctionInGroupedField() {
1513
		String file = testFile("source_data01.ods");
1514
		startcenter.menuItem("File->Open...").select();
1515
		submitOpenDlg(file);
1516
		sleep(2);
1517
		CalcUtil.selectRange("A1:E27");
1518
		calc.menuItem("Data->DataPilot->Start...").select();		
1519
		CreateDataPilotTableDialog.ok();
1520
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
1521
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
1522
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
1523
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
1524
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
1525
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
1526
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
1527
1528
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
1529
			DataPilotAutomaticallyUpdateCheckBox.check();
1530
		}
1531
1532
		DataPilotFieldSelect.click(1, 1);
1533
		DataPilotFieldSelect.openContextMenu();
1534
		menuItem("Add to Page").select();
1535
		assertEquals("Locale",CalcUtil.getCellText("A1"));
1536
		sleep(1);
1537
1538
		DataPilotFieldSelect.click(1,30);
1539
		DataPilotFieldSelect.openContextMenu();
1540
		menuItem("Add to Column").select();
1541
		assertEquals("Name",CalcUtil.getCellText("A3"));
1542
		sleep(1);
1543
1544
		DataPilotFieldSelect.click(1,50);
1545
		DataPilotFieldSelect.openContextMenu();
1546
		menuItem("Add to Row").select();
1547
		assertEquals("Date",CalcUtil.getCellText("A4"));
1548
		sleep(1);
1549
1550
		DataPilotFieldSelect.click(1,70);
1551
		DataPilotFieldSelect.openContextMenu();
1552
		menuItem("Add to Data by->Sum").select();
1553
		assertEquals("Sum - Order Number",CalcUtil.getCellInput("A3"));
1554
		assertEquals("266773",CalcUtil.getCellText("J23"));
1555
		sleep(1);
1556
1557
		CalcUtil.selectRange("B4:C4");
1558
		SpreadSheetCells.openContextMenu();
1559
		menuItem("Group->Group Selected Items").select();
1560
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1561
		assertEquals("Name",CalcUtil.getCellText("C3"));
1562
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1563
		assertEquals("266773",CalcUtil.getCellText("J24"));
1564
		sleep(1);
1565
1566
		CalcUtil.selectRange("A1");
1567
		sleep(1);
1568
1569
		// the Display resolution is 1280 * 1050 on windows and Linux and 1920 * 1080 on Mac
1570
		if(SystemUtil.isWindows()){
1571
			SpreadSheetCells.click(238, 43);
1572
		}
1573
		else if(SystemUtil.isLinux()){
1574
			SpreadSheetCells.click(267, 43);
1575
		}
1576
		else if(SystemUtil.isMac()){
1577
			SpreadSheetCells.click(238, 43);
1578
		}
1579
1580
		typeKeys("<tab>");
1581
		typeKeys("<tab>");
1582
		typeKeys("<tab>");
1583
		typeKeys("<tab>");
1584
		typeKeys("<tab>");
1585
		typeKeys("<tab>");
1586
		typeKeys("<enter>");
1587
		OnlyDisplayTopNItemCheckBox.check();
1588
		NumberOfItemShowInTopNEditBox.setText("4");
1589
		FieldTopNSettingDialog.ok();
1590
		sleep(1);
1591
1592
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1593
		assertEquals("51299",CalcUtil.getCellText("B24"));
1594
1595
		assertEquals("Group1",CalcUtil.getCellText("C4"));
1596
		assertEquals("71806",CalcUtil.getCellText("C24"));
1597
		assertEquals("",CalcUtil.getCellText("D4"));
1598
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
1599
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
1600
		assertEquals("20528",CalcUtil.getCellText("D24"));
1601
1602
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
1603
		assertEquals("41056",CalcUtil.getCellText("E24"));
1604
1605
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
1606
		assertEquals("30771",CalcUtil.getCellText("F24"));
1607
1608
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
1609
		assertEquals("215460",CalcUtil.getCellText("G24"));
1610
		sleep(1);
1611
1612
		typeKeys("<$undo>");
1613
		assertEquals("Name2",CalcUtil.getCellText("B3"));
1614
		assertEquals("Name",CalcUtil.getCellText("C3"));
1615
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1616
		assertEquals("266773",CalcUtil.getCellText("J24"));
1617
1618
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1619
		assertEquals("51299",CalcUtil.getCellText("B24"));
1620
1621
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
1622
		assertEquals("20518",CalcUtil.getCellText("C24"));
1623
		assertEquals("Group1",CalcUtil.getCellText("D4"));
1624
		assertEquals("Emmy Ma",CalcUtil.getCellText("C5"));
1625
		assertEquals("Amy Zhao",CalcUtil.getCellText("D5"));
1626
		assertEquals("71806",CalcUtil.getCellText("D24"));
1627
1628
		assertEquals("",CalcUtil.getCellText("E4"));
1629
		assertEquals("20528",CalcUtil.getCellText("E24"));
1630
1631
		assertEquals("Harry Wu",CalcUtil.getCellText("F4"));
1632
		assertEquals("10265",CalcUtil.getCellText("F24"));
1633
1634
		assertEquals("Jerry Lu",CalcUtil.getCellText("G4"));
1635
		assertEquals("20530",CalcUtil.getCellText("G24"));
1636
1637
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
1638
		assertEquals("266773",CalcUtil.getCellText("J24"));
1639
		sleep(1);
1640
1641
		typeKeys("<$redo>");
1642
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
1643
		assertEquals("51299",CalcUtil.getCellText("B24"));
1644
1645
		assertEquals("Group1",CalcUtil.getCellText("C4"));
1646
		assertEquals("71806",CalcUtil.getCellText("C24"));
1647
		assertEquals("",CalcUtil.getCellText("D4"));
1648
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
1649
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
1650
		assertEquals("20528",CalcUtil.getCellText("D24"));
1651
1652
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
1653
		assertEquals("41056",CalcUtil.getCellText("E24"));
1654
1655
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
1656
		assertEquals("30771",CalcUtil.getCellText("F24"));
1657
1658
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
1659
		assertEquals("215460",CalcUtil.getCellText("G24"));
1660
	}	
1661
}
(-)src/testcase/sc/validity/ValidityDialogDefaultValue.java (+90 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
package testcase.sc.validity;
25
26
import static testlib.UIMap.*;
27
import org.junit.After;
28
import static org.junit.Assert.*;
29
import org.junit.Before;
30
import org.junit.Rule;
31
import org.junit.Test;
32
import testlib.Log;
33
34
35
public class ValidityDialogDefaultValue {
36
37
	@Rule
38
	public Log LOG = new Log();
39
40
	@Before
41
	public void setUp() throws Exception {
42
		app.start();
43
44
		// New a spreadsheet, open Validity dialog
45
		startcenter.menuItem("File->New->Spreadsheet").select();
46
		calc.menuItem("Data->Validity...").select();
47
	}
48
49
	@After
50
	public void tearDown() throws Exception {
51
		app.close();
52
	}
53
54
	/**
55
	 * test Data -> Validity - UI(Criteria: Cell range).
56
	 */
57
	@Test
58
	public void testValidityUICellRange() {
59
60
		SC_ValidityCriteriaTabpage.select();
61
		SC_ValidityCriteriaAllowList.select("Cell range");
62
63
		assertEquals(true,SC_ValidityAllowBlankCells.isChecked());
64
		assertEquals(true,SC_ValidityShowSelectionList.isChecked());
65
		assertEquals(false,SC_ValiditySortEntriesAscending.isChecked());
66
		assertEquals(true,SC_ValidityAllowBlankCells.isEnabled());
67
		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
68
		assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled());
69
		assertEquals(true,SC_ValiditySourcePicker.isEnabled());
70
	}
71
72
	/**
73
	 * test Data -> Validity - UI(Error Alert: Default status)
74
	 */
75
	@Test
76
	public void testValidityUIErrorAlert() {
77
78
		SC_ValidityErrorAlertTabPage.select();
79
		assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled());
80
		assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText());
81
		assertEquals(true,SC_ValidityErrorMessageTitle.isEnabled());
82
		assertEquals("",SC_ValidityErrorMessageTitle.getText());
83
		assertEquals(true,SC_ValidityErrorMessage.isEnabled());
84
		assertEquals("",SC_ValidityErrorMessage.getText());
85
		SC_ValidityErrorAlertActionList.select("Macro");
86
		assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled());
87
	}
88
89
}
90
(-)src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java (+724 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.sd.headerandfooter;
28
29
import static testlib.AppUtil.fullPath;
30
import static testlib.AppUtil.openStartcenter;
31
import static testlib.AppUtil.submitOpenDlg;
32
import static testlib.AppUtil.submitSaveDlg;
33
import static testlib.UIMap.*;
34
import static org.junit.Assert.*;
35
import static org.openoffice.test.vcl.Tester.*;
36
import org.junit.After;
37
import org.junit.Before;
38
import org.junit.Rule;
39
import org.junit.Test;
40
import org.openoffice.test.common.FileUtil;
41
import testlib.ImpressUtil;
42
import testlib.Log;
43
44
public class HeaderAndFooterSetting{
45
46
	@Rule
47
	public Log LOG = new Log();
48
49
	@Before
50
	public void setUp() throws Exception {
51
		app.start();
52
53
		// New a impress, insert some slides
54
		app.dispatch("private:factory/simpress?slot=6686");
55
		PresentationWizard.ok();
56
		sleep(1);
57
58
		for(int i=0; i<5;i++){
59
			SD_InsertPageButtonOnToolbar.click();
60
			sleep(1);
61
		}
62
		// Pop up navigator panel
63
		impress.menuItem("View").select();
64
		if(!impress.menuItem("View->Navigator").isSelected()){
65
			impress.menuItem("View->Navigator").select();
66
		}
67
	}
68
69
	@After
70
	public void tearDown() throws Exception {
71
		app.close();
72
	}
73
74
	/**
75
	 * Test Copy slide with Apply Footer to same file and different file
76
	 * @throws Exception
77
	 */
78
	@Test
79
	public void testCopySlideWithApplyFooter() throws Exception{
80
81
		//add header and footer
82
		impress.menuItem("View->Header and Footer...").select();
83
		sleep(2);
84
85
		SD_DateAndTimeFooterOnSlide.check();
86
		SD_FixedDateAndTimeFooterOnSlide.check();
87
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
88
		SD_FooterTextOnSlide.check();
89
		SD_FooterTextOnSlideInput.setText("Footer Test");
90
		SD_SlideNumAsFooterOnSlide.check();
91
		SD_ApplyToAllButtonOnSlideFooter.click();
92
		sleep(1);
93
94
		ImpressSlideSorter.focus();
95
		for(int j=0; j<=2;j++){
96
			typeKeys("<up>");
97
		}
98
		impress.menuItem("View->Header and Footer...").select();
99
		sleep(1);
100
		SD_SlideNumAsFooterOnSlide.uncheck();
101
		SD_ApplyButtonOnSlideFooter.click();
102
103
		//paste to the same file
104
		ImpressSlideSorter.focus();
105
		app.dispatch(".uno:Copy");
106
		app.dispatch(".uno:Paste");
107
108
		impress.menuItem("View->Header and Footer...").select();
109
		sleep(1);
110
		assertEquals("Fix Date: 20120323", SD_FixedDateAndTimeOnSlideInput.getText());
111
		assertEquals("Footer Test", SD_FooterTextOnSlideInput.getText());
112
		assertEquals(false, SD_SlideNumAsFooterOnSlide.isChecked());
113
114
		//close header and footer dialog.
115
		SD_ApplyButtonOnSlideFooter.focus();
116
		typeKeys("<tab>");
117
		typeKeys("<enter>");
118
119
		//paste to different file
120
		impress.focus();
121
		app.dispatch("private:factory/simpress?slot=6686");
122
		PresentationWizard.ok();
123
		sleep(1);
124
		app.dispatch(".uno:Paste");
125
		ImpressSlideSorter.focus();
126
		typeKeys("<down>");
127
		sleep(1);
128
129
		impress.menuItem("View->Header and Footer...").select();
130
		sleep(1);
131
		assertEquals("Fix Date: 20120323", SD_FixedDateAndTimeOnSlideInput.getText());
132
		assertEquals("Footer Test", SD_FooterTextOnSlideInput.getText());
133
		assertEquals(false, SD_SlideNumAsFooterOnSlide.isChecked());
134
	}
135
136
	/**
137
	 * Test Copy slide with Apply to all Footer to same file and different file
138
	 * @throws Exception
139
	 */
140
	@Test
141
	public void testCopySlideWithApplyToAllFooter() throws Exception{
142
143
		//add header and footer
144
		impress.menuItem("View->Header and Footer...").select();
145
		sleep(2);
146
147
		SD_DateAndTimeFooterOnSlide.check();
148
		SD_FixedDateAndTimeFooterOnSlide.check();
149
		sleep(1);
150
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
151
		sleep(1);
152
		SD_FooterTextOnSlide.check();
153
		sleep(1);
154
		SD_FooterTextOnSlideInput.setText("Footer Test");
155
		sleep(1);
156
		SD_SlideNumAsFooterOnSlide.check();
157
		sleep(1);
158
		SD_ApplyToAllButtonOnSlideFooter.click();
159
		sleep(1);
160
161
		ImpressSlideSorter.focus();
162
		for(int j=0; j<=2;j++){
163
			typeKeys("<up>");
164
			sleep(1);
165
		}
166
		impress.menuItem("View->Header and Footer...").select();
167
		sleep(1);
168
		SD_SlideNumAsFooterOnSlide.uncheck();
169
		SD_ApplyButtonOnSlideFooter.click();
170
171
		//paste to the same file
172
		ImpressSlideSorter.focus();
173
		typeKeys("<up>");
174
		app.dispatch(".uno:Copy");
175
		typeKeys("<down>");
176
		sleep(1);
177
		app.dispatch(".uno:Paste");
178
179
		impress.menuItem("View->Header and Footer...").select();
180
		sleep(1);
181
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
182
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
183
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
184
185
		//close header and footer dialog.
186
		SD_ApplyButtonOnSlideFooter.focus();
187
		typeKeys("<tab>");
188
		typeKeys("<enter>");
189
190
		//paste to different file
191
		impress.focus();
192
		impress.menuItem("File->New->Presentation").select();
193
		sleep(1);
194
		app.dispatch(".uno:Paste");
195
		ImpressSlideSorter.focus();
196
		typeKeys("<down>");
197
		sleep(1);
198
199
		impress.menuItem("View->Header and Footer...").select();
200
		sleep(1);
201
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
202
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
203
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
204
	}
205
206
	/**
207
	 * Test Copy slide with Notes Footer to same file and different file
208
	 * @throws Exception
209
	 */
210
	@Test
211
	public void testCopySlideWithNotesHeaderFooter() throws Exception{
212
213
		//add header and footer
214
		impress.menuItem("View->Header and Footer...").select();
215
		sleep(1);
216
		SD_HeaderAndFooterOnNotesTabPage.select();
217
		SD_HeaderTextOnNotes.check();
218
		SD_HeaderTextOnNotesInput.setText("Header Test");
219
		SD_DateAndTimeFooterOnSlide.check();
220
		SD_FixedDateAndTimeFooterOnSlide.check();
221
		sleep(1);
222
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
223
		sleep(1);
224
		SD_FooterTextOnSlide.check();
225
		sleep(1);
226
		SD_FooterTextOnSlideInput.setText("Footer Test");
227
		sleep(1);
228
		SD_SlideNumAsFooterOnSlide.check();
229
		sleep(1);
230
		SD_ApplyToAllButtonOnSlideFooter.click();
231
		sleep(1);
232
233
		//paste to the same file
234
		ImpressSlideSorter.focus();
235
		typeKeys("<up>");
236
		app.dispatch(".uno:Copy");
237
		typeKeys("<down>");
238
		sleep(1);
239
		app.dispatch(".uno:Paste");
240
241
		ImpressUtil.getCurView().activate();
242
243
		impress.menuItem("View->Header and Footer...").select();
244
		sleep(1);
245
		SD_HeaderAndFooterOnNotesTabPage.select();
246
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
247
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
248
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
249
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
250
251
		//close header and footer dialog.
252
		SD_ApplyToAllButtonOnSlideFooter.focus();
253
		typeKeys("<tab>");
254
		typeKeys("<enter>");
255
256
		//paste to different file
257
		impress.focus();
258
		impress.menuItem("File->New->Presentation").select();
259
		sleep(1);
260
		app.dispatch(".uno:Paste");
261
		ImpressSlideSorter.focus();
262
		typeKeys("<down>");
263
		sleep(1);
264
		ImpressUtil.getCurView().activate();
265
		impress.menuItem("View->Header and Footer...").select();
266
		sleep(1);
267
		SD_HeaderAndFooterOnNotesTabPage.select();
268
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
269
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
270
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
271
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
272
	}
273
274
	/**
275
	 * Test duplicate slide with Apply to all Footer to same file 
276
	 * @throws Exception
277
	 */
278
	@Test
279
	public void testDuplicateSlideWithApplyToAllFooter() throws Exception{
280
281
		//add header and footer
282
		impress.menuItem("View->Header and Footer...").select();
283
		sleep(2);
284
285
		SD_DateAndTimeFooterOnSlide.check();
286
		SD_FixedDateAndTimeFooterOnSlide.check();
287
		sleep(1);
288
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
289
		sleep(1);
290
		SD_FooterTextOnSlide.check();
291
		sleep(1);
292
		SD_FooterTextOnSlideInput.setText("Footer Test");
293
		sleep(1);
294
		SD_SlideNumAsFooterOnSlide.check();
295
		sleep(1);
296
		SD_ApplyToAllButtonOnSlideFooter.click();
297
		sleep(1);
298
299
300
		ImpressSlideSorter.focus();
301
		for(int j=0; j<=2;j++){
302
			typeKeys("<up>");
303
			sleep(1);
304
		}
305
		impress.menuItem("Insert->Duplicate Slide").select();
306
		impress.menuItem("View->Header and Footer...").select();
307
		sleep(1);
308
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
309
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
310
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
311
	}
312
313
	/**
314
	 * Test footer not show on the first slide. 
315
	 * @throws Exception
316
	 */
317
	@Test
318
	public void testFooterNotShowOn1stSlide() throws Exception{
319
320
		//add header and footer
321
		impress.menuItem("View->Header and Footer...").select();
322
		sleep(2);
323
		SD_FooterTextOnSlide.check();
324
		sleep(1);
325
		SD_FooterTextOnSlideInput.setText("Footer Test");
326
		sleep(1);
327
		SD_FooterNotShowOn1stSlide.check();
328
		SD_ApplyToAllButtonOnSlideFooter.click();
329
		sleep(1);
330
331
		ImpressSlideSorter.focus();
332
		for(int j=0; j<5; j++){
333
			typeKeys("<up>");
334
		}
335
336
		impress.menuItem("View->Header and Footer...").select();
337
		sleep(1);
338
		assertEquals(true,SD_FooterNotShowOn1stSlide.isChecked());
339
		assertEquals(false,SD_FooterTextOnSlide.isChecked());
340
	}
341
342
	/**
343
	 * Test Insert Footer to focus slide.
344
	 * @throws Exception
345
	 */
346
	@Test
347
	public void testInsertApplyFooterOnSlide() throws Exception{
348
349
		//add header and footer to focus slide.
350
		impress.menuItem("View->Header and Footer...").select();
351
		sleep(2);
352
353
		SD_DateAndTimeFooterOnSlide.check();
354
		SD_FixedDateAndTimeFooterOnSlide.check();
355
		sleep(1);
356
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
357
		sleep(1);
358
		SD_FooterTextOnSlide.check();
359
		sleep(1);
360
		SD_FooterTextOnSlideInput.setText("Footer Test");
361
		sleep(1);
362
		SD_SlideNumAsFooterOnSlide.check();
363
		sleep(1);
364
		SD_ApplyButtonOnSlideFooter.click();
365
		sleep(1);
366
367
		impress.menuItem("View->Header and Footer...").select();
368
		sleep(1);
369
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
370
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
371
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
372
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
373
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
374
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
375
		//close header and footer dialog.
376
		SD_ApplyButtonOnSlideFooter.focus();
377
		typeKeys("<tab>");
378
		typeKeys("<enter>");
379
		//end close
380
381
		ImpressSlideSorter.focus();
382
		typeKeys("<up>");
383
384
		impress.menuItem("View->Header and Footer...").select();
385
		sleep(1);
386
		assertEquals("",SD_FixedDateAndTimeOnSlideInput.getText());
387
		assertEquals("",SD_FooterTextOnSlideInput.getText());
388
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
389
		//close header and footer dialog.
390
		SD_ApplyButtonOnSlideFooter.focus();
391
		typeKeys("<tab>");
392
		typeKeys("<enter>");
393
		//end close
394
395
		SD_InsertPageButtonOnToolbar.click();
396
		impress.menuItem("View->Header and Footer...").select();
397
		sleep(1);
398
		assertEquals("",SD_FixedDateAndTimeOnSlideInput.getText());
399
		assertEquals("",SD_FooterTextOnSlideInput.getText());
400
		assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked());
401
	}
402
403
	/**
404
	 * Test Insert Footer to Notes View
405
	 * @throws Exception
406
	 */
407
	@Test
408
	public void testInsertApplyToAllFooterOnNotes() throws Exception{
409
410
		//add header and footer to focus slide.
411
		impress.menuItem("View->Header and Footer...").select();
412
		sleep(1);
413
		SD_HeaderAndFooterOnNotesTabPage.select();
414
		SD_HeaderTextOnNotes.check();
415
		SD_HeaderTextOnNotesInput.setText("Header Test");
416
		SD_DateAndTimeFooterOnSlide.check();
417
		SD_FixedDateAndTimeFooterOnSlide.check();
418
		sleep(1);
419
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
420
		sleep(1);
421
		SD_FooterTextOnSlide.check();
422
		sleep(1);
423
		SD_FooterTextOnSlideInput.setText("Footer Test");
424
		sleep(1);
425
		SD_SlideNumAsFooterOnSlide.check();
426
		sleep(1);
427
		SD_ApplyToAllButtonOnSlideFooter.click();
428
		sleep(1);
429
430
		impress.menuItem("View->Header and Footer...").select();
431
		sleep(1);
432
		SD_HeaderAndFooterOnNotesTabPage.select();
433
		assertEquals(true,SD_HeaderTextOnNotes.isChecked());
434
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
435
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
436
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
437
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
438
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
439
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
440
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
441
		//close header and footer dialog.
442
		SD_ApplyToAllButtonOnSlideFooter.focus();
443
		typeKeys("<tab>");
444
		typeKeys("<enter>");
445
		//end close
446
447
		ImpressSlideSorter.focus();
448
		typeKeys("<up>");
449
450
		impress.menuItem("View->Header and Footer...").select();
451
		sleep(1);
452
		SD_HeaderAndFooterOnNotesTabPage.select();
453
		assertEquals(true,SD_HeaderTextOnNotes.isChecked());
454
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
455
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
456
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
457
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
458
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
459
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
460
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
461
		//close header and footer dialog.
462
		SD_ApplyToAllButtonOnSlideFooter.focus();
463
		typeKeys("<tab>");
464
		typeKeys("<enter>");
465
		//end close
466
467
		SD_InsertPageButtonOnToolbar.click();
468
		impress.menuItem("View->Header and Footer...").select();
469
		sleep(1);
470
		SD_HeaderAndFooterOnNotesTabPage.select();
471
		assertEquals(true,SD_HeaderTextOnNotes.isChecked());
472
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
473
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
474
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
475
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
476
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
477
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
478
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
479
	}
480
481
	/**
482
	 * Test Insert Footer to Slide, use Apply to All
483
	 * @throws Exception
484
	 */
485
	@Test
486
	public void testInsertApplyToAllFooterOnSlide() throws Exception{
487
488
		//add header and footer to focus slide.
489
		impress.menuItem("View->Header and Footer...").select();
490
		sleep(2);
491
492
		SD_DateAndTimeFooterOnSlide.check();
493
		SD_FixedDateAndTimeFooterOnSlide.check();
494
		sleep(1);
495
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
496
		sleep(1);
497
		SD_FooterTextOnSlide.check();
498
		sleep(1);
499
		SD_FooterTextOnSlideInput.setText("Footer Test");
500
		sleep(1);
501
		SD_SlideNumAsFooterOnSlide.check();
502
		sleep(1);
503
		SD_ApplyToAllButtonOnSlideFooter.click();
504
		sleep(1);
505
506
		impress.menuItem("View->Header and Footer...").select();
507
		sleep(1);
508
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
509
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
510
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
511
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
512
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
513
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
514
		//close header and footer dialog.
515
		SD_ApplyButtonOnSlideFooter.focus();
516
		typeKeys("<tab>");
517
		typeKeys("<enter>");
518
		//end close
519
520
		ImpressSlideSorter.focus();
521
		typeKeys("<up>");
522
523
		impress.menuItem("View->Header and Footer...").select();
524
		sleep(1);
525
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
526
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
527
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
528
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
529
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
530
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
531
		//close header and footer dialog.
532
		SD_ApplyButtonOnSlideFooter.focus();
533
		typeKeys("<tab>");
534
		typeKeys("<enter>");
535
		//end close
536
537
		SD_InsertPageButtonOnToolbar.click();
538
		impress.menuItem("View->Header and Footer...").select();
539
		sleep(1);
540
		assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked());
541
		assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked());
542
		assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText());
543
		assertEquals(true,SD_FooterTextOnSlide.isChecked());
544
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
545
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
546
	}
547
548
	/**
549
	 * Test Insert update automatically time footer to slides.
550
	 * @throws Exception
551
	 */
552
	@Test
553
	public void testInsertAutoUpdateTimeFooter() throws Exception{
554
555
		//add header and footer
556
		impress.menuItem("View->Header and Footer...").select();
557
		sleep(1);
558
		SD_AutoUpdateTimeFooter.check();
559
		SD_AutoUpdateTimeFooterType.select(7);
560
		String currentTime=SD_AutoUpdateTimeFooterType.getItemText(7);
561
		SD_ApplyToAllButtonOnSlideFooter.click();
562
		sleep(2);
563
564
		impress.menuItem("View->Header and Footer...").select();
565
		sleep(1);
566
567
		String currentTime2=SD_AutoUpdateTimeFooterType.getItemText(7);
568
		assertFalse(currentTime.equals(currentTime2));
569
	}
570
571
	/**
572
	 * Test Insert update automatically time footer to Notes view.
573
	 * @throws Exception
574
	 */
575
	@Test
576
	public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception{
577
578
		//add header and footer
579
		impress.menuItem("View->Header and Footer...").select();
580
		sleep(1);
581
		SD_HeaderAndFooterOnNotesTabPage.select();
582
		SD_AutoUpdateTimeFooter.check();
583
		SD_AutoUpdateTimeFooterType.select(7);
584
		String currentTime=SD_AutoUpdateTimeFooterType.getItemText(7);
585
		SD_ApplyToAllButtonOnSlideFooter.click();
586
		sleep(2);
587
588
		impress.menuItem("View->Header and Footer...").select();
589
		sleep(1);
590
		SD_HeaderAndFooterOnNotesTabPage.select();
591
		String currentTime2=SD_AutoUpdateTimeFooterType.getItemText(7);
592
593
		assertFalse(currentTime.equals(currentTime2));
594
	}
595
596
	/**
597
	 * Test Insert Header and Footer to Notes view.
598
	 * Save and ReOpen
599
	 * @throws Exception
600
	 */
601
	@Test
602
	public void testInsertHeaderFooterOnNotes() throws Exception{
603
604
		//add header and footer
605
		impress.menuItem("View->Header and Footer...").select();
606
		sleep(1);
607
		SD_HeaderAndFooterOnNotesTabPage.select();
608
		SD_HeaderTextOnNotes.check();
609
		SD_HeaderTextOnNotesInput.setText("Header Test");
610
		SD_DateAndTimeFooterOnSlide.check();
611
		SD_FixedDateAndTimeFooterOnSlide.check();
612
		sleep(1);
613
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
614
		sleep(1);
615
		SD_FooterTextOnSlide.check();
616
		sleep(1);
617
		SD_FooterTextOnSlideInput.setText("Footer Test");
618
		sleep(1);
619
		SD_SlideNumAsFooterOnSlide.check();
620
		sleep(1);
621
		SD_ApplyToAllButtonOnSlideFooter.click();
622
		sleep(1);
623
624
		ImpressSlideSorter.focus();
625
		typeKeys("<up>");
626
627
		impress.menuItem("View->Header and Footer...").select();
628
		sleep(1);
629
		SD_HeaderAndFooterOnNotesTabPage.select();
630
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
631
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
632
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
633
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
634
635
		//close header and footer dialog.
636
		SD_ApplyToAllButtonOnSlideFooter.focus();
637
		typeKeys("<tab>");
638
		typeKeys("<enter>");
639
640
		//save this file
641
		impress.menuItem("File->Save").select();
642
		String saveTo = fullPath("temp/" + "hello.odp");
643
		FileUtil.deleteFile(saveTo);
644
		submitSaveDlg(saveTo);	
645
		impress.menuItem("File->Close").select();
646
		sleep(2);
647
648
		//Reopen this file
649
		openStartcenter();
650
		app.dispatch(".uno:Open");
651
		String openFrom=fullPath("temp/" + "hello.odp");
652
		submitOpenDlg(openFrom);
653
654
		//check after reopen		
655
		impress.menuItem("View->Header and Footer...").select();
656
		sleep(1);
657
		SD_HeaderAndFooterOnNotesTabPage.select();
658
		assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText());
659
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
660
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
661
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
662
	}
663
664
	/**
665
	 * Test Insert Header and Footer to Slide
666
	 * Save and Reopen
667
	 * @throws Exception
668
	 */
669
	@Test
670
	public void testInsertHeaderFooterOnSlide() throws Exception{
671
672
		//add header and footer
673
		impress.menuItem("View->Header and Footer...").select();
674
		sleep(1);
675
		SD_DateAndTimeFooterOnSlide.check();
676
		SD_FixedDateAndTimeFooterOnSlide.check();
677
		sleep(1);
678
		SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
679
		sleep(1);
680
		SD_FooterTextOnSlide.check();
681
		sleep(1);
682
		SD_FooterTextOnSlideInput.setText("Footer Test");
683
		sleep(1);
684
		SD_SlideNumAsFooterOnSlide.check();
685
		sleep(1);
686
		SD_ApplyToAllButtonOnSlideFooter.click();
687
		sleep(1);
688
689
		ImpressSlideSorter.focus();
690
		typeKeys("<up>");
691
692
		impress.menuItem("View->Header and Footer...").select();
693
		sleep(1);
694
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
695
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
696
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
697
698
		//close header and footer dialog.
699
		SD_ApplyButtonOnSlideFooter.focus();
700
		typeKeys("<tab>");
701
		typeKeys("<enter>");
702
703
		//save this file
704
		impress.menuItem("File->Save").select();
705
		String saveTo = fullPath("temp/" + "hello.odp");
706
		FileUtil.deleteFile(saveTo);
707
		submitSaveDlg(saveTo);	
708
		impress.menuItem("File->Close").select();
709
		sleep(2);
710
711
		//Reopen this file
712
		openStartcenter();
713
		app.dispatch(".uno:Open");
714
		String openFrom=fullPath("temp/" + "hello.odp");
715
		submitOpenDlg(openFrom);
716
717
		//check after reopen		
718
		impress.menuItem("View->Header and Footer...").select();
719
		sleep(1);
720
		assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText());
721
		assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText());
722
		assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked());
723
	}
724
}

Return to issue 120321