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 		if (sdNavigatorDlg.exists()) {
68 			app.dispatch(".uno:Navigator");
69 		}
70 		app.stop();
71 	}
72 
73 	/**
74 	 * Test Copy slide with Apply Footer to same file and different file
75 	 *
76 	 * @throws Exception
77 	 */
78 	@Test
79 	public void testCopySlideWithApplyFooter() throws Exception {
80 
81 		// add header and footer
82 		app.dispatch(".uno:HeaderAndFooter");
83 
84 		sdDateAndTimeFooterOnSlide.check();
85 		sdFixedDateAndTimeFooterOnSlide.check();
86 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
87 		sdFooterTextOnSlide.check();
88 		sdFooterTextOnSlideInput.setText("Footer Test");
89 		sdSlideNumAsFooterOnSlide.check();
90 		sdApplyToAllButtonOnSlideFooter.click();
91 
92 		// Click slide 3
93 		impressSlideSorter.focus();
94 		typeKeys("<up><up><up>");
95 		sleep(1);
96 		app.dispatch(".uno:HeaderAndFooter");
97 		sdSlideNumAsFooterOnSlide.uncheck();
98 		sdApplyButtonOnSlideFooter.click();
99 
100 		// paste to the same file
101 		impressSlideSorter.focus();
102 		app.dispatch(".uno:Copy");
103 		app.dispatch(".uno:Paste");
104 
105 		app.dispatch(".uno:HeaderAndFooter");
106 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
107 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
108 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
109 		sdHeaderAndFooterDlgSlideTab.cancel();
110 
111 		// paste to different file
112 		impress.focus();
113 		app.dispatch("private:factory/simpress?slot=6686");
114 		presentationWizard.ok();
115 		app.dispatch(".uno:Paste");
116 		impressSlideSorter.focus();
117 		typeKeys("<down>");
118 		sleep(1);
119 
120 		app.dispatch(".uno:HeaderAndFooter");
121 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
122 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
123 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
124 	}
125 
126 	/**
127 	 * Test Copy slide with Apply to all Footer to same file and different file
128 	 *
129 	 * @throws Exception
130 	 */
131 	@Test
132 	public void testCopySlideWithApplyToAllFooter() throws Exception {
133 
134 		// add header and footer
135 		app.dispatch(".uno:HeaderAndFooter");
136 
137 		sdDateAndTimeFooterOnSlide.check();
138 		sdFixedDateAndTimeFooterOnSlide.check();
139 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
140 		sdFooterTextOnSlide.check();
141 		sdFooterTextOnSlideInput.setText("Footer Test");
142 		sdSlideNumAsFooterOnSlide.check();
143 		sdApplyToAllButtonOnSlideFooter.click();
144 
145 		impressSlideSorter.focus();
146 		for (int j = 0; j <= 2; j++) {
147 			typeKeys("<up>");
148 		}
149 		app.dispatch(".uno:HeaderAndFooter");
150 		sdSlideNumAsFooterOnSlide.uncheck();
151 		sdApplyButtonOnSlideFooter.click();
152 
153 		// paste to the same file
154 		impressSlideSorter.focus();
155 		typeKeys("<up>");
156 		app.dispatch(".uno:Copy");
157 		typeKeys("<down>");
158 		app.dispatch(".uno:Paste");
159 
160 		app.dispatch(".uno:HeaderAndFooter");
161 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
162 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
163 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
164 		sdHeaderAndFooterDlgSlideTab.cancel();
165 
166 		// paste to different file
167 		app.dispatch("private:factory/simpress?slot=6686");
168 		presentationWizard.ok();
169 		app.dispatch(".uno:Paste");
170 		impressSlideSorter.focus();
171 		typeKeys("<down>");
172 		sleep(1); // If no sleep, error occur
173 
174 		app.dispatch(".uno:HeaderAndFooter");
175 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
176 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
177 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
178 	}
179 
180 	/**
181 	 * Test Copy slide with Notes Footer to same file and different file
182 	 *
183 	 * @throws Exception
184 	 */
185 	@Test
186 	public void testCopySlideWithNotesHeaderFooter() throws Exception {
187 
188 		// add header and footer
189 		app.dispatch(".uno:HeaderAndFooter");
190 		sdHeaderAndFooterOnNotesTabPage.select();
191 		sdHeaderTextOnNotes.check();
192 		sdHeaderTextOnNotesInput.setText("Header Test");
193 		sdDateAndTimeFooterOnSlide.check();
194 		sdFixedDateAndTimeFooterOnSlide.check();
195 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
196 		sdFooterTextOnSlide.check();
197 		sdFooterTextOnSlideInput.setText("Footer Test");
198 		sdSlideNumAsFooterOnSlide.check();
199 		sdApplyToAllButtonOnSlideFooter.click();
200 
201 		// paste to the same file
202 		impressSlideSorter.focus();
203 		typeKeys("<up>");
204 		app.dispatch(".uno:Copy");
205 		typeKeys("<down>");
206 		app.dispatch(".uno:Paste");
207 
208 		app.dispatch(".uno:HeaderAndFooter");
209 		sdHeaderAndFooterOnNotesTabPage.select();
210 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
211 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
212 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
213 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
214 		sdHeaderAndFooterOnNotesTabPage.cancel();
215 
216 		// paste to different file
217 		impress.focus();
218 		app.dispatch("private:factory/simpress?slot=6686");
219 		presentationWizard.ok();
220 		app.dispatch(".uno:Paste");
221 		impressSlideSorter.focus();
222 		typeKeys("<down>");
223 		SDTool.getActiveView().activate();
224 		app.dispatch(".uno:HeaderAndFooter");
225 		sdHeaderAndFooterOnNotesTabPage.select();
226 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
227 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
228 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
229 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
230 	}
231 
232 	/**
233 	 * Test duplicate slide with Apply to all Footer to same file
234 	 *
235 	 * @throws Exception
236 	 */
237 	@Test
238 	public void testDuplicateSlideWithApplyToAllFooter() throws Exception {
239 
240 		// add header and footer
241 		app.dispatch(".uno:HeaderAndFooter");
242 
243 		sdDateAndTimeFooterOnSlide.check();
244 		sdFixedDateAndTimeFooterOnSlide.check();
245 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
246 		sdFooterTextOnSlide.check();
247 		sdFooterTextOnSlideInput.setText("Footer Test");
248 		sdSlideNumAsFooterOnSlide.check();
249 		sdApplyToAllButtonOnSlideFooter.click();
250 
251 		impressSlideSorter.focus();
252 		for (int j = 0; j <= 2; j++) {
253 			typeKeys("<up>");
254 		}
255 		app.dispatch(".uno:DuplicatePage");
256 		app.dispatch(".uno:HeaderAndFooter");
257 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
258 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
259 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
260 	}
261 
262 	/**
263 	 * Test footer not show on the first slide.
264 	 *
265 	 * @throws Exception
266 	 */
267 	@Test
268 	public void testFooterNotShowOn1stSlide() throws Exception {
269 
270 		// add header and footer
271 		app.dispatch(".uno:HeaderAndFooter");
272 		sdFooterTextOnSlide.check();
273 		sdFooterTextOnSlideInput.setText("Footer Test");
274 		sdFooterNotShowOn1stSlide.check();
275 		sdApplyToAllButtonOnSlideFooter.click();
276 
277 		// Check slide 1
278 		impressSlideSorter.focus();
279 		// typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04
280 		// sleep(1); // If no sleep, error occur
281 		for (int i = 0; i < 5; i++) {
282 			typeKeys("<up>");
283 			sleep(1);
284 		}
285 
286 		app.dispatch(".uno:HeaderAndFooter");
287 		assertEquals(true, sdFooterNotShowOn1stSlide.isChecked());
288 		assertEquals(false, sdFooterTextOnSlide.isChecked());
289 	}
290 
291 	/**
292 	 * Test Insert Footer to focus slide.
293 	 *
294 	 * @throws Exception
295 	 */
296 	@Test
297 	public void testInsertApplyFooterOnSlide() throws Exception {
298 
299 		// add header and footer to focus slide.
300 		app.dispatch(".uno:HeaderAndFooter");
301 
302 		sdDateAndTimeFooterOnSlide.check();
303 		sdFixedDateAndTimeFooterOnSlide.check();
304 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
305 		sdFooterTextOnSlide.check();
306 		sdFooterTextOnSlideInput.setText("Footer Test");
307 		sdSlideNumAsFooterOnSlide.check();
308 		sdApplyButtonOnSlideFooter.click();
309 
310 		app.dispatch(".uno:HeaderAndFooter");
311 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
312 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
313 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
314 		assertEquals(true, sdFooterTextOnSlide.isChecked());
315 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
316 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
317 		// close header and footer dialog.
318 		sdApplyButtonOnSlideFooter.focus();
319 		typeKeys("<tab>");
320 		typeKeys("<enter>");
321 		// end close
322 
323 		impressSlideSorter.focus();
324 		typeKeys("<up>");
325 		sleep(1); // If no sleep, error occur
326 
327 		app.dispatch(".uno:HeaderAndFooter");
328 		assertEquals("", sdFixedDateAndTimeOnSlideInput.getText());
329 		assertEquals("", sdFooterTextOnSlideInput.getText());
330 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
331 		// close header and footer dialog.
332 		sdApplyButtonOnSlideFooter.focus();
333 		typeKeys("<tab>");
334 		typeKeys("<enter>");
335 		// end close
336 
337 		sdInsertPageButtonOnToolbar.click();
338 		app.dispatch(".uno:HeaderAndFooter");
339 		assertEquals("", sdFixedDateAndTimeOnSlideInput.getText());
340 		assertEquals("", sdFooterTextOnSlideInput.getText());
341 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
342 	}
343 
344 	/**
345 	 * Test Insert Footer to Notes View
346 	 *
347 	 * @throws Exception
348 	 */
349 	@Test
350 	public void testInsertApplyToAllFooterOnNotes() throws Exception {
351 
352 		// add header and footer to focus slide.
353 		app.dispatch(".uno:HeaderAndFooter");
354 		sdHeaderAndFooterOnNotesTabPage.select();
355 		sdHeaderTextOnNotes.check();
356 		sdHeaderTextOnNotesInput.setText("Header Test");
357 		sdDateAndTimeFooterOnSlide.check();
358 		sdFixedDateAndTimeFooterOnSlide.check();
359 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
360 		sdFooterTextOnSlide.check();
361 		sdFooterTextOnSlideInput.setText("Footer Test");
362 		sdSlideNumAsFooterOnSlide.check();
363 		sdApplyToAllButtonOnSlideFooter.click();
364 
365 		app.dispatch(".uno:HeaderAndFooter");
366 		sdHeaderAndFooterOnNotesTabPage.select();
367 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
368 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
369 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
370 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
371 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
372 		assertEquals(true, sdFooterTextOnSlide.isChecked());
373 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
374 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
375 		// close header and footer dialog.
376 		sdApplyToAllButtonOnSlideFooter.focus();
377 		typeKeys("<tab>");
378 		typeKeys("<enter>");
379 		// end close
380 
381 		impressSlideSorter.focus();
382 		typeKeys("<up>");
383 
384 		app.dispatch(".uno:HeaderAndFooter");
385 		sdHeaderAndFooterOnNotesTabPage.select();
386 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
387 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
388 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
389 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
390 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
391 		assertEquals(true, sdFooterTextOnSlide.isChecked());
392 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
393 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
394 		// close header and footer dialog.
395 		sdApplyToAllButtonOnSlideFooter.focus();
396 		typeKeys("<tab>");
397 		typeKeys("<enter>");
398 		// end close
399 
400 		sdInsertPageButtonOnToolbar.click();
401 		app.dispatch(".uno:HeaderAndFooter");
402 		sdHeaderAndFooterOnNotesTabPage.select();
403 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
404 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
405 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
406 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
407 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
408 		assertEquals(true, sdFooterTextOnSlide.isChecked());
409 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
410 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
411 	}
412 
413 	/**
414 	 * Test Insert Footer to Slide, use Apply to All
415 	 *
416 	 * @throws Exception
417 	 */
418 	@Test
419 	public void testInsertApplyToAllFooterOnSlide() throws Exception {
420 
421 		// add header and footer to focus slide.
422 		app.dispatch(".uno:HeaderAndFooter");
423 
424 		sdDateAndTimeFooterOnSlide.check();
425 		sdFixedDateAndTimeFooterOnSlide.check();
426 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
427 		sdFooterTextOnSlide.check();
428 		sdFooterTextOnSlideInput.setText("Footer Test");
429 		sdSlideNumAsFooterOnSlide.check();
430 		sdApplyToAllButtonOnSlideFooter.click();
431 
432 		app.dispatch(".uno:HeaderAndFooter");
433 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
434 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
435 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
436 		assertEquals(true, sdFooterTextOnSlide.isChecked());
437 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
438 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
439 		// close header and footer dialog.
440 		sdApplyButtonOnSlideFooter.focus();
441 		typeKeys("<tab>");
442 		typeKeys("<enter>");
443 		// end close
444 
445 		impressSlideSorter.focus();
446 		typeKeys("<up>");
447 
448 		app.dispatch(".uno:HeaderAndFooter");
449 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
450 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
451 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
452 		assertEquals(true, sdFooterTextOnSlide.isChecked());
453 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
454 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
455 		// close header and footer dialog.
456 		sdApplyButtonOnSlideFooter.focus();
457 		typeKeys("<tab>");
458 		typeKeys("<enter>");
459 		// end close
460 
461 		sdInsertPageButtonOnToolbar.click();
462 		app.dispatch(".uno:HeaderAndFooter");
463 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
464 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
465 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
466 		assertEquals(true, sdFooterTextOnSlide.isChecked());
467 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
468 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
469 	}
470 
471 	/**
472 	 * Test Insert update automatically time footer to slides.
473 	 *
474 	 * @throws Exception
475 	 */
476 	@Test
477 	public void testInsertAutoUpdateTimeFooter() throws Exception {
478 
479 		// add header and footer
480 		app.dispatch(".uno:HeaderAndFooter");
481 		sdAutoUpdateTimeFooter.check();
482 		sdAutoUpdateTimeFooterType.select(7);
483 		String currentTime = sdAutoUpdateTimeFooterType.getItemText(7);
484 		sdApplyToAllButtonOnSlideFooter.click();
485 		sleep(1); // Wait some time to check the time update
486 
487 		app.dispatch(".uno:HeaderAndFooter");
488 		String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7);
489 		assertNotSame("Time can not update", currentTime, updatedTime);
490 	}
491 
492 	/**
493 	 * Test Insert update automatically time footer to Notes view.
494 	 *
495 	 * @throws Exception
496 	 */
497 	@Test
498 	public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception {
499 
500 		// add header and footer
501 		app.dispatch(".uno:HeaderAndFooter");
502 		sdHeaderAndFooterOnNotesTabPage.select();
503 		sdAutoUpdateTimeFooter.check();
504 		String currentTime = sdAutoUpdateTimeFooterType.getItemText(7);
505 		sdApplyToAllButtonOnSlideFooter.click();
506 		sleep(1); // Wait some time to check the time update
507 
508 		app.dispatch(".uno:HeaderAndFooter");
509 		sdHeaderAndFooterOnNotesTabPage.select();
510 		String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7);
511 
512 		assertNotSame("Time can not update", currentTime, updatedTime);
513 	}
514 
515 	/**
516 	 * Test Insert Header and Footer to Notes view. Save and ReOpen
517 	 *
518 	 * @throws Exception
519 	 */
520 	@Test
521 	public void testInsertHeaderFooterOnNotes() throws Exception {
522 
523 		// add header and footer
524 		app.dispatch(".uno:HeaderAndFooter");
525 		sdHeaderAndFooterOnNotesTabPage.select();
526 		sdHeaderTextOnNotes.check();
527 		sdHeaderTextOnNotesInput.setText("Header Test");
528 		sdDateAndTimeFooterOnSlide.check();
529 		sdFixedDateAndTimeFooterOnSlide.check();
530 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
531 		sdFooterTextOnSlide.check();
532 		sdFooterTextOnSlideInput.setText("Footer Test");
533 		sdSlideNumAsFooterOnSlide.check();
534 		sdApplyToAllButtonOnSlideFooter.click();
535 
536 		impressSlideSorter.focus();
537 		typeKeys("<up>");
538 
539 		app.dispatch(".uno:HeaderAndFooter");
540 		sdHeaderAndFooterOnNotesTabPage.select();
541 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
542 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
543 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
544 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
545 		sdHeaderAndFooterOnNotesTabPage.cancel();
546 
547 		// save this file
548 		app.dispatch(".uno:SaveAs");
549 		String saveTo = getPath("temp/" + "hello.odp");
550 		FileUtil.deleteFile(saveTo);
551 		submitSaveDlg(saveTo);
552 		if (activeMsgBox.exists()) {
553 			activeMsgBox.yes();
554 			sleep(2);
555 		}
556 		sleep(5);
557 		app.dispatch(".uno:CloseDoc");
558 
559 		// Reopen this file
560 		openStartcenter();
561 		app.dispatch(".uno:Open");
562 		String openFrom = getPath("temp/" + "hello.odp");
563 		submitOpenDlg(openFrom);
564 		sleep(5);
565 		// check after reopen
566 		app.dispatch(".uno:HeaderAndFooter");
567 		sdHeaderAndFooterOnNotesTabPage.select();
568 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
569 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
570 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
571 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
572 	}
573 
574 	/**
575 	 * Test Insert Header and Footer to Slide Save and Reopen
576 	 *
577 	 * @throws Exception
578 	 */
579 	@Test
580 	public void testInsertHeaderFooterOnSlide() throws Exception {
581 
582 		// add header and footer
583 		app.dispatch(".uno:HeaderAndFooter");
584 		sdDateAndTimeFooterOnSlide.check();
585 		sdFixedDateAndTimeFooterOnSlide.check();
586 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
587 		sdFooterTextOnSlide.check();
588 		sdFooterTextOnSlideInput.setText("Footer Test");
589 		sdSlideNumAsFooterOnSlide.check();
590 		sdApplyToAllButtonOnSlideFooter.click();
591 
592 		impressSlideSorter.focus();
593 		typeKeys("<up>");
594 
595 		app.dispatch(".uno:HeaderAndFooter");
596 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
597 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
598 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
599 
600 		// close header and footer dialog.
601 		sdApplyButtonOnSlideFooter.focus();
602 		typeKeys("<tab>");
603 		typeKeys("<enter>");
604 
605 		// save this file
606 		app.dispatch(".uno:SaveAs");
607 		String saveTo = getPath("temp/" + "hello.odp");
608 		FileUtil.deleteFile(saveTo);
609 		submitSaveDlg(saveTo);
610 		if (activeMsgBox.exists()) {
611 			activeMsgBox.yes();
612 			sleep(2);
613 		}
614 		sleep(5);
615 		app.dispatch(".uno:CloseDoc");
616 
617 		// Reopen this file
618 		openStartcenter();
619 		app.dispatch(".uno:Open");
620 		String openFrom = getPath("temp/" + "hello.odp");
621 		submitOpenDlg(openFrom);
622 		sleep(5);
623 		// check after reopen
624 		app.dispatch(".uno:HeaderAndFooter");
625 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
626 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
627 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
628 	}
629 }
630