104bad30fSLiu Zhe /************************************************************** 204bad30fSLiu Zhe * 304bad30fSLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 404bad30fSLiu Zhe * or more contributor license agreements. See the NOTICE file 504bad30fSLiu Zhe * distributed with this work for additional information 604bad30fSLiu Zhe * regarding copyright ownership. The ASF licenses this file 704bad30fSLiu Zhe * to you under the Apache License, Version 2.0 (the 804bad30fSLiu Zhe * "License"); you may not use this file except in compliance 904bad30fSLiu Zhe * with the License. You may obtain a copy of the License at 1004bad30fSLiu Zhe * 1104bad30fSLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 1204bad30fSLiu Zhe * 1304bad30fSLiu Zhe * Unless required by applicable law or agreed to in writing, 1404bad30fSLiu Zhe * software distributed under the License is distributed on an 1504bad30fSLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1604bad30fSLiu Zhe * KIND, either express or implied. See the License for the 1704bad30fSLiu Zhe * specific language governing permissions and limitations 1804bad30fSLiu Zhe * under the License. 1904bad30fSLiu Zhe * 2004bad30fSLiu Zhe *************************************************************/ 2104bad30fSLiu Zhe 2204bad30fSLiu Zhe /** 2304bad30fSLiu Zhe * 2404bad30fSLiu Zhe */ 2580a6f5c5SLiu Zhe package fvt.gui.sd.headerandfooter; 2622a14f28SLiu Zhe 2722a14f28SLiu Zhe import static org.junit.Assert.*; 2895269d92SLiu Zhe import static org.openoffice.test.common.Testspace.*; 2922a14f28SLiu Zhe import static org.openoffice.test.vcl.Tester.*; 30b4d2d410SLiu Zhe import static testlib.gui.AppTool.*; 3195269d92SLiu Zhe import static testlib.gui.UIMap.*; 3222a14f28SLiu Zhe 3304bad30fSLiu Zhe import org.junit.After; 3404bad30fSLiu Zhe import org.junit.Before; 3504bad30fSLiu Zhe import org.junit.Rule; 3604bad30fSLiu Zhe import org.junit.Test; 3704bad30fSLiu Zhe import org.openoffice.test.common.FileUtil; 3822a14f28SLiu Zhe import org.openoffice.test.common.Logger; 3995269d92SLiu Zhe 40b4d2d410SLiu Zhe import testlib.gui.SDTool; 4104bad30fSLiu Zhe 4222a14f28SLiu Zhe public class HeaderAndFooterSetting { 4304bad30fSLiu Zhe 4404bad30fSLiu Zhe @Rule 4522a14f28SLiu Zhe public Logger log = Logger.getLogger(this); 4604bad30fSLiu Zhe 4704bad30fSLiu Zhe @Before 4804bad30fSLiu Zhe public void setUp() throws Exception { 4922a14f28SLiu Zhe app.start(true); // Bug 120476 5004bad30fSLiu Zhe 5104bad30fSLiu Zhe // New a impress, insert some slides 5204bad30fSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 53b4d2d410SLiu Zhe presentationWizard.ok(); 54d8cae8adSLiu Zhe impress.waitForExistence(10, 2); 5504bad30fSLiu Zhe 5622a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 57b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 5804bad30fSLiu Zhe } 5904bad30fSLiu Zhe // Pop up navigator panel 60b4d2d410SLiu Zhe if (!sdNavigatorDlg.exists()) { 613816404dSLiu Zhe app.dispatch(".uno:Navigator"); 6204bad30fSLiu Zhe } 6304bad30fSLiu Zhe } 6404bad30fSLiu Zhe 6504bad30fSLiu Zhe @After 6604bad30fSLiu Zhe public void tearDown() throws Exception { 67*1ff8e3a9SLi Feng Wang if (sdNavigatorDlg.exists()) { 68*1ff8e3a9SLi Feng Wang app.dispatch(".uno:Navigator"); 69*1ff8e3a9SLi Feng Wang } 704a13b48eSLi Feng Wang app.stop(); 7104bad30fSLiu Zhe } 7204bad30fSLiu Zhe 7304bad30fSLiu Zhe /** 7404bad30fSLiu Zhe * Test Copy slide with Apply Footer to same file and different file 7522a14f28SLiu Zhe * 7604bad30fSLiu Zhe * @throws Exception 7704bad30fSLiu Zhe */ 78d8cae8adSLiu Zhe @Test 7922a14f28SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 8004bad30fSLiu Zhe 8122a14f28SLiu Zhe // add header and footer 823816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 8304bad30fSLiu Zhe 84b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 85b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 86b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 87b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 88b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 89b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 90b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 9104bad30fSLiu Zhe 923816404dSLiu Zhe // Click slide 3 93b4d2d410SLiu Zhe impressSlideSorter.focus(); 943816404dSLiu Zhe typeKeys("<up><up><up>"); 9504bad30fSLiu Zhe sleep(1); 963816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 97b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 98b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 9904bad30fSLiu Zhe 10022a14f28SLiu Zhe // paste to the same file 101b4d2d410SLiu Zhe impressSlideSorter.focus(); 10204bad30fSLiu Zhe app.dispatch(".uno:Copy"); 10304bad30fSLiu Zhe app.dispatch(".uno:Paste"); 10404bad30fSLiu Zhe 1053816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 106b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 107b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 108b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 109b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 11004bad30fSLiu Zhe 11122a14f28SLiu Zhe // paste to different file 11204bad30fSLiu Zhe impress.focus(); 11304bad30fSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 114b4d2d410SLiu Zhe presentationWizard.ok(); 11504bad30fSLiu Zhe app.dispatch(".uno:Paste"); 116b4d2d410SLiu Zhe impressSlideSorter.focus(); 11704bad30fSLiu Zhe typeKeys("<down>"); 11804bad30fSLiu Zhe sleep(1); 11904bad30fSLiu Zhe 1203816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 121b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 122b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 123b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 12404bad30fSLiu Zhe } 12504bad30fSLiu Zhe 12604bad30fSLiu Zhe /** 12704bad30fSLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12822a14f28SLiu Zhe * 12904bad30fSLiu Zhe * @throws Exception 13004bad30fSLiu Zhe */ 13104bad30fSLiu Zhe @Test 13222a14f28SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13304bad30fSLiu Zhe 13422a14f28SLiu Zhe // add header and footer 1353816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13604bad30fSLiu Zhe 137b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 138b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 139b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 140b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 141b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 142b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 143b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14404bad30fSLiu Zhe 145b4d2d410SLiu Zhe impressSlideSorter.focus(); 14622a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 14704bad30fSLiu Zhe typeKeys("<up>"); 14804bad30fSLiu Zhe } 1493816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 150b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 151b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 15204bad30fSLiu Zhe 15322a14f28SLiu Zhe // paste to the same file 154b4d2d410SLiu Zhe impressSlideSorter.focus(); 15504bad30fSLiu Zhe typeKeys("<up>"); 15604bad30fSLiu Zhe app.dispatch(".uno:Copy"); 15704bad30fSLiu Zhe typeKeys("<down>"); 15804bad30fSLiu Zhe app.dispatch(".uno:Paste"); 15904bad30fSLiu Zhe 1603816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 161b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 162b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 163b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 164b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16504bad30fSLiu Zhe 16622a14f28SLiu Zhe // paste to different file 1673816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 168b4d2d410SLiu Zhe presentationWizard.ok(); 16904bad30fSLiu Zhe app.dispatch(".uno:Paste"); 170b4d2d410SLiu Zhe impressSlideSorter.focus(); 17104bad30fSLiu Zhe typeKeys("<down>"); 1723816404dSLiu Zhe sleep(1); // If no sleep, error occur 17304bad30fSLiu Zhe 1743816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 175b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 176b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 177b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 17804bad30fSLiu Zhe } 17904bad30fSLiu Zhe 18004bad30fSLiu Zhe /** 18104bad30fSLiu Zhe * Test Copy slide with Notes Footer to same file and different file 18222a14f28SLiu Zhe * 18304bad30fSLiu Zhe * @throws Exception 18404bad30fSLiu Zhe */ 18504bad30fSLiu Zhe @Test 18622a14f28SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 18704bad30fSLiu Zhe 18822a14f28SLiu Zhe // add header and footer 1893816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 190b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 191b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 192b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 193b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 194b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 195b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 196b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 197b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 198b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 199b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 20004bad30fSLiu Zhe 20122a14f28SLiu Zhe // paste to the same file 202b4d2d410SLiu Zhe impressSlideSorter.focus(); 20304bad30fSLiu Zhe typeKeys("<up>"); 20404bad30fSLiu Zhe app.dispatch(".uno:Copy"); 20504bad30fSLiu Zhe typeKeys("<down>"); 20604bad30fSLiu Zhe app.dispatch(".uno:Paste"); 20704bad30fSLiu Zhe 2083816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 209b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 210b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 211b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 212b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 213b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 214b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21504bad30fSLiu Zhe 21622a14f28SLiu Zhe // paste to different file 21704bad30fSLiu Zhe impress.focus(); 2183816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 219b4d2d410SLiu Zhe presentationWizard.ok(); 22004bad30fSLiu Zhe app.dispatch(".uno:Paste"); 221b4d2d410SLiu Zhe impressSlideSorter.focus(); 22204bad30fSLiu Zhe typeKeys("<down>"); 223b4d2d410SLiu Zhe SDTool.getActiveView().activate(); 2243816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 225b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 226b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 227b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 228b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 229b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 23004bad30fSLiu Zhe } 23104bad30fSLiu Zhe 23204bad30fSLiu Zhe /** 23322a14f28SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23422a14f28SLiu Zhe * 23504bad30fSLiu Zhe * @throws Exception 23604bad30fSLiu Zhe */ 23704bad30fSLiu Zhe @Test 23822a14f28SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 23904bad30fSLiu Zhe 24022a14f28SLiu Zhe // add header and footer 2413816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 24204bad30fSLiu Zhe 243b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 244b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 245b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 246b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 247b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 248b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 249b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 25004bad30fSLiu Zhe 251b4d2d410SLiu Zhe impressSlideSorter.focus(); 25222a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 25304bad30fSLiu Zhe typeKeys("<up>"); 25404bad30fSLiu Zhe } 2553816404dSLiu Zhe app.dispatch(".uno:DuplicatePage"); 2563816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 257b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 258b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 259b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 26004bad30fSLiu Zhe } 26104bad30fSLiu Zhe 26204bad30fSLiu Zhe /** 26322a14f28SLiu Zhe * Test footer not show on the first slide. 26422a14f28SLiu Zhe * 26504bad30fSLiu Zhe * @throws Exception 26604bad30fSLiu Zhe */ 267d8cae8adSLiu Zhe @Test 26822a14f28SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 26904bad30fSLiu Zhe 27022a14f28SLiu Zhe // add header and footer 2713816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 272b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 273b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 274b4d2d410SLiu Zhe sdFooterNotShowOn1stSlide.check(); 275b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27604bad30fSLiu Zhe 2773816404dSLiu Zhe // Check slide 1 278b4d2d410SLiu Zhe impressSlideSorter.focus(); 27922a14f28SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 28022a14f28SLiu Zhe // sleep(1); // If no sleep, error occur 28122a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 282d8cae8adSLiu Zhe typeKeys("<up>"); 283d8cae8adSLiu Zhe sleep(1); 284d8cae8adSLiu Zhe } 28504bad30fSLiu Zhe 2863816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 287b4d2d410SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 288b4d2d410SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 28904bad30fSLiu Zhe } 29004bad30fSLiu Zhe 29104bad30fSLiu Zhe /** 29204bad30fSLiu Zhe * Test Insert Footer to focus slide. 29322a14f28SLiu Zhe * 29404bad30fSLiu Zhe * @throws Exception 29504bad30fSLiu Zhe */ 29604bad30fSLiu Zhe @Test 29722a14f28SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 29804bad30fSLiu Zhe 29922a14f28SLiu Zhe // add header and footer to focus slide. 3003816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30104bad30fSLiu Zhe 302b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 303b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 304b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 305b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 306b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 307b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 308b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 30904bad30fSLiu Zhe 3103816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 311b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 312b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 313b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 314b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 315b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 316b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 31722a14f28SLiu Zhe // close header and footer dialog. 318b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 31904bad30fSLiu Zhe typeKeys("<tab>"); 32004bad30fSLiu Zhe typeKeys("<enter>"); 32122a14f28SLiu Zhe // end close 32204bad30fSLiu Zhe 323b4d2d410SLiu Zhe impressSlideSorter.focus(); 32404bad30fSLiu Zhe typeKeys("<up>"); 32522a14f28SLiu Zhe sleep(1); // If no sleep, error occur 32604bad30fSLiu Zhe 3273816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 328b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 329b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 330b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33122a14f28SLiu Zhe // close header and footer dialog. 332b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33304bad30fSLiu Zhe typeKeys("<tab>"); 33404bad30fSLiu Zhe typeKeys("<enter>"); 33522a14f28SLiu Zhe // end close 33604bad30fSLiu Zhe 337b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 3383816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 339b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 340b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 341b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 34204bad30fSLiu Zhe } 34304bad30fSLiu Zhe 34404bad30fSLiu Zhe /** 34504bad30fSLiu Zhe * Test Insert Footer to Notes View 34622a14f28SLiu Zhe * 34704bad30fSLiu Zhe * @throws Exception 34804bad30fSLiu Zhe */ 34904bad30fSLiu Zhe @Test 35022a14f28SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35104bad30fSLiu Zhe 35222a14f28SLiu Zhe // add header and footer to focus slide. 3533816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 354b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 355b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 356b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 357b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 358b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 359b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 360b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 361b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 362b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 363b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 364b4d2d410SLiu Zhe 365b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 366b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 367b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 368b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 369b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 370b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 371b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 372b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 373b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 374b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37522a14f28SLiu Zhe // close header and footer dialog. 376b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 37704bad30fSLiu Zhe typeKeys("<tab>"); 37804bad30fSLiu Zhe typeKeys("<enter>"); 37922a14f28SLiu Zhe // end close 38004bad30fSLiu Zhe 381b4d2d410SLiu Zhe impressSlideSorter.focus(); 38204bad30fSLiu Zhe typeKeys("<up>"); 38304bad30fSLiu Zhe 3843816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 385b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 386b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 387b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 388b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 389b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 390b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 391b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 392b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 393b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39422a14f28SLiu Zhe // close header and footer dialog. 395b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 39604bad30fSLiu Zhe typeKeys("<tab>"); 39704bad30fSLiu Zhe typeKeys("<enter>"); 39822a14f28SLiu Zhe // end close 39904bad30fSLiu Zhe 400b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 401b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 402b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 403b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 404b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 405b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 406b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 407b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 408b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 409b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 410b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 41104bad30fSLiu Zhe } 41204bad30fSLiu Zhe 41304bad30fSLiu Zhe /** 41404bad30fSLiu Zhe * Test Insert Footer to Slide, use Apply to All 41522a14f28SLiu Zhe * 41604bad30fSLiu Zhe * @throws Exception 41704bad30fSLiu Zhe */ 41804bad30fSLiu Zhe @Test 41922a14f28SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 42004bad30fSLiu Zhe 42122a14f28SLiu Zhe // add header and footer to focus slide. 4223816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 42304bad30fSLiu Zhe 424b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 425b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 426b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 427b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 428b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 429b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 430b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 43104bad30fSLiu Zhe 4323816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 433b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 434b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 435b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 436b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 437b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 438b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 43922a14f28SLiu Zhe // close header and footer dialog. 440b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 44104bad30fSLiu Zhe typeKeys("<tab>"); 44204bad30fSLiu Zhe typeKeys("<enter>"); 44322a14f28SLiu Zhe // end close 44404bad30fSLiu Zhe 445b4d2d410SLiu Zhe impressSlideSorter.focus(); 44604bad30fSLiu Zhe typeKeys("<up>"); 44704bad30fSLiu Zhe 4483816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 449b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 450b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 451b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 452b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 453b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 454b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 45522a14f28SLiu Zhe // close header and footer dialog. 456b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 45704bad30fSLiu Zhe typeKeys("<tab>"); 45804bad30fSLiu Zhe typeKeys("<enter>"); 45922a14f28SLiu Zhe // end close 46004bad30fSLiu Zhe 461b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 4623816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 463b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 464b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 465b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 466b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 467b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 468b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 46904bad30fSLiu Zhe } 47004bad30fSLiu Zhe 47104bad30fSLiu Zhe /** 47204bad30fSLiu Zhe * Test Insert update automatically time footer to slides. 47322a14f28SLiu Zhe * 47404bad30fSLiu Zhe * @throws Exception 47504bad30fSLiu Zhe */ 47604bad30fSLiu Zhe @Test 47722a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 47804bad30fSLiu Zhe 47922a14f28SLiu Zhe // add header and footer 4803816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 481b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 482b4d2d410SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 483b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 484b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 4853816404dSLiu Zhe sleep(1); // Wait some time to check the time update 48604bad30fSLiu Zhe 4873816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 488b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 4893816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 49004bad30fSLiu Zhe } 49104bad30fSLiu Zhe 49204bad30fSLiu Zhe /** 49304bad30fSLiu Zhe * Test Insert update automatically time footer to Notes view. 49422a14f28SLiu Zhe * 49504bad30fSLiu Zhe * @throws Exception 49604bad30fSLiu Zhe */ 49704bad30fSLiu Zhe @Test 49822a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 49904bad30fSLiu Zhe 50022a14f28SLiu Zhe // add header and footer 5013816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 502b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 503b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 504b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 505b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 5063816404dSLiu Zhe sleep(1); // Wait some time to check the time update 50704bad30fSLiu Zhe 5083816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 509b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 510b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51104bad30fSLiu Zhe 5123816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 51304bad30fSLiu Zhe } 51404bad30fSLiu Zhe 51504bad30fSLiu Zhe /** 51622a14f28SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 51722a14f28SLiu Zhe * 51804bad30fSLiu Zhe * @throws Exception 51904bad30fSLiu Zhe */ 52004bad30fSLiu Zhe @Test 52122a14f28SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 52204bad30fSLiu Zhe 52322a14f28SLiu Zhe // add header and footer 5243816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 525b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 526b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 527b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 528b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 529b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 530b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 531b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 532b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 533b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 534b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 535b4d2d410SLiu Zhe 536b4d2d410SLiu Zhe impressSlideSorter.focus(); 53704bad30fSLiu Zhe typeKeys("<up>"); 53804bad30fSLiu Zhe 5393816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 540b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 541b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 542b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 543b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 544b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 545b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 54604bad30fSLiu Zhe 54722a14f28SLiu Zhe // save this file 5483816404dSLiu Zhe app.dispatch(".uno:SaveAs"); 54995269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55004bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 55122a14f28SLiu Zhe submitSaveDlg(saveTo); 5524a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 5534a13b48eSLi Feng Wang activeMsgBox.yes(); 5544a13b48eSLi Feng Wang sleep(2); 5554a13b48eSLi Feng Wang } 5564a13b48eSLi Feng Wang sleep(5); 5573816404dSLiu Zhe app.dispatch(".uno:CloseDoc"); 55804bad30fSLiu Zhe 55922a14f28SLiu Zhe // Reopen this file 56004bad30fSLiu Zhe openStartcenter(); 56104bad30fSLiu Zhe app.dispatch(".uno:Open"); 56222a14f28SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 56304bad30fSLiu Zhe submitOpenDlg(openFrom); 5644a13b48eSLi Feng Wang sleep(5); 56522a14f28SLiu Zhe // check after reopen 5663816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 567b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 568b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 569b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 570b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 571b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 57204bad30fSLiu Zhe } 57304bad30fSLiu Zhe 57404bad30fSLiu Zhe /** 57522a14f28SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57622a14f28SLiu Zhe * 57704bad30fSLiu Zhe * @throws Exception 57804bad30fSLiu Zhe */ 57904bad30fSLiu Zhe @Test 58022a14f28SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 58104bad30fSLiu Zhe 58222a14f28SLiu Zhe // add header and footer 5833816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 584b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 585b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 586b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 587b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 588b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 589b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 590b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 59104bad30fSLiu Zhe 592b4d2d410SLiu Zhe impressSlideSorter.focus(); 59304bad30fSLiu Zhe typeKeys("<up>"); 59404bad30fSLiu Zhe 5953816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 596b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 597b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 598b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59904bad30fSLiu Zhe 60022a14f28SLiu Zhe // close header and footer dialog. 601b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 60204bad30fSLiu Zhe typeKeys("<tab>"); 60304bad30fSLiu Zhe typeKeys("<enter>"); 60404bad30fSLiu Zhe 60522a14f28SLiu Zhe // save this file 6063816404dSLiu Zhe app.dispatch(".uno:SaveAs"); 60795269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60804bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 60922a14f28SLiu Zhe submitSaveDlg(saveTo); 6104a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 6114a13b48eSLi Feng Wang activeMsgBox.yes(); 6124a13b48eSLi Feng Wang sleep(2); 6134a13b48eSLi Feng Wang } 6144a13b48eSLi Feng Wang sleep(5); 6153816404dSLiu Zhe app.dispatch(".uno:CloseDoc"); 61604bad30fSLiu Zhe 61722a14f28SLiu Zhe // Reopen this file 61804bad30fSLiu Zhe openStartcenter(); 61904bad30fSLiu Zhe app.dispatch(".uno:Open"); 62022a14f28SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 62104bad30fSLiu Zhe submitOpenDlg(openFrom); 6224a13b48eSLi Feng Wang sleep(5); 62322a14f28SLiu Zhe // check after reopen 6243816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 625b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 626b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 627b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 62804bad30fSLiu Zhe } 62904bad30fSLiu Zhe } 630