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