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