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

(-)src/testcase/presentation/headerandfooter/HeaderAndFooterSetting.java (-724 lines)
Lines 1-724 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.presentation.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
}
(-)src/testcase/presentation/headerandfooter/OpenDocumentWithHeaderFooter.java (-171 lines)
Lines 1-171 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.presentation.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/celltext/InsertColumnsFromMainMenu.java (-115 lines)
Lines 1-115 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.celltext;
25
26
import static testlib.AppUtil.*;
27
import static testlib.UIMap.*;
28
29
import java.awt.Rectangle;
30
import java.io.File;
31
32
import org.junit.After;
33
import static org.junit.Assert.*;
34
import static org.openoffice.test.vcl.Tester.*;
35
36
import org.junit.Before;
37
import org.junit.Ignore;
38
import org.junit.Rule;
39
import org.junit.Test;
40
import org.openoffice.test.common.FileUtil;
41
import org.openoffice.test.common.GraphicsUtil;
42
43
import testlib.CalcUtil;
44
import testlib.Log;
45
46
public class InsertColumnsFromMainMenu {
47
	/**
48
	 * TestCapture helps us to do
49
	 * 1. Take a screenshot when failure occurs.
50
	 * 2. Collect extra data when OpenOffice crashes.
51
	 */	
52
	@Rule
53
	public Log LOG = new Log();
54
	
55
	/**
56
	 * initApp helps us to do 
57
	 * 1. Patch the OpenOffice to enable automation if necessary.
58
	 * 2. Start OpenOffice with automation enabled if necessary.
59
	 * 3. Reset OpenOffice to startcenter.
60
	 * 
61
	 * @throws java.lang.Exception
62
	 */
63
	@Before
64
	public void setUp() throws Exception {
65
		initApp();
66
	}
67
	
68
	/**
69
	 * Insert columns from main menu.
70
	 * 
71
	 * @throws Exception
72
	 */
73
	@Test
74
	public void insertColumnsFromMainMenu(){
75
		//Create a new text document
76
		startcenter.menuItem("File->New->Spreadsheet").select();
77
		sleep(3);
78
		//input Test123 into cell A1
79
		String expect="Test123";
80
		CalcUtil.selectRange("A1");
81
		typeKeys(expect+"<enter>");
82
		CalcUtil.selectRange("A1");
83
		//Insert 1 columns before column A form main menu,so Cell A1 move B1, check it
84
		calc.menuItem("Insert->Columns...").select();
85
		assertEquals("1",SC_NumberOfColumnsRowsToInsert.getText());
86
		SC_InsertColumnsRowsdialog.ok();
87
		sleep(1);
88
		assertEquals(expect,CalcUtil.getCellText("B1"));
89
		
90
		//Check the default insert column number is same as columns you select
91
		CalcUtil.selectRange("E1");
92
		typeKeys(expect + "<enter>");
93
		CalcUtil.selectRange("A1:D4");
94
		calc.menuItem("Insert->Columns...").select();
95
		assertEquals("4",SC_NumberOfColumnsRowsToInsert.getText());
96
		
97
		//insert 4 column number after select column, then E1 move to I1, check it
98
		SC_InsertColumnsRowsAfterSelectColumn.check();
99
		assertTrue(SC_InsertColumnsRowsAfterSelectColumn.isEnabled());
100
		SC_InsertColumnsRowsdialog.ok();
101
		sleep(1);
102
		assertEquals(expect,CalcUtil.getCellText("I1"));
103
		
104
		//input 1024 in insert columns number, then the warning dialog pop up check it
105
		CalcUtil.selectRange("A1");
106
		calc.menuItem("Insert->Columns...").select();
107
		SC_NumberOfColumnsRowsToInsert.setText("1024");
108
		SC_InsertColumnsRowsdialog.ok();
109
		assertEquals("Filled cells cannot be shifted" + "\n"
110
				+ "beyond the sheet.",
111
				ActiveMsgBox.getMessage());
112
		typeKeys("<enter>");
113
	}
114
115
}
(-)src/testcase/sc/celltext/InsertRowsFromMainMenu.java (-117 lines)
Lines 1-117 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.celltext;
25
import static testlib.AppUtil.*;
26
import static testlib.UIMap.*;
27
28
import java.awt.Rectangle;
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.Ignore;
37
import org.junit.Rule;
38
import org.junit.Test;
39
import org.openoffice.test.common.FileUtil;
40
import org.openoffice.test.common.GraphicsUtil;
41
42
import testlib.CalcUtil;
43
import testlib.Log;
44
45
public class InsertRowsFromMainMenu {
46
47
	/**
48
	 * TestCapture helps us to do
49
	 * 1. Take a screenshot when failure occurs.
50
	 * 2. Collect extra data when OpenOffice crashes.
51
	 */	
52
	@Rule
53
	public Log LOG = new Log();
54
	
55
	/**
56
	 * initApp helps us to do 
57
	 * 1. Patch the OpenOffice to enable automation if necessary.
58
	 * 2. Start OpenOffice with automation enabled if necessary.
59
	 * 3. Reset OpenOffice to startcenter.
60
	 * 
61
	 * @throws java.lang.Exception
62
	 */
63
	@Before
64
	public void setUp() throws Exception {
65
		initApp();
66
	}
67
	/**
68
	 * Insert rows from main menu.
69
	 * 
70
	 * @throws Exception
71
	 */
72
	@Test
73
	public void insertRowsFromMainMenu(){
74
		//Create a new text document
75
		startcenter.menuItem("File->New->Spreadsheet").select();
76
		sleep(3);
77
		//input 1 into cell A1
78
		String expect = "Test123";
79
		CalcUtil.selectRange("A1");
80
		typeKeys(expect + "<enter>");
81
		CalcUtil.selectRange("A1");
82
		// Insert 1 columns before column A form main menu,so Cell A1 move A2, check it
83
		calc.menuItem("Insert->Rows...").select();
84
		assertEquals("1",SC_NumberOfColumnsRowsToInsert.getText());
85
		SC_InsertColumnsRowsdialog.ok();
86
		sleep(1);
87
		assertEquals(expect, CalcUtil.getCellText("A2"));
88
		//input Test123 into A5, select first 4 rows, in insert dialog, the defaul row should be 4, check it
89
		CalcUtil.selectRange("A5");
90
		typeKeys(expect + "<enter>");
91
		CalcUtil.selectRange("A1:A4");
92
		calc.menuItem("Insert->Rows...").select();
93
		assertEquals("4",SC_NumberOfColumnsRowsToInsert.getText());
94
		
95
		//After insert 4 rows after the selected rows, the A5 move to A9, check it
96
		SC_InsertColumnsRowsAfterSelectColumn.check();
97
		assertTrue(SC_InsertColumnsRowsAfterSelectColumn.isEnabled());
98
		SC_InsertColumnsRowsdialog.ok();
99
		sleep(1);
100
		assertEquals(expect,CalcUtil.getCellText("A9"));
101
		
102
		//Input some value into 1048576
103
		CalcUtil.selectRange("A1048576");
104
		typeKeys("1048576<enter>");
105
		assertEquals("1048576",CalcUtil.getCellText("A1048576"));
106
		// Select many rows input 65536 in insert Rows number, verify the warning message, check it
107
		CalcUtil.selectRange("A1:A50000");
108
		sleep(1);
109
		calc.menuItem("Insert->Rows...").select();
110
		SC_NumberOfColumnsRowsToInsert.setText("65536");
111
		SC_InsertColumnsRowsdialog.ok();
112
		assertEquals("Filled cells cannot be shifted" + "\n"
113
				+ "beyond the sheet.",
114
				ActiveMsgBox.getMessage());
115
		typeKeys("<enter>");
116
	}
117
}
(-)src/testcase/sc/chart/ChartDialogCancelBack.java (-97 lines)
Lines 1-97 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.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Ignore;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
/**
50
 * 
51
 *
52
 */
53
public class ChartDialogCancelBack {
54
	/**
55
	 * TestCapture helps us to do
56
	 * 1. Take a screenshot when failure occurs.
57
	 * 2. Collect extra data when OpenOffice crashes.
58
	 */	
59
	@Rule
60
	public Log LOG = new Log();
61
	
62
	/**
63
	 * initApp helps us to do 
64
	 * 1. Patch the OpenOffice to enable automation if necessary.
65
	 * 2. Start OpenOffice with automation enabled if necessary.
66
	 * 3. Reset OpenOffice to startcenter.
67
	 * 
68
	 * @throws java.lang.Exception
69
	 */
70
	@Before
71
	public void setUp() throws Exception {
72
		initApp();
73
	}
74
	/**
75
	 * Test cancel and back button in chart wizard dialog
76
	 * 
77
	 * @throws java.lang.Exception
78
	 */
79
	@Test
80
	public void test() {
81
		//Create a new text document
82
		startcenter.menuItem("File->New->Spreadsheet").select();
83
		sleep(3);
84
		calc.menuItem("Insert->Chart...").select();
85
		sleep(1);
86
		WizardNextButton.click();
87
		sleep(1);
88
		assertTrue(ChartRangeChooseTabPage.isEnabled());
89
		WizardBackButton.click();
90
		sleep(1);
91
		assertTrue(ChartTypeChooseTabPage.isEnabled());
92
		Chart_Wizard.cancel();
93
		sleep(1);
94
		assertFalse(Chart_Wizard.exists());
95
	}
96
97
}
(-)src/testcase/sc/chart/ChartDialogSetting.java (-38 / +24 lines)
Lines 26-97 Link Here
26
 */
26
 */
27
package testcase.sc.chart;
27
package testcase.sc.chart;
28
28
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
29
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
30
import org.junit.After;
36
import static org.junit.Assert.*;
31
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
32
import org.junit.Before;
40
import org.junit.Ignore;
41
import org.junit.Rule;
33
import org.junit.Rule;
42
import org.junit.Test;
34
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
35
import testlib.Log;
48
36
49
/**
37
/**
50
 * 
38
 * Test the setting about chart dialog in spreadsheet
51
 *
52
 */
39
 */
53
public class ChartDialogCancelBack {
40
public class ChartDialogSetting {
54
	/**
41
55
	 * TestCapture helps us to do
56
	 * 1. Take a screenshot when failure occurs.
57
	 * 2. Collect extra data when OpenOffice crashes.
58
	 */	
59
	@Rule
42
	@Rule
60
	public Log LOG = new Log();
43
	public Log LOG = new Log();
61
	
44
62
	/**
63
	 * initApp helps us to do 
64
	 * 1. Patch the OpenOffice to enable automation if necessary.
65
	 * 2. Start OpenOffice with automation enabled if necessary.
66
	 * 3. Reset OpenOffice to startcenter.
67
	 * 
68
	 * @throws java.lang.Exception
69
	 */
70
	@Before
45
	@Before
71
	public void setUp() throws Exception {
46
	public void setUp() throws Exception {
72
		initApp();
47
		app.start();
48
49
		// Create a new spreadsheet document
50
		startcenter.menuItem("File->New->Spreadsheet").select();
73
	}
51
	}
52
53
	@After
54
	public void tearDown() throws Exception {
55
		app.close();
56
	}
57
74
	/**
58
	/**
75
	 * Test cancel and back button in chart wizard dialog
59
	 * Test cancel and back button in chart wizard dialog
76
	 * 
60
	 * 
77
	 * @throws java.lang.Exception
61
	 * @throws java.lang.Exception
78
	 */
62
	 */
79
	@Test
63
	@Test
80
	public void test() {
64
	public void testChartDialogCancelBack() {
81
		//Create a new text document
82
		startcenter.menuItem("File->New->Spreadsheet").select();
83
		sleep(3);
84
		calc.menuItem("Insert->Chart...").select();
65
		calc.menuItem("Insert->Chart...").select();
85
		sleep(1);
86
		WizardNextButton.click();
66
		WizardNextButton.click();
87
		sleep(1);
88
		assertTrue(ChartRangeChooseTabPage.isEnabled());
67
		assertTrue(ChartRangeChooseTabPage.isEnabled());
89
		WizardBackButton.click();
68
		WizardBackButton.click();
90
		sleep(1);
91
		assertTrue(ChartTypeChooseTabPage.isEnabled());
69
		assertTrue(ChartTypeChooseTabPage.isEnabled());
92
		Chart_Wizard.cancel();
70
		Chart_Wizard.cancel();
93
		sleep(1);
94
		assertFalse(Chart_Wizard.exists());
71
		assertFalse(Chart_Wizard.exists());
95
	}
72
	}
96
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
	}
97
}
83
}
(-)src/testcase/sc/chart/ChartWizardTitle.java (-86 lines)
Lines 1-86 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.AppUtil.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Ignore;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
/**
50
 * 
51
 *
52
 */
53
public class ChartWizardTitle {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify Chart Wizard dialog title words
75
	 */
76
	@Test
77
	public void test() {
78
		// Create a new text document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		calc.menuItem("Insert->Chart...").select();
82
		assertEquals("Chart Wizard",Chart_Wizard.getText());
83
		Chart_Wizard.cancel();
84
	}
85
86
}
(-)src/testcase/sc/datapilot/CopyPasteDataPilotTable.java (-153 lines)
Lines 1-153 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
/**
48
 * 
49
 *
50
 */
51
public class CopyPasteDataPilotTable {
52
	/**
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
57
	public Log LOG = new Log();
58
59
	/**
60
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
61
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
62
	 * Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	/**
71
	 * 
72
	 * Verify copy and paste Data Pilot Table
73
	 */
74
	@Test
75
	public void test() {
76
		//Open the sample file
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		
82
		//Create DataPilotTable and verify the content
83
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();		
85
		CreateDataPilotTableDialog.ok();
86
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
87
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
88
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
89
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
90
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
91
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
92
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
93
		
94
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
95
			DataPilotAutomaticallyUpdateCheckBox.check();
96
		}
97
		
98
		//Add field into every area
99
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Page").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("A3"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A4"));
115
		sleep(1);
116
		
117
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Data by->Sum").select();
120
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
121
		assertEquals("266773",CalcUtil.getCellText("J23"));
122
		sleep(1);
123
		
124
		//Copy and paste the data pilot table and verify the content
125
		CalcUtil.selectRange("A1:J24");
126
		typeKeys("<$copy>");
127
		
128
		CalcUtil.selectRange("A26");
129
		typeKeys("<$paste>");
130
		assertEquals("Locale",CalcUtil.getCellText("A26"));
131
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
132
		assertEquals("Name",CalcUtil.getCellText("B28"));
133
		assertEquals("Date",CalcUtil.getCellText("A29"));
134
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
135
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
136
		assertEquals("266773",CalcUtil.getCellText("J48"));
137
		sleep(1);
138
		
139
		CalcUtil.selectRange("A1:J24");
140
		typeKeys("<$copy>");
141
		CalcUtil.selectRange("$A.$A29");
142
		typeKeys("<$paste>");
143
		assertEquals("Locale",CalcUtil.getCellText("A29"));
144
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A31"));
145
		assertEquals("Name",CalcUtil.getCellText("B31"));
146
		assertEquals("Date",CalcUtil.getCellText("A32"));
147
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
148
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
149
		assertEquals("266773",CalcUtil.getCellText("J51"));
150
		
151
	}
152
153
}
(-)src/testcase/sc/datapilot/DataPilotAddFieldsAutoUpdate.java (-140 lines)
Lines 1-140 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
/**
48
 *
49
 *
50
 */
51
public class DataPilotAddFieldsAutoUpdate {
52
	/**
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
57
	public Log LOG = new Log();
58
59
	/**
60
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
61
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
62
	 * Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	/**
71
	 * 
72
	 * Verify that DP panel will be synchronized with table while add fields on panel.
73
	 */
74
	@Test
75
	public void test() {
76
		//open the sample file Create DataPilotTable and verify the content
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
			
95
		}
96
		sleep(1);
97
		
98
		//Add field into every area
99
		DataPilotFieldSelect.click(1, 30);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Column").select();
102
		assertEquals("Name",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,50);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Row").select();
108
		assertEquals("Date",CalcUtil.getCellText("A2"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.drag(1, 1, 184, 80);
112
		assertEquals("Locale",CalcUtil.getCellText("A1"));
113
		sleep(1);
114
		
115
		typeKeys("<$undo>");
116
		assertEquals("",CalcUtil.getCellText("A1"));
117
		sleep(1);
118
		
119
		typeKeys("<$redo>");
120
		assertEquals("Locale",CalcUtil.getCellText("A1"));
121
		sleep(1);
122
		
123
		DataPilotFieldSelect.click(1,70);
124
		DataPilotFieldSelect.openContextMenu();
125
		menuItem("Add to Data by->Sum").select();
126
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
127
		assertEquals("266773",CalcUtil.getCellText("J23"));
128
		sleep(1);
129
		
130
		typeKeys("<$undo>");
131
		assertEquals("",CalcUtil.getCellText("A3"));
132
		sleep(1);
133
		
134
		typeKeys("<$redo>");
135
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
136
		assertEquals("266773",CalcUtil.getCellText("J23"));
137
		sleep(1);
138
	}
139
140
}
(-)src/testcase/sc/datapilot/DataPilotAddFieldsManualUpdate.java (-166 lines)
Lines 1-166 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
/**
48
 * 
49
 *
50
 */
51
public class DataPilotAddFieldsManualUpdate {
52
	/**
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
57
	public Log LOG = new Log();
58
59
	/**
60
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
61
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
62
	 * Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
67
	public void setUp() throws Exception {
68
		initApp();
69
	}
70
	/**
71
	 * 
72
	 * Verify that DP panel will be synchronized with table while add fields on panel.
73
	 */
74
	@Test
75
	public void test() {
76
		//open the sample file Create DataPilotTable and verify the content
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
			
95
		}
96
		
97
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
98
		
99
		sleep(1);
100
		DataPilotFieldSelect.click(1, 30);
101
		DataPilotFieldSelect.openContextMenu();
102
		menuItem("Add to Column").select();
103
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
104
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
105
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
106
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
107
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
108
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
109
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
110
		sleep(1);
111
		
112
		DataPilotFieldSelect.click(1,50);
113
		DataPilotFieldSelect.openContextMenu();
114
		menuItem("Add to Row").select();
115
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
116
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
117
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
118
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
119
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
120
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
121
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
122
		sleep(1);
123
		
124
		CalcUtil.selectRange("B20");
125
		ActiveMsgBox.yes();
126
		sleep(1);
127
		assertEquals("Name",CalcUtil.getCellText("B1"));
128
		assertEquals("Date",CalcUtil.getCellText("A2"));
129
		
130
		DataPilotFieldSelect.drag(1, 1, 184, 80);
131
		assertEquals("Name",CalcUtil.getCellText("B1"));
132
		assertEquals("Date",CalcUtil.getCellText("A2"));
133
		sleep(1);
134
		
135
		DataPilotFieldSelect.click(1,70);
136
		DataPilotFieldSelect.openContextMenu();
137
		menuItem("Add to Data by->Sum").select();
138
		assertEquals("Name",CalcUtil.getCellText("B1"));
139
		assertEquals("Date",CalcUtil.getCellText("A2"));
140
		sleep(1);
141
		
142
		DataPilotTableUpdateButton.click();
143
		assertEquals("Locale",CalcUtil.getCellText("A1"));
144
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
145
		assertEquals("266773",CalcUtil.getCellText("J23"));
146
		sleep(1);
147
		
148
		
149
		typeKeys("<$undo>");
150
		assertEquals("Name",CalcUtil.getCellText("B1"));
151
		assertEquals("Date",CalcUtil.getCellText("A2"));
152
		sleep(1);
153
		
154
		
155
		typeKeys("<$redo>");
156
		assertEquals("Locale",CalcUtil.getCellText("A1"));
157
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
158
		assertEquals("266773",CalcUtil.getCellText("J23"));
159
		sleep(1);
160
		
161
		DataPilotAutomaticallyUpdateCheckBox.check();
162
		assertTrue(DataPilotAutomaticallyUpdateCheckBox.isChecked());
163
	}
164
165
}
166
(-)src/testcase/sc/datapilot/DataPilotChangeDataFieldOptionAutoUpdate.java (-198 lines)
Lines 1-198 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class DataPilotChangeDataFieldOptionAutoUpdate {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		//open the sample file Create DataPilotTable and verify the content
78
		String file = testFile("source_data01.ods");
79
		startcenter.menuItem("File->Open...").select();
80
		submitOpenDlg(file);
81
		sleep(2);
82
		CalcUtil.selectRange("A1:E27");
83
		calc.menuItem("Data->DataPilot->Start...").select();
84
		CreateDataPilotTableDialog.ok();
85
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
86
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
87
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
88
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
89
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
90
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
91
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
			
95
		}
96
		sleep(1);
97
		
98
		DataPilotFieldSelect.click(1, 1);
99
		DataPilotFieldSelect.openContextMenu();
100
		menuItem("Add to Column").select();
101
		assertEquals("Locale",CalcUtil.getCellText("A1"));
102
		sleep(1);
103
		
104
		DataPilotFieldSelect.click(1,30);
105
		DataPilotFieldSelect.openContextMenu();
106
		menuItem("Add to Column").select();
107
		assertEquals("Name",CalcUtil.getCellText("B1"));
108
		sleep(1);
109
		
110
		DataPilotFieldSelect.click(1,50);
111
		DataPilotFieldSelect.openContextMenu();
112
		menuItem("Add to Row").select();
113
		assertEquals("Date",CalcUtil.getCellText("A3"));
114
		sleep(1);
115
		
116
		DataPilotFieldSelect.click(1,70);
117
		DataPilotFieldSelect.openContextMenu();
118
		menuItem("Add to Row").select();
119
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
120
		sleep(1);
121
		
122
		DataPilotFieldSelect.click(1,90);
123
		DataPilotFieldSelect.openContextMenu();
124
		menuItem("Add to Data by->Sum").select();
125
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
126
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
127
		sleep(1);
128
		
129
		//Change Locale option settings, and verify it
130
		String target = "New Locale";
131
		DataPilotColumnArea.click(1,1);
132
		DataPilotColumnArea.openContextMenu();
133
		menuItem("Field Option").select();
134
		DataPilotFieldOptionFieldTabPageDialog.select();
135
		DataPilotFieldDisplayNameEditBox.setText(target);
136
		sleep(1);
137
		
138
		DataPilotFieldOptionFiledSubtotalsPage.select();
139
		sleep(1);
140
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
141
		sleep(1);
142
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
143
		sleep(1);
144
		
145
		DataPilotFieldOptionSortTabPageDialog.select();
146
		
147
148
		DataPilotFieldOptionSortDescendingRadioButton.check();
149
		DataPilotFieldOptionFieldTabPageDialog.select();
150
		DataPilotFieldOptionFieldTabPageDialog.ok();
151
		sleep(1);
152
		
153
		assertEquals("New Locale",CalcUtil.getCellText("C1"));
154
		assertEquals("USA",CalcUtil.getCellText("C2"));
155
		assertEquals("USA Count - Amount",CalcUtil.getCellInput("H2"));
156
		assertEquals("17",CalcUtil.getCellInput("H30"));
157
		assertEquals("China Count - Amount",CalcUtil.getCellInput("L2"));
158
		assertEquals("9",CalcUtil.getCellInput("L30"));
159
		assertEquals("32779.17",CalcUtil.getCellInput("M30"));
160
		
161
		DataPilotColumnArea.click(1,30);
162
		DataPilotColumnArea.openContextMenu();
163
		menuItem("Field Option").select();
164
		DataPilotFieldOptionFieldTabPageDialog.select();
165
		DataPilotFieldShowItemWithoutDataCheckBox.check();
166
		DataPilotFieldOptionFieldTabPageDialog.ok();
167
		assertEquals("Emmy Ma",CalcUtil.getCellText("F3"));
168
		assertEquals("32779.17",CalcUtil.getCellInput("U30"));
169
		
170
		CalcUtil.selectRange("C1");
171
		SpreadSheetCells.openContextMenu();
172
		menuItem("Field Option...").select();
173
		DataPilotFieldOptionFieldTabPageDialog.select();
174
		DataPilotFieldDisplayNameEditBox.setText("Locale");
175
		DataPilotFieldOptionFiledSubtotalsPage.select();
176
		DataPilotFieldOptionSubTotalsNeverRadioButton.check();
177
		sleep(1);
178
		DataPilotFieldOptionSortTabPageDialog.select();
179
		DataPilotFieldOptionSortAscendingRadioButton.check();
180
		DataPilotFieldOptionFieldTabPageDialog.select();
181
		DataPilotFieldOptionFieldTabPageDialog.ok();
182
		
183
		assertEquals("Locale",CalcUtil.getCellText("C1"));
184
		assertEquals("China",CalcUtil.getCellText("C2"));
185
		assertEquals("USA",CalcUtil.getCellText("K2"));
186
		assertEquals("32779.17",CalcUtil.getCellInput("S30"));
187
		
188
		
189
		CalcUtil.selectRange("D1");
190
		SpreadSheetCells.openContextMenu();
191
		menuItem("Field Option...").select();
192
		DataPilotFieldOptionFieldTabPageDialog.select();
193
		DataPilotFieldShowItemWithoutDataCheckBox.uncheck();
194
		DataPilotFieldOptionFieldTabPageDialog.ok();
195
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
196
	}
197
198
}
(-)src/testcase/sc/datapilot/DataPivotTable.java (-36 / +1544 lines)
Lines 28-84 Link Here
28
28
29
import static testlib.AppUtil.*;
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
31
import org.junit.After;
36
import static org.junit.Assert.*;
32
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
33
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
34
import org.junit.Before;
35
import org.junit.Ignore;
40
import org.junit.Rule;
36
import org.junit.Rule;
41
import org.junit.Test;
37
import org.openoffice.test.common.SystemUtil;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
38
import testlib.CalcUtil;
46
import testlib.Log;
39
import testlib.Log;
40
47
/**
41
/**
48
 * 
42
 * Test Data->Pivot Table
49
 *
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.
50
 */
47
 */
51
public class CopyPasteDataPilotTable {
48
public class DataPivotTable {
52
	/**
49
53
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
54
	 * Collect extra data when OpenOffice crashes.
55
	 */
56
	@Rule
50
	@Rule
57
	public Log LOG = new Log();
51
	public Log LOG = new Log();
58
52
59
	/**
60
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
61
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
62
	 * Reset OpenOffice to startcenter.
63
	 * 
64
	 * @throws java.lang.Exception
65
	 */
66
	@Before
53
	@Before
67
	public void setUp() throws Exception {
54
	public void setUp() throws Exception {
68
		initApp();
55
		app.start();
69
	}
56
	}
57
58
	@After
59
	public void tearDown() throws Exception {
60
		app.close();
61
	}
62
70
	/**
63
	/**
71
	 * 
64
	 * 
72
	 * Verify copy and paste Data Pilot Table
65
	 * Verify copy and paste Data Pilot Table
73
	 */
66
	 */
74
	@Test
67
	@Ignore("DataPilot in symphony is totally not the same in AOO")
75
	public void test() {
68
	public void testCopyPasteDataPilotTable() {
76
		//Open the sample file
69
		//Open the sample file
77
		String file = testFile("source_data01.ods");
70
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
71
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
72
		submitOpenDlg(file);
80
		sleep(2);
73
		sleep(2);
81
		
74
82
		//Create DataPilotTable and verify the content
75
		//Create DataPilotTable and verify the content
83
		CalcUtil.selectRange("A1:E27");
76
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();		
77
		calc.menuItem("Data->DataPilot->Start...").select();		
Lines 90-130 Link Here
90
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
83
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
91
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
84
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
92
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
85
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
93
		
86
94
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
87
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
95
			DataPilotAutomaticallyUpdateCheckBox.check();
88
			DataPilotAutomaticallyUpdateCheckBox.check();
96
		}
89
		}
97
		
90
98
		//Add field into every area
91
		//Add field into every area
99
		DataPilotFieldSelect.click(1, 1);
92
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
93
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Page").select();
94
		menuItem("Add to Page").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
95
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
96
		sleep(1);
104
		
97
105
		DataPilotFieldSelect.click(1,30);
98
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
99
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
100
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("A3"));
101
		assertEquals("Name",CalcUtil.getCellText("A3"));
109
		sleep(1);
102
		sleep(1);
110
		
103
111
		DataPilotFieldSelect.click(1,50);
104
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
105
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
106
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A4"));
107
		assertEquals("Date",CalcUtil.getCellText("A4"));
115
		sleep(1);
108
		sleep(1);
116
		
109
117
		DataPilotFieldSelect.click(1,70);
110
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
111
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Data by->Sum").select();
112
		menuItem("Add to Data by->Sum").select();
120
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
113
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
121
		assertEquals("266773",CalcUtil.getCellText("J23"));
114
		assertEquals("266773",CalcUtil.getCellText("J23"));
122
		sleep(1);
115
		sleep(1);
123
		
116
124
		//Copy and paste the data pilot table and verify the content
117
		//Copy and paste the data pilot table and verify the content
125
		CalcUtil.selectRange("A1:J24");
118
		CalcUtil.selectRange("A1:J24");
126
		typeKeys("<$copy>");
119
		typeKeys("<$copy>");
127
		
120
128
		CalcUtil.selectRange("A26");
121
		CalcUtil.selectRange("A26");
129
		typeKeys("<$paste>");
122
		typeKeys("<$paste>");
130
		assertEquals("Locale",CalcUtil.getCellText("A26"));
123
		assertEquals("Locale",CalcUtil.getCellText("A26"));
Lines 135-141 Link Here
135
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
128
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
136
		assertEquals("266773",CalcUtil.getCellText("J48"));
129
		assertEquals("266773",CalcUtil.getCellText("J48"));
137
		sleep(1);
130
		sleep(1);
138
		
131
139
		CalcUtil.selectRange("A1:J24");
132
		CalcUtil.selectRange("A1:J24");
140
		typeKeys("<$copy>");
133
		typeKeys("<$copy>");
141
		CalcUtil.selectRange("$A.$A29");
134
		CalcUtil.selectRange("$A.$A29");
Lines 147-153 Link Here
147
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
140
		assertEquals("Total Result",CalcUtil.getCellText("A51"));
148
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
141
		assertEquals("Total Result",CalcUtil.getCellText("J32"));
149
		assertEquals("266773",CalcUtil.getCellText("J51"));
142
		assertEquals("266773",CalcUtil.getCellText("J51"));
150
		
151
	}
143
	}
152
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
	}	
153
}
1661
}
(-)src/testcase/sc/datapilot/DragMoveFunctionOfGroupedField.java (-151 lines)
Lines 1-151 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 *
50
 *
51
 */
52
public class DragMoveFunctionOfGroupedField {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that Verify the Drag/Move function of Grouped field 
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
92
			DataPilotAutomaticallyUpdateCheckBox.check();
93
			
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		CalcUtil.selectRange("B4:C4");
122
		SpreadSheetCells.openContextMenu();
123
		menuItem("Group->Group Selected Items").select();
124
		assertEquals("Name2",CalcUtil.getCellText("B3"));
125
		assertEquals("Name",CalcUtil.getCellText("C3"));
126
		assertEquals("Group1",CalcUtil.getCellText("D4"));
127
		assertEquals("266773",CalcUtil.getCellText("J24"));
128
		sleep(1);
129
		
130
		DataPilotColumnArea.click(1,1);
131
		DataPilotColumnArea.openContextMenu();
132
		menuItem("Move to Row").select();
133
		assertEquals("Name2",CalcUtil.getCellText("B4"));
134
		assertEquals("Group1",CalcUtil.getCellText("B6"));
135
		assertEquals("266773",CalcUtil.getCellText("K31"));
136
		sleep(1);
137
		
138
		typeKeys("<$undo>");
139
		assertEquals("Name2",CalcUtil.getCellText("B3"));
140
		assertEquals("Name",CalcUtil.getCellText("C3"));
141
		assertEquals("Group1",CalcUtil.getCellText("D4"));
142
		assertEquals("266773",CalcUtil.getCellText("J24"));
143
		sleep(1);
144
		
145
		typeKeys("<$redo>");
146
		assertEquals("Name2",CalcUtil.getCellText("B4"));
147
		assertEquals("Group1",CalcUtil.getCellText("B6"));
148
		assertEquals("266773",CalcUtil.getCellText("K31"));
149
	}
150
151
}
(-)src/testcase/sc/datapilot/HideShowPanel.java (-165 lines)
Lines 1-165 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
49
/**
50
 * 
51
 *
52
 */
53
public class HideShowPanel {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify that DP panel while switch focus among tables with same/different source range.
75
	 */
76
	@Test
77
	public void test() {
78
		String file = testFile("source_data01.ods");
79
		startcenter.menuItem("File->Open...").select();
80
		submitOpenDlg(file);
81
		sleep(2);
82
		CalcUtil.selectRange("A1:E27");
83
		calc.menuItem("Data->DataPilot->Start...").select();		
84
		CreateDataPilotTableDialog.ok();
85
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
86
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
87
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
88
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
89
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
90
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
91
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
92
		
93
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
94
			DataPilotAutomaticallyUpdateCheckBox.check();
95
		}
96
		
97
		DataPilotFieldSelect.click(1, 1);
98
		DataPilotFieldSelect.openContextMenu();
99
		menuItem("Add to Page").select();
100
		assertEquals("Locale",CalcUtil.getCellText("A1"));
101
		sleep(1);
102
		
103
		DataPilotFieldSelect.click(1,30);
104
		DataPilotFieldSelect.openContextMenu();
105
		menuItem("Add to Column").select();
106
		assertEquals("Name",CalcUtil.getCellText("A3"));
107
		sleep(1);
108
		
109
		DataPilotFieldSelect.click(1,50);
110
		DataPilotFieldSelect.openContextMenu();
111
		menuItem("Add to Row").select();
112
		assertEquals("Date",CalcUtil.getCellText("A4"));
113
		sleep(1);
114
		
115
		DataPilotFieldSelect.click(1,70);
116
		DataPilotFieldSelect.openContextMenu();
117
		menuItem("Add to Data by->Sum").select();
118
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
119
		assertEquals("266773",CalcUtil.getCellText("J23"));
120
		sleep(1);
121
		
122
		CalcUtil.selectRange("A1:J24");
123
		typeKeys("<$copy>");
124
		
125
		CalcUtil.selectRange("A26");
126
		typeKeys("<$paste>");
127
		assertEquals("Locale",CalcUtil.getCellText("A26"));
128
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
129
		assertEquals("Name",CalcUtil.getCellText("B28"));
130
		assertEquals("Date",CalcUtil.getCellText("A29"));
131
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
132
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
133
		assertEquals("266773",CalcUtil.getCellText("J48"));
134
		sleep(1);
135
136
		CalcUtil.selectRange("A1");
137
		SpreadSheetCells.openContextMenu();
138
		menuItem("Show DataPilot Panel").select();
139
		assertFalse(DataPilotPanel.exists());
140
		sleep(1);
141
		
142
		CalcUtil.selectRange("A1");
143
		SpreadSheetCells.openContextMenu();
144
		menuItem("Show DataPilot Panel").select();
145
		assertTrue(DataPilotPanel.exists());
146
		sleep(1);
147
		
148
		DataPilotPanel.close();
149
		assertFalse(DataPilotPanel.exists());
150
		sleep(1);
151
		
152
		CalcUtil.selectRange("A26");
153
		DataPilotButton.click();
154
		sleep(1);
155
		assertTrue(DataPilotPanel.exists());
156
		assertEquals("Locale",CalcUtil.getCellText("A26"));
157
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A28"));
158
		assertEquals("Name",CalcUtil.getCellText("B28"));
159
		assertEquals("Date",CalcUtil.getCellText("A29"));
160
		assertEquals("Total Result",CalcUtil.getCellText("A48"));
161
		assertEquals("Total Result",CalcUtil.getCellText("J29"));
162
		assertEquals("266773",CalcUtil.getCellText("J48"));
163
	}
164
165
}
(-)src/testcase/sc/datapilot/MoveFieldInSameAreaManualUpdate.java (-174 lines)
Lines 1-174 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class MoveFieldInSameAreaManualUpdate {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
85
			DataPilotAutomaticallyUpdateCheckBox.check();
86
			
87
		}
88
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
89
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
90
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
91
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
92
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
93
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
94
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
95
		sleep(1);
96
		
97
		DataPilotFieldSelect.click(1, 1);
98
		DataPilotFieldSelect.openContextMenu();
99
		menuItem("Add to Column").select();
100
		assertEquals("Locale",CalcUtil.getCellText("A1"));
101
		sleep(1);
102
		
103
		DataPilotFieldSelect.click(1,30);
104
		DataPilotFieldSelect.openContextMenu();
105
		menuItem("Add to Column").select();
106
		assertEquals("Name",CalcUtil.getCellText("B1"));
107
		sleep(1);
108
		
109
		DataPilotFieldSelect.click(1,50);
110
		DataPilotFieldSelect.openContextMenu();
111
		menuItem("Add to Row").select();
112
		assertEquals("Date",CalcUtil.getCellText("A3"));
113
		sleep(1);
114
		
115
		DataPilotFieldSelect.click(1,70);
116
		DataPilotFieldSelect.openContextMenu();
117
		menuItem("Add to Row").select();
118
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
119
		sleep(1);
120
		
121
		DataPilotFieldSelect.click(1,90);
122
		DataPilotFieldSelect.openContextMenu();
123
		menuItem("Add to Data by->Sum").select();
124
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
125
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
126
		sleep(1);
127
		
128
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
129
		DataPilotColumnArea.drag(1, 1, 1, 60);
130
		assertEquals("Name",CalcUtil.getCellText("D1"));
131
		assertEquals("Locale",CalcUtil.getCellText("C1"));
132
		sleep(1);
133
		
134
		DataPilotPaneRowArea.drag(1,1, 1, 60);
135
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
136
		assertEquals("Date",CalcUtil.getCellText("A3"));
137
		sleep(1);
138
		
139
		CalcUtil.selectRange("A33");
140
		ActiveMsgBox.yes();
141
		assertEquals("Name",CalcUtil.getCellText("C1"));
142
		assertEquals("Locale",CalcUtil.getCellText("D1"));
143
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
144
		assertEquals("Date",CalcUtil.getCellText("B3"));
145
		sleep(1);
146
		
147
		DataPilotColumnArea.click(1,1);
148
		DataPilotColumnArea.openContextMenu();
149
		menuItem("Move Down").select();
150
		assertEquals("Name",CalcUtil.getCellText("C1"));
151
		assertEquals("Locale",CalcUtil.getCellText("D1"));
152
		sleep(1);
153
		
154
		DataPilotPaneRowArea.click(1,30);
155
		DataPilotPaneRowArea.openContextMenu();
156
		menuItem("Move Up").select();
157
		assertEquals("Order Number",CalcUtil.getCellText("A3"));
158
		assertEquals("Date",CalcUtil.getCellText("B3"));
159
		sleep(1);
160
		
161
		CalcUtil.selectRange("A33");
162
		ActiveMsgBox.yes();
163
		assertEquals("Name",CalcUtil.getCellText("D1"));
164
		assertEquals("Locale",CalcUtil.getCellText("C1"));
165
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
166
		assertEquals("Date",CalcUtil.getCellText("A3"));
167
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
168
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
169
		DataPilotAutomaticallyUpdateCheckBox.check();
170
		sleep(1);
171
		
172
	}
173
174
}
(-)src/testcase/sc/datapilot/MoveFieldToOtherAreaAutoUpdate.java (-153 lines)
Lines 1-153 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
32
import java.awt.MenuItem;
33
import java.awt.Rectangle;
34
import java.io.File;
35
36
import org.junit.After;
37
import static org.junit.Assert.*;
38
import static org.openoffice.test.vcl.Tester.*;
39
40
import org.junit.Before;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
50
/**
51
 * 
52
 *
53
 */
54
public class MoveFieldToOtherAreaAutoUpdate {
55
	/**
56
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
57
	 * Collect extra data when OpenOffice crashes.
58
	 */
59
	@Rule
60
	public Log LOG = new Log();
61
62
	/**
63
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
64
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
65
	 * Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
70
	public void setUp() throws Exception {
71
		initApp();
72
	}
73
	/**
74
	 * 
75
	 * Verify that DP panel will be synchronized with table while move fields on panel.
76
	 */
77
	@Test
78
	public void test() {
79
		String file = testFile("source_data01.ods");
80
		startcenter.menuItem("File->Open...").select();
81
		submitOpenDlg(file);
82
		sleep(2);
83
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();
85
		CreateDataPilotTableDialog.ok();
86
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
87
			DataPilotAutomaticallyUpdateCheckBox.check();
88
			
89
		}
90
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
91
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
92
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
93
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
94
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
95
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
96
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
97
		sleep(1);
98
		
99
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Column").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("B1"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A3"));
115
		sleep(1);
116
		
117
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Row").select();
120
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
121
		sleep(1);
122
		
123
		DataPilotFieldSelect.click(1,90);
124
		DataPilotFieldSelect.openContextMenu();
125
		menuItem("Add to Data by->Sum").select();
126
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
127
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
128
		sleep(1);
129
		
130
		DataPilotPaneRowArea.drag(1,1, 1, -50);
131
		assertEquals("Date",CalcUtil.getCellText("D1"));
132
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
133
		sleep(1);
134
		
135
		DataPilotColumnArea.click(1,50);
136
		DataPilotColumnArea.openContextMenu();
137
		menuItem("Move to Row").select();
138
		assertEquals("Date",CalcUtil.getCellText("B3"));
139
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
140
		sleep(1);
141
		
142
		typeKeys("<$undo>");
143
		assertEquals("Date",CalcUtil.getCellText("D1"));
144
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
145
		sleep(1);
146
		
147
		typeKeys("<$redo>");
148
		assertEquals("Date",CalcUtil.getCellText("B3"));
149
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
150
		
151
	}
152
153
}
(-)src/testcase/sc/datapilot/MoveFieldToOtherAreaDiscardChange.java (-158 lines)
Lines 1-158 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
32
import java.awt.MenuItem;
33
import java.awt.Rectangle;
34
import java.io.File;
35
36
import org.junit.After;
37
import static org.junit.Assert.*;
38
import static org.openoffice.test.vcl.Tester.*;
39
40
import org.junit.Before;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
50
/**
51
 *
52
 *
53
 */
54
public class MoveFieldToOtherAreaDiscardChange {
55
	/**
56
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
57
	 * Collect extra data when OpenOffice crashes.
58
	 */
59
	@Rule
60
	public Log LOG = new Log();
61
62
	/**
63
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
64
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
65
	 * Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
70
	public void setUp() throws Exception {
71
		initApp();
72
	}
73
	/**
74
	 * 
75
	 * Verify that DP panel will be synchronized with table while move fields on panel.
76
	 */
77
	@Test
78
	public void test() {
79
		String file = testFile("source_data01.ods");
80
		startcenter.menuItem("File->Open...").select();
81
		submitOpenDlg(file);
82
		sleep(2);
83
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();
85
		CreateDataPilotTableDialog.ok();
86
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
87
			DataPilotAutomaticallyUpdateCheckBox.check();
88
			
89
		}
90
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
91
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
92
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
93
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
94
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
95
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
96
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
97
		sleep(1);
98
		
99
		DataPilotFieldSelect.click(1, 1);
100
		DataPilotFieldSelect.openContextMenu();
101
		menuItem("Add to Column").select();
102
		assertEquals("Locale",CalcUtil.getCellText("A1"));
103
		sleep(1);
104
		
105
		DataPilotFieldSelect.click(1,30);
106
		DataPilotFieldSelect.openContextMenu();
107
		menuItem("Add to Column").select();
108
		assertEquals("Name",CalcUtil.getCellText("B1"));
109
		sleep(1);
110
		
111
		DataPilotFieldSelect.click(1,50);
112
		DataPilotFieldSelect.openContextMenu();
113
		menuItem("Add to Row").select();
114
		assertEquals("Date",CalcUtil.getCellText("A3"));
115
		sleep(1);
116
		
117
		DataPilotFieldSelect.click(1,70);
118
		DataPilotFieldSelect.openContextMenu();
119
		menuItem("Add to Row").select();
120
		assertEquals("Order Number",CalcUtil.getCellText("B3"));
121
		sleep(1);
122
		
123
		DataPilotFieldSelect.click(1,90);
124
		DataPilotFieldSelect.openContextMenu();
125
		menuItem("Add to Data by->Sum").select();
126
		assertEquals("Sum - Amount",CalcUtil.getCellText("A1"));
127
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
128
		sleep(1);
129
		
130
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
131
		
132
		DataPilotPaneRowArea.drag(1,1, 1, -50);
133
		assertEquals("Date",CalcUtil.getCellText("A3"));
134
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
135
		sleep(1);
136
		
137
		CalcUtil.selectRange("B33");
138
		ActiveMsgBox.yes();
139
		assertEquals("Date",CalcUtil.getCellText("D1"));
140
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
141
		sleep(1);
142
		
143
		DataPilotColumnArea.click(1,50);
144
		DataPilotColumnArea.openContextMenu();
145
		menuItem("Move to Row").select();
146
		assertEquals("Date",CalcUtil.getCellText("D1"));
147
		assertEquals("32779.17",CalcUtil.getCellInput("AB31"));
148
		
149
		CalcUtil.selectRange("B33");
150
		ActiveMsgBox.yes();
151
		assertEquals("Date",CalcUtil.getCellText("B3"));
152
		assertEquals("32779.17",CalcUtil.getCellInput("K30"));
153
		sleep(1);
154
		
155
		DataPilotAutomaticallyUpdateCheckBox.check();
156
	}
157
158
}
(-)src/testcase/sc/datapilot/MoveTableNarrowSpaceToShowTheTable.java (-144 lines)
Lines 1-144 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
49
/**
50
 * 
51
 *
52
 */
53
public class MoveTableNarrowSpaceToShowTheTable {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify that DP panel will be synchronized with table while move table.
75
	 * After the field name get changed, when you refresh the data, the DataPilot table will change to empty table
76
	 * if you create table small than the empty table, the table size will get larger
77
	 * if there is another DataPilot table exist in the larger range, there will pop a warning.
78
	 */
79
	@Test
80
	public void test() {
81
		String file = testFile("source_data01.ods");
82
		startcenter.menuItem("File->Open...").select();
83
		submitOpenDlg(file);
84
		sleep(2);
85
		CalcUtil.selectRange("A1:E27");
86
		calc.menuItem("Data->DataPilot->Start...").select();
87
		CreateDataPilotTableDialog.ok();
88
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
89
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
90
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
91
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
92
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
93
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
94
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
95
		
96
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
97
			DataPilotAutomaticallyUpdateCheckBox.check();
98
		}
99
		
100
		DataPilotFieldSelect.click(1, 1);
101
		DataPilotFieldSelect.openContextMenu();
102
		menuItem("Add to Page").select();
103
		assertEquals("Locale",CalcUtil.getCellText("A1"));
104
		sleep(1);
105
		
106
		CalcUtil.selectRange("A1:B4");
107
		typeKeys("<$copy>");
108
		CalcUtil.selectRange("C1");
109
		typeKeys("<$paste>");
110
		sleep(1);
111
		
112
		CalcUtil.selectRange("$A.A1");
113
		typeKeys("New Locale" + "<enter>");
114
		
115
		CalcUtil.selectRange("$DataPilot_A_1.A1");
116
		SpreadSheetCells.openContextMenu();
117
		menuItem("Refresh Data").select();
118
		ActiveMsgBox.ok();
119
		
120
		CalcUtil.selectRange("A1:B4");
121
		SpreadSheetCells.drag(80, 45, 80, 350);
122
		
123
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B20"));
124
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B22"));
125
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B23"));
126
		assertEquals("Page Area",CalcUtil.getCellText("B25"));
127
		assertEquals("Row Area",CalcUtil.getCellText("B28"));
128
		assertEquals("Column Area",CalcUtil.getCellText("D27"));
129
		assertEquals("Data Area",CalcUtil.getCellText("D29"));
130
		DataPilotPanel.close();
131
		sleep(1);
132
		
133
		CalcUtil.selectRange("C1:D4");
134
		SpreadSheetCells.drag(210, 50, 10, 50);
135
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
136
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
137
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
138
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
139
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
140
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
141
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
142
	}
143
144
}
(-)src/testcase/sc/datapilot/OneMRowDataPilotRefresh.java (-132 lines)
Lines 1-132 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
49
/**
50
 * 
51
 *
52
 */
53
public class OneMRowDataPilotRefresh {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify the data pilot result table refresh after source data changed
75
	 */
76
	@Test
77
	public void test() {
78
		String file = testFile("source_data01.ods");
79
		startcenter.menuItem("File->Open...").select();
80
		submitOpenDlg(file);
81
		sleep(2);
82
		calc.maximize();
83
		CalcUtil.selectRange("A1:E27");
84
		typeKeys("<$copy>");
85
		CalcUtil.selectRange("A1048540");
86
		typeKeys("<$paste>");
87
		calc.menuItem("Data->DataPilot->Start...").select();
88
		DataPilotTableToExistPlaceRadioButton.check();
89
		assertTrue(DataPilotTableToExistPlaceRadioButton.isChecked());
90
		DataPilotTableToExistPlaceEditBox.setText("$A.$F$1048540");
91
		CreateDataPilotTableDialog.ok();
92
		sleep(1);
93
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
94
			DataPilotAutomaticallyUpdateCheckBox.check();
95
			
96
		}
97
		DataPilotFieldSelect.click(1, 1);
98
		DataPilotFieldSelect.openContextMenu();
99
		menuItem("Add to Page").select();
100
		assertEquals("Locale",CalcUtil.getCellText("F1048540"));
101
		sleep(1);
102
		
103
		DataPilotFieldSelect.click(1,30);
104
		DataPilotFieldSelect.openContextMenu();
105
		menuItem("Add to Column").select();
106
		assertEquals("Name",CalcUtil.getCellText("F1048542"));
107
		sleep(1);
108
		
109
		DataPilotFieldSelect.click(1,50);
110
		DataPilotFieldSelect.openContextMenu();
111
		menuItem("Add to Row").select();
112
		assertEquals("Date",CalcUtil.getCellText("F1048543"));
113
		sleep(1);
114
		
115
		DataPilotFieldSelect.click(1,70);
116
		DataPilotFieldSelect.openContextMenu();
117
		menuItem("Add to Data by->Sum").select();
118
		assertEquals("Sum - Order Number",CalcUtil.getCellText("F1048542"));
119
		assertEquals("266773",CalcUtil.getCellText("O1048562"));
120
		sleep(1);
121
		
122
		CalcUtil.selectRange("D1048541");
123
		typeKeys("10000<enter>");
124
		sleep(1);
125
		
126
		CalcUtil.selectRange("O1048562");
127
		calc.menuItem("Data->DataPilot->Refresh").select();
128
		assertEquals("266525",CalcUtil.getCellText("O1048562"));
129
		
130
	}
131
132
}
(-)src/testcase/sc/datapilot/RemoveFieldsDiscardChange.java (-158 lines)
Lines 1-158 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class RemoveFieldsDiscardChange {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while remove fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		DataPilotAutomaticallyUpdateCheckBox.uncheck();
122
		
123
		DataPilotColumnArea.drag(1, 1, -30, 1);
124
		assertEquals("Name",CalcUtil.getCellText("B3"));
125
		assertEquals("266773",CalcUtil.getCellText("J23"));
126
		sleep(1);
127
		
128
		DataPilotPaneRowArea.click(1,1);
129
		DataPilotPaneRowArea.openContextMenu();
130
		menuItem("Remove").select();
131
		assertEquals("Date",CalcUtil.getCellText("A4"));
132
		assertEquals("266773",CalcUtil.getCellText("J23"));
133
		sleep(1);
134
		
135
		DataPilotPanePageArea.drag(1, 1, -30, 1);
136
		assertEquals("Locale",CalcUtil.getCellText("A1"));
137
		assertEquals("266773",CalcUtil.getCellText("J23"));
138
		sleep(1);
139
		
140
		DataPiloPaneDataArea.openContextMenu();
141
		menuItem("Remove").select();
142
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
143
		assertEquals("266773",CalcUtil.getCellText("J23"));
144
		
145
		CalcUtil.selectRange("B25");
146
		ActiveMsgBox.yes();
147
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
148
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
149
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
150
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
151
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
152
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
153
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
154
		
155
		DataPilotAutomaticallyUpdateCheckBox.check();
156
	}
157
158
}
(-)src/testcase/sc/datapilot/RemoveFunctionOfGroupedField.java (-139 lines)
Lines 1-139 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 *
50
 *
51
 */
52
public class RemoveFunctionOfGroupedField {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify the Remove function of Grouped field 
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();		
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		CalcUtil.selectRange("B4:C4");
122
		SpreadSheetCells.openContextMenu();
123
		menuItem("Group->Group Selected Items").select();
124
		assertEquals("Name2",CalcUtil.getCellText("B3"));
125
		assertEquals("Name",CalcUtil.getCellText("C3"));
126
		assertEquals("Group1",CalcUtil.getCellText("D4"));
127
		assertEquals("266773",CalcUtil.getCellText("J24"));
128
		sleep(1);
129
		
130
		CalcUtil.selectRange("D4");
131
		SpreadSheetCells.openContextMenu();
132
		menuItem("Group->Ungroup").select();
133
		assertEquals("Name",CalcUtil.getCellText("B3"));
134
		assertEquals("",CalcUtil.getCellText("C3"));
135
		assertEquals("Bill Zhang",CalcUtil.getCellText("D4"));
136
		assertEquals("266773",CalcUtil.getCellText("J23"));
137
	}
138
139
}
(-)src/testcase/sc/datapilot/RenameFieldAutoUpdate.java (-186 lines)
Lines 1-186 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class RenameFieldAutoUpdate {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while rename fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		DataPilotPanePageArea.click(1,1);
122
		DataPilotPanePageArea.openContextMenu();
123
		menuItem("Field Option").select();
124
		DataPilotFieldDisplayNameEditBox.setText("New Locale");
125
		DataPilotFieldOptionFieldTabPageDialog.ok();
126
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
127
		sleep(1);
128
		
129
		typeKeys("<$undo>");
130
		assertEquals("Locale",CalcUtil.getCellText("A1"));
131
		sleep(1);
132
		
133
		typeKeys("<$redo>");
134
		assertEquals("New Locale",CalcUtil.getCellText("A1"));
135
		sleep(1);
136
		
137
		CalcUtil.selectRange("B3");
138
		SpreadSheetCells.openContextMenu();
139
		menuItem("Field Option...").select();
140
		DataPilotFieldDisplayNameEditBox.setText("New Name");
141
		DataPilotFieldOptionFieldTabPageDialog.ok();
142
		assertEquals("New Name",CalcUtil.getCellText("B3"));
143
		sleep(1);
144
		
145
		typeKeys("<$undo>");
146
		assertEquals("Name",CalcUtil.getCellText("B3"));
147
		sleep(1);
148
		
149
		typeKeys("<$redo>");
150
		assertEquals("New Name",CalcUtil.getCellText("B3"));
151
		sleep(1);
152
		
153
		CalcUtil.selectRange("A4");
154
		SpreadSheetCells.openContextMenu();
155
		menuItem("Field Option...").select();
156
		DataPilotFieldDisplayNameEditBox.setText("New Date");
157
		DataPilotFieldOptionFieldTabPageDialog.ok();
158
		assertEquals("New Date",CalcUtil.getCellText("A4"));
159
		sleep(1);
160
		
161
		typeKeys("<$undo>");
162
		assertEquals("Date",CalcUtil.getCellText("A4"));
163
		sleep(1);
164
		
165
		typeKeys("<$redo>");
166
		assertEquals("New Date",CalcUtil.getCellText("A4"));
167
		sleep(1);
168
		
169
		DataPiloPaneDataArea.openContextMenu();
170
		menuItem("Field Option").select();
171
		DataPilotFieldDisplayNameEditBox.setText("New Sum - Order Number");
172
		DataPilotFieldOptionFieldTabPageDialog.ok();
173
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
174
		sleep(1);
175
		
176
		typeKeys("<$undo>");
177
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
178
		sleep(1);
179
		
180
		typeKeys("<$redo>");
181
		assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3"));
182
		sleep(1);
183
		
184
	}
185
186
}
(-)src/testcase/sc/datapilot/SortFunctionInGroupedField.java (-159 lines)
Lines 1-159 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 *
50
 *
51
 */
52
public class SortFunctionInGroupedField {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();		
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		CalcUtil.selectRange("B4:C4");
122
		SpreadSheetCells.openContextMenu();
123
		menuItem("Group->Group Selected Items").select();
124
		assertEquals("Name2",CalcUtil.getCellText("B3"));
125
		assertEquals("Name",CalcUtil.getCellInput("C3"));
126
		assertEquals("Group1",CalcUtil.getCellText("D4"));
127
		assertEquals("266773",CalcUtil.getCellText("J24"));
128
		sleep(1);
129
		
130
		CalcUtil.selectRange("B3");
131
		SpreadSheetCells.openContextMenu();
132
		menuItem("Field Option...").select();
133
		DataPilotFieldOptionSortTabPageDialog.select();
134
		
135
		DataPilotFieldOptionSortDescendingRadioButton.check();
136
		DataPilotFieldOptionFieldTabPageDialog.select();
137
		DataPilotFieldOptionFieldTabPageDialog.ok();
138
		sleep(1);
139
		
140
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
141
		assertEquals("Group1",CalcUtil.getCellText("F4"));
142
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
143
		assertEquals("266773",CalcUtil.getCellText("J24"));
144
		
145
		typeKeys("<$undo>");
146
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
147
		assertEquals("Group1",CalcUtil.getCellText("D4"));
148
		assertEquals("Kevin Wang",CalcUtil.getCellText("I4"));
149
		assertEquals("266773",CalcUtil.getCellText("J24"));
150
		sleep(1);
151
		
152
		typeKeys("<$redo>");
153
		assertEquals("Kevin Wang",CalcUtil.getCellText("B4"));
154
		assertEquals("Group1",CalcUtil.getCellText("F4"));
155
		assertEquals("Bill Zhang",CalcUtil.getCellText("I4"));
156
		assertEquals("266773",CalcUtil.getCellText("J24"));
157
	}
158
159
}
(-)src/testcase/sc/datapilot/SubtotalsFunctionInGroupedField.java (-214 lines)
Lines 1-214 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 *
50
 *
51
 */
52
public class SubtotalsFunctionInGroupedField {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify that DP panel will be synchronized with table while add fields on panel.
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("source_data01.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
		CalcUtil.selectRange("A1:E27");
82
		calc.menuItem("Data->DataPilot->Start...").select();		
83
		CreateDataPilotTableDialog.ok();
84
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
85
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
86
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
87
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
88
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
89
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
90
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
91
		
92
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
93
			DataPilotAutomaticallyUpdateCheckBox.check();
94
		}
95
		
96
		DataPilotFieldSelect.click(1, 1);
97
		DataPilotFieldSelect.openContextMenu();
98
		menuItem("Add to Page").select();
99
		assertEquals("Locale",CalcUtil.getCellText("A1"));
100
		sleep(1);
101
		
102
		DataPilotFieldSelect.click(1,30);
103
		DataPilotFieldSelect.openContextMenu();
104
		menuItem("Add to Column").select();
105
		assertEquals("Name",CalcUtil.getCellText("A3"));
106
		sleep(1);
107
		
108
		DataPilotFieldSelect.click(1,50);
109
		DataPilotFieldSelect.openContextMenu();
110
		menuItem("Add to Row").select();
111
		assertEquals("Date",CalcUtil.getCellText("A4"));
112
		sleep(1);
113
		
114
		DataPilotFieldSelect.click(1,70);
115
		DataPilotFieldSelect.openContextMenu();
116
		menuItem("Add to Data by->Sum").select();
117
		assertEquals("Sum - Order Number",CalcUtil.getCellText("A3"));
118
		assertEquals("266773",CalcUtil.getCellText("J23"));
119
		sleep(1);
120
		
121
		CalcUtil.selectRange("B4:C4");
122
		SpreadSheetCells.openContextMenu();
123
		menuItem("Group->Group Selected Items").select();
124
		assertEquals("Name2",CalcUtil.getCellText("B3"));
125
		assertEquals("Name",CalcUtil.getCellText("C3"));
126
		assertEquals("Group1",CalcUtil.getCellText("D4"));
127
		assertEquals("266773",CalcUtil.getCellText("J24"));
128
		sleep(1);
129
		
130
		CalcUtil.selectRange("B3");
131
		SpreadSheetCells.openContextMenu();
132
		menuItem("Field Option...").select();
133
		DataPilotFieldOptionFiledSubtotalsPage.select();
134
		sleep(1);
135
		
136
		DataPilotFieldOptionSubTotalsManuallyRadioButton.check();
137
		
138
		SC_DataPilotOptionSubtotalFunctionList.click(9,24);
139
		sleep(1);
140
		DataPilotFieldOptionFieldTabPageDialog.select();
141
		DataPilotFieldOptionFieldTabPageDialog.ok();
142
		
143
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
144
		assertEquals("5",CalcUtil.getCellText("C24"));
145
		
146
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
147
		assertEquals("2",CalcUtil.getCellText("E24"));
148
		
149
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
150
		assertEquals("9",CalcUtil.getCellText("H24"));
151
		
152
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
153
		assertEquals("1",CalcUtil.getCellText("J24"));
154
		
155
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
156
		assertEquals("2",CalcUtil.getCellText("L24"));
157
		
158
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
159
		assertEquals("4",CalcUtil.getCellText("N24"));
160
		
161
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
162
		assertEquals("3",CalcUtil.getCellText("P24"));
163
		assertEquals("266773",CalcUtil.getCellText("Q24"));
164
		sleep(1);
165
		
166
		typeKeys("<$undo>");
167
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
168
		assertEquals("20518",CalcUtil.getCellText("C24"));
169
		
170
		assertEquals("",CalcUtil.getCellText("E4"));
171
		assertEquals("20528",CalcUtil.getCellText("E24"));
172
		
173
		assertEquals("Joe Liu",CalcUtil.getCellText("H4"));
174
		assertEquals("41056",CalcUtil.getCellText("H24"));
175
		
176
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
177
		assertEquals("266773",CalcUtil.getCellText("J24"));
178
		
179
		assertEquals("",CalcUtil.getCellText("L4"));
180
		assertEquals("",CalcUtil.getCellText("L24"));
181
		
182
		assertEquals("",CalcUtil.getCellText("N4"));
183
		assertEquals("",CalcUtil.getCellText("N24"));
184
		
185
		assertEquals("",CalcUtil.getCellText("P4"));
186
		assertEquals("",CalcUtil.getCellText("P24"));
187
		assertEquals("",CalcUtil.getCellText("Q24"));
188
		sleep(1);
189
		
190
		typeKeys("<$redo>");
191
		assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4"));
192
		assertEquals("5",CalcUtil.getCellText("C24"));
193
		
194
		assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4"));
195
		assertEquals("2",CalcUtil.getCellText("E24"));
196
		
197
		assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4"));
198
		assertEquals("9",CalcUtil.getCellText("H24"));
199
		
200
		assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4"));
201
		assertEquals("1",CalcUtil.getCellText("J24"));
202
		
203
		assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4"));
204
		assertEquals("2",CalcUtil.getCellText("L24"));
205
		
206
		assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4"));
207
		assertEquals("4",CalcUtil.getCellText("N24"));
208
		
209
		assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4"));
210
		assertEquals("3",CalcUtil.getCellText("P24"));
211
		assertEquals("266773",CalcUtil.getCellText("Q24"));
212
	}
213
214
}
(-)src/testcase/sc/datapilot/TopNFunctionInGroupedField.java (-228 lines)
Lines 1-228 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
import org.openoffice.test.common.SystemUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
50
/**
51
 *
52
 *
53
 */
54
public class TopNFunctionInGroupedField {
55
	/**
56
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
57
	 * Collect extra data when OpenOffice crashes.
58
	 */
59
	@Rule
60
	public Log LOG = new Log();
61
62
	/**
63
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
64
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
65
	 * Reset OpenOffice to startcenter.
66
	 * 
67
	 * @throws java.lang.Exception
68
	 */
69
	@Before
70
	public void setUp() throws Exception {
71
		initApp();
72
	}
73
	/**
74
	 * 
75
	 * Verify that DP panel will be synchronized with table while add fields on panel.
76
	 */
77
	@Test
78
	public void test() {
79
		String file = testFile("source_data01.ods");
80
		startcenter.menuItem("File->Open...").select();
81
		submitOpenDlg(file);
82
		sleep(2);
83
		CalcUtil.selectRange("A1:E27");
84
		calc.menuItem("Data->DataPilot->Start...").select();		
85
		CreateDataPilotTableDialog.ok();
86
		assertEquals("New DataPilot Table",CalcUtil.getCellText("B2"));
87
		assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4"));
88
		assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5"));
89
		assertEquals("Page Area",CalcUtil.getCellText("B7"));
90
		assertEquals("Row Area",CalcUtil.getCellText("B10"));
91
		assertEquals("Column Area",CalcUtil.getCellText("D9"));
92
		assertEquals("Data Area",CalcUtil.getCellText("D11"));
93
		
94
		if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){
95
			DataPilotAutomaticallyUpdateCheckBox.check();
96
		}
97
		
98
		DataPilotFieldSelect.click(1, 1);
99
		DataPilotFieldSelect.openContextMenu();
100
		menuItem("Add to Page").select();
101
		assertEquals("Locale",CalcUtil.getCellText("A1"));
102
		sleep(1);
103
		
104
		DataPilotFieldSelect.click(1,30);
105
		DataPilotFieldSelect.openContextMenu();
106
		menuItem("Add to Column").select();
107
		assertEquals("Name",CalcUtil.getCellText("A3"));
108
		sleep(1);
109
		
110
		DataPilotFieldSelect.click(1,50);
111
		DataPilotFieldSelect.openContextMenu();
112
		menuItem("Add to Row").select();
113
		assertEquals("Date",CalcUtil.getCellText("A4"));
114
		sleep(1);
115
		
116
		DataPilotFieldSelect.click(1,70);
117
		DataPilotFieldSelect.openContextMenu();
118
		menuItem("Add to Data by->Sum").select();
119
		assertEquals("Sum - Order Number",CalcUtil.getCellInput("A3"));
120
		assertEquals("266773",CalcUtil.getCellText("J23"));
121
		sleep(1);
122
		
123
		CalcUtil.selectRange("B4:C4");
124
		SpreadSheetCells.openContextMenu();
125
		menuItem("Group->Group Selected Items").select();
126
		assertEquals("Name2",CalcUtil.getCellText("B3"));
127
		assertEquals("Name",CalcUtil.getCellText("C3"));
128
		assertEquals("Group1",CalcUtil.getCellText("D4"));
129
		assertEquals("266773",CalcUtil.getCellText("J24"));
130
		sleep(1);
131
		
132
		CalcUtil.selectRange("A1");
133
		sleep(1);
134
		
135
		// the Display resolution is 1280 * 1050 on windows and Linux and 1920 * 1080 on Mac
136
		if(SystemUtil.isWindows()){
137
			SpreadSheetCells.click(238, 43);
138
		}
139
		else if(SystemUtil.isLinux()){
140
			SpreadSheetCells.click(267, 43);
141
		}
142
		else if(SystemUtil.isMac()){
143
			SpreadSheetCells.click(238, 43);
144
		}
145
146
		typeKeys("<tab>");
147
		typeKeys("<tab>");
148
		typeKeys("<tab>");
149
		typeKeys("<tab>");
150
		typeKeys("<tab>");
151
		typeKeys("<tab>");
152
		typeKeys("<enter>");
153
		OnlyDisplayTopNItemCheckBox.check();
154
		NumberOfItemShowInTopNEditBox.setText("4");
155
		FieldTopNSettingDialog.ok();
156
		sleep(1);
157
		
158
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
159
		assertEquals("51299",CalcUtil.getCellText("B24"));
160
		
161
		assertEquals("Group1",CalcUtil.getCellText("C4"));
162
		assertEquals("71806",CalcUtil.getCellText("C24"));
163
		assertEquals("",CalcUtil.getCellText("D4"));
164
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
165
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
166
		assertEquals("20528",CalcUtil.getCellText("D24"));
167
		
168
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
169
		assertEquals("41056",CalcUtil.getCellText("E24"));
170
		
171
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
172
		assertEquals("30771",CalcUtil.getCellText("F24"));
173
		
174
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
175
		assertEquals("215460",CalcUtil.getCellText("G24"));
176
		sleep(1);
177
		
178
		typeKeys("<$undo>");
179
		assertEquals("Name2",CalcUtil.getCellText("B3"));
180
		assertEquals("Name",CalcUtil.getCellText("C3"));
181
		assertEquals("Group1",CalcUtil.getCellText("D4"));
182
		assertEquals("266773",CalcUtil.getCellText("J24"));
183
		
184
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
185
		assertEquals("51299",CalcUtil.getCellText("B24"));
186
		
187
		assertEquals("Emmy Ma",CalcUtil.getCellText("C4"));
188
		assertEquals("20518",CalcUtil.getCellText("C24"));
189
		assertEquals("Group1",CalcUtil.getCellText("D4"));
190
		assertEquals("Emmy Ma",CalcUtil.getCellText("C5"));
191
		assertEquals("Amy Zhao",CalcUtil.getCellText("D5"));
192
		assertEquals("71806",CalcUtil.getCellText("D24"));
193
		
194
		assertEquals("",CalcUtil.getCellText("E4"));
195
		assertEquals("20528",CalcUtil.getCellText("E24"));
196
		
197
		assertEquals("Harry Wu",CalcUtil.getCellText("F4"));
198
		assertEquals("10265",CalcUtil.getCellText("F24"));
199
		
200
		assertEquals("Jerry Lu",CalcUtil.getCellText("G4"));
201
		assertEquals("20530",CalcUtil.getCellText("G24"));
202
		
203
		assertEquals("Total Result",CalcUtil.getCellText("J4"));
204
		assertEquals("266773",CalcUtil.getCellText("J24"));
205
		sleep(1);
206
		
207
		typeKeys("<$redo>");
208
		assertEquals("Bill Zhang",CalcUtil.getCellText("B4"));
209
		assertEquals("51299",CalcUtil.getCellText("B24"));
210
		
211
		assertEquals("Group1",CalcUtil.getCellText("C4"));
212
		assertEquals("71806",CalcUtil.getCellText("C24"));
213
		assertEquals("",CalcUtil.getCellText("D4"));
214
		assertEquals("Amy Zhao",CalcUtil.getCellText("C5"));
215
		assertEquals("Anne Lee",CalcUtil.getCellText("D5"));
216
		assertEquals("20528",CalcUtil.getCellText("D24"));
217
		
218
		assertEquals("Joe Liu",CalcUtil.getCellText("E4"));
219
		assertEquals("41056",CalcUtil.getCellText("E24"));
220
		
221
		assertEquals("Kevin Wang",CalcUtil.getCellText("F4"));
222
		assertEquals("30771",CalcUtil.getCellText("F24"));
223
		
224
		assertEquals("Total Result",CalcUtil.getCellText("G4"));
225
		assertEquals("215460",CalcUtil.getCellText("G24"));
226
	}
227
228
}
(-)src/testcase/sc/filter/AutoFilterSortAscendingMutiColumns.java (-214 lines)
Lines 1-214 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Rule;
41
import org.junit.Test;
42
import org.openoffice.test.common.FileUtil;
43
import org.openoffice.test.common.GraphicsUtil;
44
45
import testlib.CalcUtil;
46
import testlib.Log;
47
48
/**
49
 * 
50
 *
51
 */
52
public class AutoFilterSortAscendingMutiColumns {
53
	/**
54
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
55
	 * Collect extra data when OpenOffice crashes.
56
	 */
57
	@Rule
58
	public Log LOG = new Log();
59
60
	/**
61
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
62
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
63
	 * Reset OpenOffice to startcenter.
64
	 * 
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
		initApp();
70
	}
71
	/**
72
	 * 
73
	 * Verify Auto Filter sort ascending in muti-columns
74
	 */
75
	@Test
76
	public void test() {
77
		String file = testFile("sc/sample_topN3.ods");
78
		startcenter.menuItem("File->Open...").select();
79
		submitOpenDlg(file);
80
		sleep(2);
81
82
		CalcUtil.selectRange("A1:E200");
83
		calc.menuItem("Data->Filter->AutoFilter").select();
84
		SpreadSheetCells.click(72, 8);
85
		typeKeys("<up>");
86
		typeKeys("<up>");
87
		typeKeys("<enter>");
88
		assertEquals("A",CalcUtil.getCellText("A1"));
89
		assertEquals("B",CalcUtil.getCellText("B1"));
90
		assertEquals("C",CalcUtil.getCellText("C1"));
91
		assertEquals("D",CalcUtil.getCellText("D1"));
92
		assertEquals("E",CalcUtil.getCellText("E1"));
93
		assertEquals("Item1",CalcUtil.getCellText("A2"));
94
		assertEquals("5",CalcUtil.getCellText("B2"));
95
		assertEquals("246",CalcUtil.getCellText("C2"));
96
		assertEquals("0",CalcUtil.getCellText("D2"));
97
		assertEquals("24",CalcUtil.getCellText("E2"));
98
		assertEquals("Item52",CalcUtil.getCellText("A200"));
99
		assertEquals("52",CalcUtil.getCellText("B200"));
100
		assertEquals("199",CalcUtil.getCellText("C200"));
101
		assertEquals("5",CalcUtil.getCellText("D200"));
102
		assertEquals("19",CalcUtil.getCellText("E200"));
103
		assertEquals("Item99",CalcUtil.getCellText("A251"));
104
		assertEquals("99",CalcUtil.getCellText("B251"));
105
		assertEquals("152",CalcUtil.getCellText("C251"));
106
		assertEquals("9",CalcUtil.getCellText("D251"));
107
		assertEquals("15",CalcUtil.getCellText("E251"));
108
109
		CalcUtil.selectRange("A1");
110
		SpreadSheetCells.click(152, 8);
111
		typeKeys("<up>");
112
		typeKeys("<up>");
113
		typeKeys("<enter>");
114
		assertEquals("A",CalcUtil.getCellText("A1"));
115
		assertEquals("B",CalcUtil.getCellText("B1"));
116
		assertEquals("C",CalcUtil.getCellText("C1"));
117
		assertEquals("D",CalcUtil.getCellText("D1"));
118
		assertEquals("E",CalcUtil.getCellText("E1"));
119
		assertEquals("Item1",CalcUtil.getCellText("A2"));
120
		assertEquals("5",CalcUtil.getCellText("B2"));
121
		assertEquals("246",CalcUtil.getCellText("C2"));
122
		assertEquals("0",CalcUtil.getCellText("D2"));
123
		assertEquals("24",CalcUtil.getCellText("E2"));
124
		assertEquals("Item199",CalcUtil.getCellText("A200"));
125
		assertEquals("199",CalcUtil.getCellText("B200"));
126
		assertEquals("52",CalcUtil.getCellText("C200"));
127
		assertEquals("19",CalcUtil.getCellText("D200"));
128
		assertEquals("5",CalcUtil.getCellText("E200"));
129
		assertEquals("Item250",CalcUtil.getCellText("A251"));
130
		assertEquals("250",CalcUtil.getCellText("B251"));
131
		assertEquals("1",CalcUtil.getCellText("C251"));
132
		assertEquals("25",CalcUtil.getCellText("D251"));
133
		assertEquals("0",CalcUtil.getCellText("E251"));
134
		
135
		
136
		CalcUtil.selectRange("A1");
137
		SpreadSheetCells.click(72, 8);
138
		typeKeys("<up>");
139
		typeKeys("<enter>");
140
		assertEquals("A",CalcUtil.getCellText("A1"));
141
		assertEquals("B",CalcUtil.getCellText("B1"));
142
		assertEquals("C",CalcUtil.getCellText("C1"));
143
		assertEquals("D",CalcUtil.getCellText("D1"));
144
		assertEquals("E",CalcUtil.getCellText("E1"));
145
		assertEquals("Item99",CalcUtil.getCellText("A2"));
146
		assertEquals("99",CalcUtil.getCellText("B2"));
147
		assertEquals("152",CalcUtil.getCellText("C2"));
148
		assertEquals("9",CalcUtil.getCellText("D2"));
149
		assertEquals("15",CalcUtil.getCellText("E2"));
150
		assertEquals("Item145",CalcUtil.getCellText("A200"));
151
		assertEquals("145",CalcUtil.getCellText("B200"));
152
		assertEquals("106",CalcUtil.getCellText("C200"));
153
		assertEquals("14",CalcUtil.getCellText("D200"));
154
		assertEquals("10",CalcUtil.getCellText("E200"));
155
		assertEquals("Item1",CalcUtil.getCellText("A251"));
156
		assertEquals("5",CalcUtil.getCellText("B251"));
157
		assertEquals("246",CalcUtil.getCellText("C251"));
158
		assertEquals("0",CalcUtil.getCellText("D251"));
159
		assertEquals("24",CalcUtil.getCellText("E251"));
160
		
161
		CalcUtil.selectRange("A1");
162
		SpreadSheetCells.click(232, 8);
163
		typeKeys("<up>");
164
		typeKeys("<enter>");
165
		assertEquals("A",CalcUtil.getCellText("A1"));
166
		assertEquals("B",CalcUtil.getCellText("B1"));
167
		assertEquals("C",CalcUtil.getCellText("C1"));
168
		assertEquals("D",CalcUtil.getCellText("D1"));
169
		assertEquals("E",CalcUtil.getCellText("E1"));
170
		assertEquals("Item9",CalcUtil.getCellText("A2"));
171
		assertEquals("5",CalcUtil.getCellText("B2"));
172
		assertEquals("246",CalcUtil.getCellText("C2"));
173
		assertEquals("0",CalcUtil.getCellText("D2"));
174
		assertEquals("24",CalcUtil.getCellText("E2"));
175
		assertEquals("Item199",CalcUtil.getCellText("A200"));
176
		assertEquals("199",CalcUtil.getCellText("B200"));
177
		assertEquals("52",CalcUtil.getCellText("C200"));
178
		assertEquals("19",CalcUtil.getCellText("D200"));
179
		assertEquals("5",CalcUtil.getCellText("E200"));
180
		assertEquals("Item250",CalcUtil.getCellText("A251"));
181
		assertEquals("250",CalcUtil.getCellText("B251"));
182
		assertEquals("1",CalcUtil.getCellText("C251"));
183
		assertEquals("25",CalcUtil.getCellText("D251"));
184
		assertEquals("0",CalcUtil.getCellText("E251"));
185
		
186
187
		CalcUtil.selectRange("A1");
188
		SpreadSheetCells.click(312, 8);
189
		typeKeys("<up>");
190
		typeKeys("<up>");
191
		typeKeys("<enter>");
192
		assertEquals("A",CalcUtil.getCellText("A1"));
193
		assertEquals("B",CalcUtil.getCellText("B1"));
194
		assertEquals("C",CalcUtil.getCellText("C1"));
195
		assertEquals("D",CalcUtil.getCellText("D1"));
196
		assertEquals("E",CalcUtil.getCellText("E1"));
197
		assertEquals("Item9",CalcUtil.getCellText("A2"));
198
		assertEquals("5",CalcUtil.getCellText("B2"));
199
		assertEquals("246",CalcUtil.getCellText("C2"));
200
		assertEquals("0",CalcUtil.getCellText("D2"));
201
		assertEquals("24",CalcUtil.getCellText("E2"));
202
		assertEquals("Item199",CalcUtil.getCellText("A200"));
203
		assertEquals("199",CalcUtil.getCellText("B200"));
204
		assertEquals("52",CalcUtil.getCellText("C200"));
205
		assertEquals("19",CalcUtil.getCellText("D200"));
206
		assertEquals("5",CalcUtil.getCellText("E200"));
207
		assertEquals("Item250",CalcUtil.getCellText("A251"));
208
		assertEquals("250",CalcUtil.getCellText("B251"));
209
		assertEquals("1",CalcUtil.getCellText("C251"));
210
		assertEquals("25",CalcUtil.getCellText("D251"));
211
		assertEquals("0",CalcUtil.getCellText("E251"));
212
	}
213
214
}
(-)src/testcase/sc/filter/AutoFitlerWithPlusSign.java (-87 lines)
Lines 1-87 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
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
36
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
40
import org.junit.Ignore;
41
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
47
import testlib.Log;
48
49
/**
50
 * 
51
 *
52
 */
53
public class AutoFitlerWithPlusSign {
54
	/**
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
59
	public Log LOG = new Log();
60
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
69
	public void setUp() throws Exception {
70
		initApp();
71
	}
72
	/**
73
	 * 
74
	 * Verify Chart Wizard dialog title words
75
	 */
76
	@Test
77
	public void test() {
78
		// Create a new text document
79
		startcenter.menuItem("File->New->Spreadsheet").select();
80
		sleep(3);
81
		String expect ="2+";
82
		CalcUtil.selectRange("A1");
83
		typeKeys(expect + "<enter>");
84
		assertEquals(expect,CalcUtil.getCellText("A1"));
85
	}
86
87
}
(-)src/testcase/sc/filter/Fitler.java (-30 / +15 lines)
Lines 28-87 Link Here
28
28
29
import static testlib.AppUtil.*;
29
import static testlib.AppUtil.*;
30
import static testlib.UIMap.*;
30
import static testlib.UIMap.*;
31
32
import java.awt.Rectangle;
33
import java.io.File;
34
35
import org.junit.After;
31
import org.junit.After;
36
import static org.junit.Assert.*;
32
import static org.junit.Assert.*;
37
import static org.openoffice.test.vcl.Tester.*;
33
import static org.openoffice.test.vcl.Tester.*;
38
39
import org.junit.Before;
34
import org.junit.Before;
40
import org.junit.Ignore;
35
import org.junit.Ignore;
41
import org.junit.Rule;
36
import org.junit.Rule;
42
import org.junit.Test;
43
import org.openoffice.test.common.FileUtil;
44
import org.openoffice.test.common.GraphicsUtil;
45
46
import testlib.CalcUtil;
37
import testlib.CalcUtil;
47
import testlib.Log;
38
import testlib.Log;
48
39
49
/**
40
/**
50
 * 
41
 * Test cases about Data->Filter in spreadsheet
51
 *
52
 */
42
 */
53
public class AutoFitlerWithPlusSign {
43
public class Fitler {
54
	/**
44
55
	 * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2.
56
	 * Collect extra data when OpenOffice crashes.
57
	 */
58
	@Rule
45
	@Rule
59
	public Log LOG = new Log();
46
	public Log LOG = new Log();
60
47
61
	/**
62
	 * initApp helps us to do 1. Patch the OpenOffice to enable automation if
63
	 * necessary. 2. Start OpenOffice with automation enabled if necessary. 3.
64
	 * Reset OpenOffice to startcenter.
65
	 * 
66
	 * @throws java.lang.Exception
67
	 */
68
	@Before
48
	@Before
69
	public void setUp() throws Exception {
49
	public void setUp() throws Exception {