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.Test;
36 import org.openoffice.test.common.FileUtil;
37 
38 import testlib.gui.AppTool;
39 import testlib.gui.SDTool;
40 
41 public class HeaderAndFooterSetting {
42 
43 	@Before
44 	public void setUp() throws Exception {
45 		app.start(true);
46 		AppTool.newPresentation();
47 		for (int i = 0; i < 5; i++) {
48 			sdInsertPageButtonOnToolbar.click();
49 		}
50 		// Pop up navigator panel
51 		if (!sdNavigatorDlg.exists()) {
52 			app.dispatch(".uno:Navigator");
53 		}
54 	}
55 
56 	@After
57 	public void tearDown() throws Exception {
58 		sleep(3);
59 		if (sdNavigatorDlg.exists()) {
60 			app.dispatch(".uno:Navigator");
61 		}
62 		app.stop();
63 	}
64 
65 	/**
66 	 * Test Copy slide with Apply Footer to same file and different file
67 	 *
68 	 * @throws Exception
69 	 */
70 	@Test
71 	public void testCopySlideWithApplyFooter() throws Exception {
72 
73 		// add header and footer
74 		app.dispatch(".uno:HeaderAndFooter");
75 
76 		sdDateAndTimeFooterOnSlide.check();
77 		sdFixedDateAndTimeFooterOnSlide.check();
78 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
79 		sdFooterTextOnSlide.check();
80 		sdFooterTextOnSlideInput.setText("Footer Test");
81 		sdSlideNumAsFooterOnSlide.check();
82 		sdApplyToAllButtonOnSlideFooter.click();
83 
84 		// Click slide 3
85 		impressSlideSorter.focus();
86 		typeKeys("<up><up><up>");
87 		sleep(1);
88 		app.dispatch(".uno:HeaderAndFooter");
89 		sdSlideNumAsFooterOnSlide.uncheck();
90 		sdApplyButtonOnSlideFooter.click();
91 
92 		// paste to the same file
93 		impressSlideSorter.focus();
94 		app.dispatch(".uno:Copy");
95 		app.dispatch(".uno:Paste");
96 
97 		app.dispatch(".uno:HeaderAndFooter");
98 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
99 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
100 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
101 		sdHeaderAndFooterDlgSlideTab.cancel();
102 
103 		// paste to different file
104 		impress.focus();
105 		app.dispatch("private:factory/simpress?slot=6686");
106 		presentationWizard.ok();
107 		app.dispatch(".uno:Paste");
108 		impressSlideSorter.focus();
109 		typeKeys("<down>");
110 		sleep(1);
111 
112 		app.dispatch(".uno:HeaderAndFooter");
113 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
114 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
115 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
116 		sdHeaderAndFooterDlgSlideTab.cancel();
117 
118 	}
119 
120 	/**
121 	 * Test Copy slide with Apply to all Footer to same file and different file
122 	 *
123 	 * @throws Exception
124 	 */
125 	@Test
126 	public void testCopySlideWithApplyToAllFooter() throws Exception {
127 
128 		// add header and footer
129 		app.dispatch(".uno:HeaderAndFooter");
130 
131 		sdDateAndTimeFooterOnSlide.check();
132 		sdFixedDateAndTimeFooterOnSlide.check();
133 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
134 		sdFooterTextOnSlide.check();
135 		sdFooterTextOnSlideInput.setText("Footer Test");
136 		sdSlideNumAsFooterOnSlide.check();
137 		sdApplyToAllButtonOnSlideFooter.click();
138 
139 		impressSlideSorter.focus();
140 		for (int j = 0; j <= 2; j++) {
141 			typeKeys("<up>");
142 		}
143 		app.dispatch(".uno:HeaderAndFooter");
144 		sdSlideNumAsFooterOnSlide.uncheck();
145 		sdApplyButtonOnSlideFooter.click();
146 
147 		// paste to the same file
148 		impressSlideSorter.focus();
149 		typeKeys("<up>");
150 		app.dispatch(".uno:Copy");
151 		typeKeys("<down>");
152 		app.dispatch(".uno:Paste");
153 
154 		app.dispatch(".uno:HeaderAndFooter");
155 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
156 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
157 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
158 		sdHeaderAndFooterDlgSlideTab.cancel();
159 
160 		// paste to different file
161 		app.dispatch("private:factory/simpress?slot=6686");
162 		presentationWizard.ok();
163 		app.dispatch(".uno:Paste");
164 		impressSlideSorter.focus();
165 		typeKeys("<down>");
166 		sleep(1); // If no sleep, error occur
167 
168 		app.dispatch(".uno:HeaderAndFooter");
169 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
170 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
171 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
172 		sdHeaderAndFooterDlgSlideTab.cancel();
173 	}
174 
175 	/**
176 	 * Test Copy slide with Notes Footer to same file and different file
177 	 *
178 	 * @throws Exception
179 	 */
180 	@Test
181 	public void testCopySlideWithNotesHeaderFooter() throws Exception {
182 
183 		// add header and footer
184 		app.dispatch(".uno:HeaderAndFooter");
185 		sdHeaderAndFooterOnNotesTabPage.select();
186 		sdHeaderTextOnNotes.check();
187 		sdHeaderTextOnNotesInput.setText("Header Test");
188 		sdDateAndTimeFooterOnSlide.check();
189 		sdFixedDateAndTimeFooterOnSlide.check();
190 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
191 		sdFooterTextOnSlide.check();
192 		sdFooterTextOnSlideInput.setText("Footer Test");
193 		sdSlideNumAsFooterOnSlide.check();
194 		sdApplyToAllButtonOnSlideFooter.click();
195 
196 		// paste to the same file
197 		impressSlideSorter.focus();
198 		typeKeys("<up>");
199 		app.dispatch(".uno:Copy");
200 		typeKeys("<down>");
201 		app.dispatch(".uno:Paste");
202 
203 		app.dispatch(".uno:HeaderAndFooter");
204 		sdHeaderAndFooterOnNotesTabPage.select();
205 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
206 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
207 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
208 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
209 		sdHeaderAndFooterOnNotesTabPage.cancel();
210 
211 		// paste to different file
212 		impress.focus();
213 		app.dispatch("private:factory/simpress?slot=6686");
214 		presentationWizard.ok();
215 		app.dispatch(".uno:Paste");
216 		impressSlideSorter.focus();
217 		typeKeys("<down>");
218 		SDTool.getActiveView().activate();
219 		app.dispatch(".uno:HeaderAndFooter");
220 		sdHeaderAndFooterOnNotesTabPage.select();
221 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
222 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
223 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
224 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
225 		sdHeaderAndFooterOnNotesTabPage.cancel();
226 	}
227 
228 	/**
229 	 * Test duplicate slide with Apply to all Footer to same file
230 	 *
231 	 * @throws Exception
232 	 */
233 	@Test
234 	public void testDuplicateSlideWithApplyToAllFooter() throws Exception {
235 
236 		// add header and footer
237 		app.dispatch(".uno:HeaderAndFooter");
238 
239 		sdDateAndTimeFooterOnSlide.check();
240 		sdFixedDateAndTimeFooterOnSlide.check();
241 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
242 		sdFooterTextOnSlide.check();
243 		sdFooterTextOnSlideInput.setText("Footer Test");
244 		sdSlideNumAsFooterOnSlide.check();
245 		sdApplyToAllButtonOnSlideFooter.click();
246 
247 		impressSlideSorter.focus();
248 		for (int j = 0; j <= 2; j++) {
249 			typeKeys("<up>");
250 		}
251 		app.dispatch(".uno:DuplicatePage");
252 		app.dispatch(".uno:HeaderAndFooter");
253 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
254 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
255 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
256 		sdHeaderAndFooterDlgSlideTab.cancel();
257 	}
258 
259 	/**
260 	 * Test footer not show on the first slide.
261 	 *
262 	 * @throws Exception
263 	 */
264 	@Test
265 	public void testFooterNotShowOn1stSlide() throws Exception {
266 
267 		// add header and footer
268 		app.dispatch(".uno:HeaderAndFooter");
269 		sdFooterTextOnSlide.check();
270 		sdFooterTextOnSlideInput.setText("Footer Test");
271 		sdFooterNotShowOn1stSlide.check();
272 		sdApplyToAllButtonOnSlideFooter.click();
273 
274 		// Check slide 1
275 		impressSlideSorter.focus();
276 		// typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04
277 		// sleep(1); // If no sleep, error occur
278 		for (int i = 0; i < 5; i++) {
279 			typeKeys("<up>");
280 			sleep(1);
281 		}
282 
283 		app.dispatch(".uno:HeaderAndFooter");
284 		assertEquals(true, sdFooterNotShowOn1stSlide.isChecked());
285 		assertEquals(false, sdFooterTextOnSlide.isChecked());
286 		sdHeaderAndFooterDlgSlideTab.cancel();
287 	}
288 
289 	/**
290 	 * Test Insert Footer to focus slide.
291 	 *
292 	 * @throws Exception
293 	 */
294 	@Test
295 	public void testInsertApplyFooterOnSlide() throws Exception {
296 
297 		// add header and footer to focus slide.
298 		app.dispatch(".uno:HeaderAndFooter");
299 
300 		sdDateAndTimeFooterOnSlide.check();
301 		sdFixedDateAndTimeFooterOnSlide.check();
302 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
303 		sdFooterTextOnSlide.check();
304 		sdFooterTextOnSlideInput.setText("Footer Test");
305 		sdSlideNumAsFooterOnSlide.check();
306 		sdApplyButtonOnSlideFooter.click();
307 
308 		app.dispatch(".uno:HeaderAndFooter");
309 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
310 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
311 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
312 		assertEquals(true, sdFooterTextOnSlide.isChecked());
313 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
314 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
315 		// close header and footer dialog.
316 		sdApplyButtonOnSlideFooter.focus();
317 		typeKeys("<tab>");
318 		typeKeys("<enter>");
319 		// end close
320 
321 		impressSlideSorter.focus();
322 		typeKeys("<up>");
323 		sleep(1); // If no sleep, error occur
324 
325 		app.dispatch(".uno:HeaderAndFooter");
326 		assertEquals("", sdFixedDateAndTimeOnSlideInput.getText());
327 		assertEquals("", sdFooterTextOnSlideInput.getText());
328 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
329 		// close header and footer dialog.
330 		sdApplyButtonOnSlideFooter.focus();
331 		typeKeys("<tab>");
332 		typeKeys("<enter>");
333 		// end close
334 
335 		sdInsertPageButtonOnToolbar.click();
336 		app.dispatch(".uno:HeaderAndFooter");
337 		assertEquals("", sdFixedDateAndTimeOnSlideInput.getText());
338 		assertEquals("", sdFooterTextOnSlideInput.getText());
339 		assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked());
340 		sdHeaderAndFooterDlgSlideTab.cancel();
341 	}
342 
343 	/**
344 	 * Test Insert Footer to Notes View
345 	 *
346 	 * @throws Exception
347 	 */
348 	@Test
349 	public void testInsertApplyToAllFooterOnNotes() throws Exception {
350 
351 		// add header and footer to focus slide.
352 		app.dispatch(".uno:HeaderAndFooter");
353 		sdHeaderAndFooterOnNotesTabPage.select();
354 		sdHeaderTextOnNotes.check();
355 		sdHeaderTextOnNotesInput.setText("Header Test");
356 		sdDateAndTimeFooterOnSlide.check();
357 		sdFixedDateAndTimeFooterOnSlide.check();
358 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323");
359 		sdFooterTextOnSlide.check();
360 		sdFooterTextOnSlideInput.setText("Footer Test");
361 		sdSlideNumAsFooterOnSlide.check();
362 		sdApplyToAllButtonOnSlideFooter.click();
363 
364 		app.dispatch(".uno:HeaderAndFooter");
365 		sdHeaderAndFooterOnNotesTabPage.select();
366 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
367 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
368 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
369 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
370 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
371 		assertEquals(true, sdFooterTextOnSlide.isChecked());
372 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
373 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
374 		// close header and footer dialog.
375 		sdApplyToAllButtonOnSlideFooter.focus();
376 		typeKeys("<tab>");
377 		typeKeys("<enter>");
378 		// end close
379 
380 		impressSlideSorter.focus();
381 		typeKeys("<up>");
382 
383 		app.dispatch(".uno:HeaderAndFooter");
384 		sdHeaderAndFooterOnNotesTabPage.select();
385 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
386 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
387 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
388 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
389 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
390 		assertEquals(true, sdFooterTextOnSlide.isChecked());
391 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
392 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
393 		// close header and footer dialog.
394 		sdApplyToAllButtonOnSlideFooter.focus();
395 		typeKeys("<tab>");
396 		typeKeys("<enter>");
397 		// end close
398 
399 		sdInsertPageButtonOnToolbar.click();
400 		app.dispatch(".uno:HeaderAndFooter");
401 		sdHeaderAndFooterOnNotesTabPage.select();
402 		assertEquals(true, sdHeaderTextOnNotes.isChecked());
403 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
404 		assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked());
405 		assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked());
406 		assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText());
407 		assertEquals(true, sdFooterTextOnSlide.isChecked());
408 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
409 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
410 		sdHeaderAndFooterOnNotesTabPage.cancel();
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 		sdHeaderAndFooterDlgSlideTab.cancel();
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);
487 
488 		app.dispatch(".uno:HeaderAndFooter");
489 		String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7);
490 		assertNotSame("Time can not update", currentTime, updatedTime);
491 		sdHeaderAndFooterDlgSlideTab.cancel();
492 	}
493 
494 	/**
495 	 * Test Insert update automatically time footer to Notes view.
496 	 *
497 	 * @throws Exception
498 	 */
499 	@Test
500 	public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception {
501 
502 		// add header and footer
503 		app.dispatch(".uno:HeaderAndFooter");
504 		sdHeaderAndFooterOnNotesTabPage.select();
505 		sdAutoUpdateTimeFooter.check();
506 		String currentTime = sdAutoUpdateTimeFooterType.getItemText(7);
507 		sdApplyToAllButtonOnSlideFooter.click();
508 		sleep(1);
509 
510 		app.dispatch(".uno:HeaderAndFooter");
511 		sdHeaderAndFooterOnNotesTabPage.select();
512 		String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7);
513 
514 		assertNotSame("Time can not update", currentTime, updatedTime);
515 		sdHeaderAndFooterOnNotesTabPage.cancel();
516 	}
517 
518 	/**
519 	 * Test Insert Header and Footer to Notes view. Save and ReOpen
520 	 *
521 	 * @throws Exception
522 	 */
523 	@Test
524 	public void testInsertHeaderFooterOnNotes() throws Exception {
525 
526 		// add header and footer
527 		app.dispatch(".uno:HeaderAndFooter");
528 		sdHeaderAndFooterOnNotesTabPage.select();
529 		sdHeaderTextOnNotes.check();
530 		sdHeaderTextOnNotesInput.setText("Header Test");
531 		sdDateAndTimeFooterOnSlide.check();
532 		sdFixedDateAndTimeFooterOnSlide.check();
533 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
534 		sdFooterTextOnSlide.check();
535 		sdFooterTextOnSlideInput.setText("Footer Test");
536 		sdSlideNumAsFooterOnSlide.check();
537 		sdApplyToAllButtonOnSlideFooter.click();
538 
539 		impressSlideSorter.focus();
540 		typeKeys("<up>");
541 
542 		app.dispatch(".uno:HeaderAndFooter");
543 		sdHeaderAndFooterOnNotesTabPage.select();
544 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
545 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
546 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
547 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
548 		sdHeaderAndFooterOnNotesTabPage.cancel();
549 
550 		// save and reopen this file
551 		String saveTo = getPath("temp/" + "hello.odp");
552 		FileUtil.deleteFile(saveTo);
553 		saveAs(saveTo);
554 		close();
555 		open(saveTo);
556 		impress.waitForExistence(10, 2);
557 
558 		// check after reopen
559 		app.dispatch(".uno:HeaderAndFooter");
560 		sdHeaderAndFooterOnNotesTabPage.select();
561 		assertEquals("Header Test", sdHeaderTextOnNotesInput.getText());
562 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
563 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
564 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
565 		sdHeaderAndFooterOnNotesTabPage.cancel();
566 	}
567 
568 	/**
569 	 * Test Insert Header and Footer to Slide Save and Reopen
570 	 *
571 	 * @throws Exception
572 	 */
573 	@Test
574 	public void testInsertHeaderFooterOnSlide() throws Exception {
575 
576 		// add header and footer
577 		app.dispatch(".uno:HeaderAndFooter");
578 		sdDateAndTimeFooterOnSlide.check();
579 		sdFixedDateAndTimeFooterOnSlide.check();
580 		sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329");
581 		sdFooterTextOnSlide.check();
582 		sdFooterTextOnSlideInput.setText("Footer Test");
583 		sdSlideNumAsFooterOnSlide.check();
584 		sdApplyToAllButtonOnSlideFooter.click();
585 
586 		impressSlideSorter.focus();
587 		typeKeys("<up>");
588 
589 		app.dispatch(".uno:HeaderAndFooter");
590 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
591 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
592 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
593 
594 		// close header and footer dialog.
595 		sdApplyButtonOnSlideFooter.focus();
596 		typeKeys("<tab>");
597 		typeKeys("<enter>");
598 
599 		// save this file
600 		String saveTo = getPath("temp/" + "hello.odp");
601 		FileUtil.deleteFile(saveTo);
602 		saveAs(saveTo);
603 		close();
604 		open(saveTo);
605 		impress.waitForExistence(10, 2);
606 
607 		// check after reopen
608 		app.dispatch(".uno:HeaderAndFooter");
609 		assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText());
610 		assertEquals("Footer Test", sdFooterTextOnSlideInput.getText());
611 		assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked());
612 		sdHeaderAndFooterDlgSlideTab.cancel();
613 	}
614 }
615