1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 /**
23  *
24  */
25 package fvt.gui.sd.headerandfooter;
26 
27 import static org.junit.Assert.*;
28 import static org.openoffice.test.common.Testspace.*;
29 import static org.openoffice.test.vcl.Tester.*;
30 import static testlib.gui.AppTool.*;
31 import static testlib.gui.UIMap.*;
32 
33 import org.junit.After;
34 import org.junit.Before;
35 import org.junit.Rule;
36 import org.junit.Test;
37 import org.openoffice.test.common.FileUtil;
38 import org.openoffice.test.common.Logger;
39 
40 import testlib.gui.SDTool;
41 
42 public class HeaderAndFooterSetting {
43 
44 	@Rule
45 	public Logger log = Logger.getLogger(this);
46 
47 	@Before
48 	public void setUp() throws Exception {
49 		app.start(true); // Bug 120476
50 
51 		// New a impress, insert some slides
52 		app.dispatch("private:factory/simpress?slot=6686");
53 		presentationWizard.ok();
54 		impress.waitForExistence(10, 2);
55 
56 		for (int i = 0; i < 5; i++) {
57 			sdInsertPageButtonOnToolbar.click();
58 		}
59 		// Pop up navigator panel
60 		if (!sdNavigatorDlg.exists()) {
61 			app.dispatch(".uno:Navigator");
62 		}
63 	}
64 
65 	@After
66 	public void tearDown() throws Exception {
67 		sleep(3);
68 		if (sdNavigatorDlg.exists()) {
69 			app.dispatch(".uno:Navigator");
70 		}
71 		app.stop();
72 	}
73 
74 	/**
75 	 * Test Copy slide with Apply Footer to same file and different file
76 	 *
77 	 * @throws Exception
78 	 */
79 	@Test
80 	public void testCopySlideWithApplyFooter() throws Exception {
81 
82 		// add header and footer
83 		app.dispatch(".uno:HeaderAndFooter");
84 
85 		sdDateAndTimeFooterOnSlide.check();
86 		sdFixedDateAndTimeFooterOnSlide.check();
87 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
88 		sdFooterTextOnSlide.check();
89 		sdFooterTextOnSlideInput.setText("Footer Test");
90 		sdSlideNumAsFooterOnSlide.check();
91 		sdApplyToAllButtonOnSlideFooter.click();
92 
93 		// Click slide 3
94 		impressSlideSorter.focus();
95 		typeKeys("<up><up><up>");
96 		sleep(1);
97 		app.dispatch(".uno:HeaderAndFooter");
98 		sdSlideNumAsFooterOnSlide.uncheck();
99 		sdApplyButtonOnSlideFooter.click();
100 
101 		// paste to the same file
102 		impressSlideSorter.focus();
103 		app.dispatch(".uno:Copy");
104 		app.dispatch(".uno:Paste");
105 
106 		app.dispatch(".uno:HeaderAndFooter");
107 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
108 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
109 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
110 		sdHeaderAndFooterDlgSlideTab.cancel();
111 
112 		// paste to different file
113 		impress.focus();
114 		app.dispatch("private:factory/simpress?slot=6686");
115 		presentationWizard.ok();
116 		app.dispatch(".uno:Paste");
117 		impressSlideSorter.focus();
118 		typeKeys("<down>");
119 		sleep(1);
120 
121 		app.dispatch(".uno:HeaderAndFooter");
122 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
123 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
124 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
125 		sdHeaderAndFooterDlgSlideTab.cancel();
126 
127 	}
128 
129 	/**
130 	 * Test Copy slide with Apply to all Footer to same file and different file
131 	 *
132 	 * @throws Exception
133 	 */
134 	@Test
135 	public void testCopySlideWithApplyToAllFooter() throws Exception {
136 
137 		// add header and footer
138 		app.dispatch(".uno:HeaderAndFooter");
139 
140 		sdDateAndTimeFooterOnSlide.check();
141 		sdFixedDateAndTimeFooterOnSlide.check();
142 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
143 		sdFooterTextOnSlide.check();
144 		sdFooterTextOnSlideInput.setText("Footer Test");
145 		sdSlideNumAsFooterOnSlide.check();
146 		sdApplyToAllButtonOnSlideFooter.click();
147 
148 		impressSlideSorter.focus();
149 		for (int j = 0; j <= 2; j++) {
150 			typeKeys("<up>");
151 		}
152 		app.dispatch(".uno:HeaderAndFooter");
153 		sdSlideNumAsFooterOnSlide.uncheck();
154 		sdApplyButtonOnSlideFooter.click();
155 
156 		// paste to the same file
157 		impressSlideSorter.focus();
158 		typeKeys("<up>");
159 		app.dispatch(".uno:Copy");
160 		typeKeys("<down>");
161 		app.dispatch(".uno:Paste");
162 
163 		app.dispatch(".uno:HeaderAndFooter");
164 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
165 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
166 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
167 		sdHeaderAndFooterDlgSlideTab.cancel();
168 
169 		// paste to different file
170 		app.dispatch("private:factory/simpress?slot=6686");
171 		presentationWizard.ok();
172 		app.dispatch(".uno:Paste");
173 		impressSlideSorter.focus();
174 		typeKeys("<down>");
175 		sleep(1); // If no sleep, error occur
176 
177 		app.dispatch(".uno:HeaderAndFooter");
178 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
179 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
180 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
181 		sdHeaderAndFooterDlgSlideTab.cancel();
182 	}
183 
184 	/**
185 	 * Test Copy slide with Notes Footer to same file and different file
186 	 *
187 	 * @throws Exception
188 	 */
189 	@Test
190 	public void testCopySlideWithNotesHeaderFooter() throws Exception {
191 
192 		// add header and footer
193 		app.dispatch(".uno:HeaderAndFooter");
194 		sdHeaderAndFooterOnNotesTabPage.select();
195 		sdHeaderTextOnNotes.check();
196 		sdHeaderTextOnNotesInput.setText("Header Test");
197 		sdDateAndTimeFooterOnSlide.check();
198 		sdFixedDateAndTimeFooterOnSlide.check();
199 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
200 		sdFooterTextOnSlide.check();
201 		sdFooterTextOnSlideInput.setText("Footer Test");
202 		sdSlideNumAsFooterOnSlide.check();
203 		sdApplyToAllButtonOnSlideFooter.click();
204 
205 		// paste to the same file
206 		impressSlideSorter.focus();
207 		typeKeys("<up>");
208 		app.dispatch(".uno:Copy");
209 		typeKeys("<down>");
210 		app.dispatch(".uno:Paste");
211 
212 		app.dispatch(".uno:HeaderAndFooter");
213 		sdHeaderAndFooterOnNotesTabPage.select();
214 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
215 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
216 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
217 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
218 		sdHeaderAndFooterOnNotesTabPage.cancel();
219 
220 		// paste to different file
221 		impress.focus();
222 		app.dispatch("private:factory/simpress?slot=6686");
223 		presentationWizard.ok();
224 		app.dispatch(".uno:Paste");
225 		impressSlideSorter.focus();
226 		typeKeys("<down>");
227 		SDTool.getActiveView().activate();
228 		app.dispatch(".uno:HeaderAndFooter");
229 		sdHeaderAndFooterOnNotesTabPage.select();
230 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
231 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
232 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
233 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
234 		sdHeaderAndFooterOnNotesTabPage.cancel();
235 	}
236 
237 	/**
238 	 * Test duplicate slide with Apply to all Footer to same file
239 	 *
240 	 * @throws Exception
241 	 */
242 	@Test
243 	public void testDuplicateSlideWithApplyToAllFooter() throws Exception {
244 
245 		// add header and footer
246 		app.dispatch(".uno:HeaderAndFooter");
247 
248 		sdDateAndTimeFooterOnSlide.check();
249 		sdFixedDateAndTimeFooterOnSlide.check();
250 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
251 		sdFooterTextOnSlide.check();
252 		sdFooterTextOnSlideInput.setText("Footer Test");
253 		sdSlideNumAsFooterOnSlide.check();
254 		sdApplyToAllButtonOnSlideFooter.click();
255 
256 		impressSlideSorter.focus();
257 		for (int j = 0; j <= 2; j++) {
258 			typeKeys("<up>");
259 		}
260 		app.dispatch(".uno:DuplicatePage");
261 		app.dispatch(".uno:HeaderAndFooter");
262 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
263 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
264 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
265 		sdHeaderAndFooterDlgSlideTab.cancel();
266 	}
267 
268 	/**
269 	 * Test footer not show on the first slide.
270 	 *
271 	 * @throws Exception
272 	 */
273 	@Test
274 	public void testFooterNotShowOn1stSlide() throws Exception {
275 
276 		// add header and footer
277 		app.dispatch(".uno:HeaderAndFooter");
278 		sdFooterTextOnSlide.check();
279 		sdFooterTextOnSlideInput.setText("Footer Test");
280 		sdFooterNotShowOn1stSlide.check();
281 		sdApplyToAllButtonOnSlideFooter.click();
282 
283 		// Check slide 1
284 		impressSlideSorter.focus();
285 		// typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04
286 		// sleep(1); // If no sleep, error occur
287 		for (int i = 0; i < 5; i++) {
288 			typeKeys("<up>");
289 			sleep(1);
290 		}
291 
292 		app.dispatch(".uno:HeaderAndFooter");
293 		assertEquals(true, sdFooterNotShowOn1stSlide.isChecked());
294 		assertEquals(false, sdFooterTextOnSlide.isChecked());
295 		sdHeaderAndFooterDlgSlideTab.cancel();
296 	}
297 
298 	/**
299 	 * Test Insert Footer to focus slide.
300 	 *
301 	 * @throws Exception
302 	 */
303 	@Test
304 	public void testInsertApplyFooterOnSlide() throws Exception {
305 
306 		// add header and footer to focus slide.
307 		app.dispatch(".uno:HeaderAndFooter");
308 
309 		sdDateAndTimeFooterOnSlide.check();
310 		sdFixedDateAndTimeFooterOnSlide.check();
311 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
312 		sdFooterTextOnSlide.check();
313 		sdFooterTextOnSlideInput.setText("Footer Test");
314 		sdSlideNumAsFooterOnSlide.check();
315 		sdApplyButtonOnSlideFooter.click();
316 
317 		app.dispatch(".uno:HeaderAndFooter");
318 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
319 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
320 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
321 		assertEquals(true, sdFooterTextOnSlide.isChecked());
322 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
323 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
324 		// close header and footer dialog.
325 		sdApplyButtonOnSlideFooter.focus();
326 		typeKeys("<tab>");
327 		typeKeys("<enter>");
328 		// end close
329 
330 		impressSlideSorter.focus();
331 		typeKeys("<up>");
332 		sleep(1); // If no sleep, error occur
333 
334 		app.dispatch(".uno:HeaderAndFooter");
335 		assertEquals("", sdFixedDateAndTimeOnSlideInput.getText());
336 		assertEquals("", sdFooterTextOnSlideInput.getText());
337 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
338 		// close header and footer dialog.
339 		sdApplyButtonOnSlideFooter.focus();
340 		typeKeys("<tab>");
341 		typeKeys("<enter>");
342 		// end close
343 
344 		sdInsertPageButtonOnToolbar.click();
345 		app.dispatch(".uno:HeaderAndFooter");
346 		assertEquals("", sdFixedDateAndTimeOnSlideInput.getText());
347 		assertEquals("", sdFooterTextOnSlideInput.getText());
348 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
349 		sdHeaderAndFooterDlgSlideTab.cancel();
350 	}
351 
352 	/**
353 	 * Test Insert Footer to Notes View
354 	 *
355 	 * @throws Exception
356 	 */
357 	@Test
358 	public void testInsertApplyToAllFooterOnNotes() throws Exception {
359 
360 		// add header and footer to focus slide.
361 		app.dispatch(".uno:HeaderAndFooter");
362 		sdHeaderAndFooterOnNotesTabPage.select();
363 		sdHeaderTextOnNotes.check();
364 		sdHeaderTextOnNotesInput.setText("Header Test");
365 		sdDateAndTimeFooterOnSlide.check();
366 		sdFixedDateAndTimeFooterOnSlide.check();
367 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
368 		sdFooterTextOnSlide.check();
369 		sdFooterTextOnSlideInput.setText("Footer Test");
370 		sdSlideNumAsFooterOnSlide.check();
371 		sdApplyToAllButtonOnSlideFooter.click();
372 
373 		app.dispatch(".uno:HeaderAndFooter");
374 		sdHeaderAndFooterOnNotesTabPage.select();
375 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
376 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
377 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
378 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
379 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
380 		assertEquals(true, sdFooterTextOnSlide.isChecked());
381 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
382 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
383 		// close header and footer dialog.
384 		sdApplyToAllButtonOnSlideFooter.focus();
385 		typeKeys("<tab>");
386 		typeKeys("<enter>");
387 		// end close
388 
389 		impressSlideSorter.focus();
390 		typeKeys("<up>");
391 
392 		app.dispatch(".uno:HeaderAndFooter");
393 		sdHeaderAndFooterOnNotesTabPage.select();
394 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
395 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
396 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
397 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
398 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
399 		assertEquals(true, sdFooterTextOnSlide.isChecked());
400 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
401 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
402 		// close header and footer dialog.
403 		sdApplyToAllButtonOnSlideFooter.focus();
404 		typeKeys("<tab>");
405 		typeKeys("<enter>");
406 		// end close
407 
408 		sdInsertPageButtonOnToolbar.click();
409 		app.dispatch(".uno:HeaderAndFooter");
410 		sdHeaderAndFooterOnNotesTabPage.select();
411 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
412 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
413 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
414 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
415 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
416 		assertEquals(true, sdFooterTextOnSlide.isChecked());
417 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
418 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
419 		sdHeaderAndFooterOnNotesTabPage.cancel();
420 	}
421 
422 	/**
423 	 * Test Insert Footer to Slide, use Apply to All
424 	 *
425 	 * @throws Exception
426 	 */
427 	@Test
428 	public void testInsertApplyToAllFooterOnSlide() throws Exception {
429 
430 		// add header and footer to focus slide.
431 		app.dispatch(".uno:HeaderAndFooter");
432 
433 		sdDateAndTimeFooterOnSlide.check();
434 		sdFixedDateAndTimeFooterOnSlide.check();
435 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
436 		sdFooterTextOnSlide.check();
437 		sdFooterTextOnSlideInput.setText("Footer Test");
438 		sdSlideNumAsFooterOnSlide.check();
439 		sdApplyToAllButtonOnSlideFooter.click();
440 
441 		app.dispatch(".uno:HeaderAndFooter");
442 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
443 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
444 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
445 		assertEquals(true, sdFooterTextOnSlide.isChecked());
446 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
447 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
448 		// close header and footer dialog.
449 		sdApplyButtonOnSlideFooter.focus();
450 		typeKeys("<tab>");
451 		typeKeys("<enter>");
452 		// end close
453 
454 		impressSlideSorter.focus();
455 		typeKeys("<up>");
456 
457 		app.dispatch(".uno:HeaderAndFooter");
458 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
459 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
460 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
461 		assertEquals(true, sdFooterTextOnSlide.isChecked());
462 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
463 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
464 		// close header and footer dialog.
465 		sdApplyButtonOnSlideFooter.focus();
466 		typeKeys("<tab>");
467 		typeKeys("<enter>");
468 		// end close
469 
470 		sdInsertPageButtonOnToolbar.click();
471 		app.dispatch(".uno:HeaderAndFooter");
472 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
473 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
474 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
475 		assertEquals(true, sdFooterTextOnSlide.isChecked());
476 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
477 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
478 		sdHeaderAndFooterDlgSlideTab.cancel();
479 	}
480 
481 	/**
482 	 * Test Insert update automatically time footer to slides.
483 	 *
484 	 * @throws Exception
485 	 */
486 	@Test
487 	public void testInsertAutoUpdateTimeFooter() throws Exception {
488 
489 		// add header and footer
490 		app.dispatch(".uno:HeaderAndFooter");
491 		sdAutoUpdateTimeFooter.check();
492 		sdAutoUpdateTimeFooterType.select(7);
493 		String currentTime = sdAutoUpdateTimeFooterType.getItemText(7);
494 		sdApplyToAllButtonOnSlideFooter.click();
495 		sleep(1); // Wait some time to check the time update
496 
497 		app.dispatch(".uno:HeaderAndFooter");
498 		String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7);
499 		assertNotSame("Time can not update", currentTime, updatedTime);
500 		sdHeaderAndFooterDlgSlideTab.cancel();
501 	}
502 
503 	/**
504 	 * Test Insert update automatically time footer to Notes view.
505 	 *
506 	 * @throws Exception
507 	 */
508 	@Test
509 	public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception {
510 
511 		// add header and footer
512 		app.dispatch(".uno:HeaderAndFooter");
513 		sdHeaderAndFooterOnNotesTabPage.select();
514 		sdAutoUpdateTimeFooter.check();
515 		String currentTime = sdAutoUpdateTimeFooterType.getItemText(7);
516 		sdApplyToAllButtonOnSlideFooter.click();
517 		sleep(1); // Wait some time to check the time update
518 
519 		app.dispatch(".uno:HeaderAndFooter");
520 		sdHeaderAndFooterOnNotesTabPage.select();
521 		String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7);
522 
523 		assertNotSame("Time can not update", currentTime, updatedTime);
524 		sdHeaderAndFooterOnNotesTabPage.cancel();
525 	}
526 
527 	/**
528 	 * Test Insert Header and Footer to Notes view. Save and ReOpen
529 	 *
530 	 * @throws Exception
531 	 */
532 	@Test
533 	public void testInsertHeaderFooterOnNotes() throws Exception {
534 
535 		// add header and footer
536 		app.dispatch(".uno:HeaderAndFooter");
537 		sdHeaderAndFooterOnNotesTabPage.select();
538 		sdHeaderTextOnNotes.check();
539 		sdHeaderTextOnNotesInput.setText("Header Test");
540 		sdDateAndTimeFooterOnSlide.check();
541 		sdFixedDateAndTimeFooterOnSlide.check();
542 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
543 		sdFooterTextOnSlide.check();
544 		sdFooterTextOnSlideInput.setText("Footer Test");
545 		sdSlideNumAsFooterOnSlide.check();
546 		sdApplyToAllButtonOnSlideFooter.click();
547 
548 		impressSlideSorter.focus();
549 		typeKeys("<up>");
550 
551 		app.dispatch(".uno:HeaderAndFooter");
552 		sdHeaderAndFooterOnNotesTabPage.select();
553 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
554 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
555 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
556 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
557 		sdHeaderAndFooterOnNotesTabPage.cancel();
558 
559 		// save this file
560 		app.dispatch(".uno:SaveAs");
561 		String saveTo = getPath("temp/" + "hello.odp");
562 		FileUtil.deleteFile(saveTo);
563 		submitSaveDlg(saveTo);
564 		if (activeMsgBox.exists()) {
565 			activeMsgBox.yes();
566 			sleep(2);
567 		}
568 		sleep(5);
569 		app.dispatch(".uno:CloseDoc");
570 
571 		// Reopen this file
572 		openStartcenter();
573 		app.dispatch(".uno:Open");
574 		String openFrom = getPath("temp/" + "hello.odp");
575 		submitOpenDlg(openFrom);
576 		sleep(5);
577 		// check after reopen
578 		app.dispatch(".uno:HeaderAndFooter");
579 		sdHeaderAndFooterOnNotesTabPage.select();
580 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
581 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
582 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
583 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
584 		sdHeaderAndFooterOnNotesTabPage.cancel();
585 	}
586 
587 	/**
588 	 * Test Insert Header and Footer to Slide Save and Reopen
589 	 *
590 	 * @throws Exception
591 	 */
592 	@Test
593 	public void testInsertHeaderFooterOnSlide() throws Exception {
594 
595 		// add header and footer
596 		app.dispatch(".uno:HeaderAndFooter");
597 		sdDateAndTimeFooterOnSlide.check();
598 		sdFixedDateAndTimeFooterOnSlide.check();
599 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
600 		sdFooterTextOnSlide.check();
601 		sdFooterTextOnSlideInput.setText("Footer Test");
602 		sdSlideNumAsFooterOnSlide.check();
603 		sdApplyToAllButtonOnSlideFooter.click();
604 
605 		impressSlideSorter.focus();
606 		typeKeys("<up>");
607 
608 		app.dispatch(".uno:HeaderAndFooter");
609 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
610 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
611 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
612 
613 		// close header and footer dialog.
614 		sdApplyButtonOnSlideFooter.focus();
615 		typeKeys("<tab>");
616 		typeKeys("<enter>");
617 
618 		// save this file
619 		app.dispatch(".uno:SaveAs");
620 		String saveTo = getPath("temp/" + "hello.odp");
621 		FileUtil.deleteFile(saveTo);
622 		submitSaveDlg(saveTo);
623 		if (activeMsgBox.exists()) {
624 			activeMsgBox.yes();
625 			sleep(2);
626 		}
627 		sleep(5);
628 		app.dispatch(".uno:CloseDoc");
629 
630 		// Reopen this file
631 		openStartcenter();
632 		app.dispatch(".uno:Open");
633 		String openFrom = getPath("temp/" + "hello.odp");
634 		submitOpenDlg(openFrom);
635 		sleep(5);
636 		// check after reopen
637 		app.dispatch(".uno:HeaderAndFooter");
638 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
639 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
640 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
641 		sdHeaderAndFooterDlgSlideTab.cancel();
642 	}
643 }
644