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 { 6770375b46SLi Feng Wang sleep(3); 681ff8e3a9SLi Feng Wang if (sdNavigatorDlg.exists()) { 691ff8e3a9SLi Feng Wang app.dispatch(".uno:Navigator"); 701ff8e3a9SLi Feng Wang } 714a13b48eSLi Feng Wang app.stop(); 7204bad30fSLiu Zhe } 7304bad30fSLiu Zhe 7404bad30fSLiu Zhe /** 7504bad30fSLiu Zhe * Test Copy slide with Apply Footer to same file and different file 7622a14f28SLiu Zhe * 7704bad30fSLiu Zhe * @throws Exception 7804bad30fSLiu Zhe */ 79d8cae8adSLiu Zhe @Test 8022a14f28SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 8104bad30fSLiu Zhe 8222a14f28SLiu Zhe // add header and footer 833816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 8404bad30fSLiu Zhe 85b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 86b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 87b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 88b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 89b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 90b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 91b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 9204bad30fSLiu Zhe 933816404dSLiu Zhe // Click slide 3 94b4d2d410SLiu Zhe impressSlideSorter.focus(); 953816404dSLiu Zhe typeKeys("<up><up><up>"); 9604bad30fSLiu Zhe sleep(1); 973816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 98b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 99b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 10004bad30fSLiu Zhe 10122a14f28SLiu Zhe // paste to the same file 102b4d2d410SLiu Zhe impressSlideSorter.focus(); 10304bad30fSLiu Zhe app.dispatch(".uno:Copy"); 10404bad30fSLiu Zhe app.dispatch(".uno:Paste"); 10504bad30fSLiu Zhe 1063816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 107b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 108b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 109b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 110b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 11104bad30fSLiu Zhe 11222a14f28SLiu Zhe // paste to different file 11304bad30fSLiu Zhe impress.focus(); 11404bad30fSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 115b4d2d410SLiu Zhe presentationWizard.ok(); 11604bad30fSLiu Zhe app.dispatch(".uno:Paste"); 117b4d2d410SLiu Zhe impressSlideSorter.focus(); 11804bad30fSLiu Zhe typeKeys("<down>"); 11904bad30fSLiu Zhe sleep(1); 12004bad30fSLiu Zhe 1213816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 122b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 123b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 124b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 125*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 126*bcbf76e8SLi Feng Wang 12704bad30fSLiu Zhe } 12804bad30fSLiu Zhe 12904bad30fSLiu Zhe /** 13004bad30fSLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 13122a14f28SLiu Zhe * 13204bad30fSLiu Zhe * @throws Exception 13304bad30fSLiu Zhe */ 13404bad30fSLiu Zhe @Test 13522a14f28SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13604bad30fSLiu Zhe 13722a14f28SLiu Zhe // add header and footer 1383816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13904bad30fSLiu Zhe 140b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 141b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 142b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 143b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 144b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 145b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 146b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14704bad30fSLiu Zhe 148b4d2d410SLiu Zhe impressSlideSorter.focus(); 14922a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 15004bad30fSLiu Zhe typeKeys("<up>"); 15104bad30fSLiu Zhe } 1523816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 153b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 154b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 15504bad30fSLiu Zhe 15622a14f28SLiu Zhe // paste to the same file 157b4d2d410SLiu Zhe impressSlideSorter.focus(); 15804bad30fSLiu Zhe typeKeys("<up>"); 15904bad30fSLiu Zhe app.dispatch(".uno:Copy"); 16004bad30fSLiu Zhe typeKeys("<down>"); 16104bad30fSLiu Zhe app.dispatch(".uno:Paste"); 16204bad30fSLiu Zhe 1633816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 164b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 165b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 166b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 167b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16804bad30fSLiu Zhe 16922a14f28SLiu Zhe // paste to different file 1703816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 171b4d2d410SLiu Zhe presentationWizard.ok(); 17204bad30fSLiu Zhe app.dispatch(".uno:Paste"); 173b4d2d410SLiu Zhe impressSlideSorter.focus(); 17404bad30fSLiu Zhe typeKeys("<down>"); 1753816404dSLiu Zhe sleep(1); // If no sleep, error occur 17604bad30fSLiu Zhe 1773816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 178b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 179b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 180b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 181*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 18204bad30fSLiu Zhe } 18304bad30fSLiu Zhe 18404bad30fSLiu Zhe /** 18504bad30fSLiu Zhe * Test Copy slide with Notes Footer to same file and different file 18622a14f28SLiu Zhe * 18704bad30fSLiu Zhe * @throws Exception 18804bad30fSLiu Zhe */ 18904bad30fSLiu Zhe @Test 19022a14f28SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 19104bad30fSLiu Zhe 19222a14f28SLiu Zhe // add header and footer 1933816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 194b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 195b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 196b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 197b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 198b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 199b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 200b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 201b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 202b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 203b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 20404bad30fSLiu Zhe 20522a14f28SLiu Zhe // paste to the same file 206b4d2d410SLiu Zhe impressSlideSorter.focus(); 20704bad30fSLiu Zhe typeKeys("<up>"); 20804bad30fSLiu Zhe app.dispatch(".uno:Copy"); 20904bad30fSLiu Zhe typeKeys("<down>"); 21004bad30fSLiu Zhe app.dispatch(".uno:Paste"); 21104bad30fSLiu Zhe 2123816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 213b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 214b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 215b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 216b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 217b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 218b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21904bad30fSLiu Zhe 22022a14f28SLiu Zhe // paste to different file 22104bad30fSLiu Zhe impress.focus(); 2223816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 223b4d2d410SLiu Zhe presentationWizard.ok(); 22404bad30fSLiu Zhe app.dispatch(".uno:Paste"); 225b4d2d410SLiu Zhe impressSlideSorter.focus(); 22604bad30fSLiu Zhe typeKeys("<down>"); 227b4d2d410SLiu Zhe SDTool.getActiveView().activate(); 2283816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 229b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 230b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 231b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 232b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 233b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 234*bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 23504bad30fSLiu Zhe } 23604bad30fSLiu Zhe 23704bad30fSLiu Zhe /** 23822a14f28SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23922a14f28SLiu Zhe * 24004bad30fSLiu Zhe * @throws Exception 24104bad30fSLiu Zhe */ 24204bad30fSLiu Zhe @Test 24322a14f28SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 24404bad30fSLiu Zhe 24522a14f28SLiu Zhe // add header and footer 2463816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 24704bad30fSLiu Zhe 248b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 249b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 250b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 251b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 252b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 253b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 254b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 25504bad30fSLiu Zhe 256b4d2d410SLiu Zhe impressSlideSorter.focus(); 25722a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 25804bad30fSLiu Zhe typeKeys("<up>"); 25904bad30fSLiu Zhe } 2603816404dSLiu Zhe app.dispatch(".uno:DuplicatePage"); 2613816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 262b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 263b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 264b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 265*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 26604bad30fSLiu Zhe } 26704bad30fSLiu Zhe 26804bad30fSLiu Zhe /** 26922a14f28SLiu Zhe * Test footer not show on the first slide. 27022a14f28SLiu Zhe * 27104bad30fSLiu Zhe * @throws Exception 27204bad30fSLiu Zhe */ 273d8cae8adSLiu Zhe @Test 27422a14f28SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 27504bad30fSLiu Zhe 27622a14f28SLiu Zhe // add header and footer 2773816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 278b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 279b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 280b4d2d410SLiu Zhe sdFooterNotShowOn1stSlide.check(); 281b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 28204bad30fSLiu Zhe 2833816404dSLiu Zhe // Check slide 1 284b4d2d410SLiu Zhe impressSlideSorter.focus(); 28522a14f28SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 28622a14f28SLiu Zhe // sleep(1); // If no sleep, error occur 28722a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 288d8cae8adSLiu Zhe typeKeys("<up>"); 289d8cae8adSLiu Zhe sleep(1); 290d8cae8adSLiu Zhe } 29104bad30fSLiu Zhe 2923816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 293b4d2d410SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 294b4d2d410SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 295*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 29604bad30fSLiu Zhe } 29704bad30fSLiu Zhe 29804bad30fSLiu Zhe /** 29904bad30fSLiu Zhe * Test Insert Footer to focus slide. 30022a14f28SLiu Zhe * 30104bad30fSLiu Zhe * @throws Exception 30204bad30fSLiu Zhe */ 30304bad30fSLiu Zhe @Test 30422a14f28SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 30504bad30fSLiu Zhe 30622a14f28SLiu Zhe // add header and footer to focus slide. 3073816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30804bad30fSLiu Zhe 309b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 310b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 311b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 312b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 313b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 314b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 315b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 31604bad30fSLiu Zhe 3173816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 318b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 319b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 320b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 321b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 322b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 323b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 32422a14f28SLiu Zhe // close header and footer dialog. 325b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 32604bad30fSLiu Zhe typeKeys("<tab>"); 32704bad30fSLiu Zhe typeKeys("<enter>"); 32822a14f28SLiu Zhe // end close 32904bad30fSLiu Zhe 330b4d2d410SLiu Zhe impressSlideSorter.focus(); 33104bad30fSLiu Zhe typeKeys("<up>"); 33222a14f28SLiu Zhe sleep(1); // If no sleep, error occur 33304bad30fSLiu Zhe 3343816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 335b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 336b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 337b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33822a14f28SLiu Zhe // close header and footer dialog. 339b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 34004bad30fSLiu Zhe typeKeys("<tab>"); 34104bad30fSLiu Zhe typeKeys("<enter>"); 34222a14f28SLiu Zhe // end close 34304bad30fSLiu Zhe 344b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 3453816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 346b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 347b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 348b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 349*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 35004bad30fSLiu Zhe } 35104bad30fSLiu Zhe 35204bad30fSLiu Zhe /** 35304bad30fSLiu Zhe * Test Insert Footer to Notes View 35422a14f28SLiu Zhe * 35504bad30fSLiu Zhe * @throws Exception 35604bad30fSLiu Zhe */ 35704bad30fSLiu Zhe @Test 35822a14f28SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35904bad30fSLiu Zhe 36022a14f28SLiu Zhe // add header and footer to focus slide. 3613816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 362b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 363b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 364b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 365b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 366b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 367b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 368b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 369b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 370b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 371b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 372b4d2d410SLiu Zhe 373b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 374b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 375b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 376b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 377b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 378b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 379b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 380b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 381b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 382b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 38322a14f28SLiu Zhe // close header and footer dialog. 384b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 38504bad30fSLiu Zhe typeKeys("<tab>"); 38604bad30fSLiu Zhe typeKeys("<enter>"); 38722a14f28SLiu Zhe // end close 38804bad30fSLiu Zhe 389b4d2d410SLiu Zhe impressSlideSorter.focus(); 39004bad30fSLiu Zhe typeKeys("<up>"); 39104bad30fSLiu Zhe 3923816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 393b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 394b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 395b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 396b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 397b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 398b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 399b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 400b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 401b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 40222a14f28SLiu Zhe // close header and footer dialog. 403b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 40404bad30fSLiu Zhe typeKeys("<tab>"); 40504bad30fSLiu Zhe typeKeys("<enter>"); 40622a14f28SLiu Zhe // end close 40704bad30fSLiu Zhe 408b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 409b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 410b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 411b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 412b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 413b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 414b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 415b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 416b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 417b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 418b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 419*bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 42004bad30fSLiu Zhe } 42104bad30fSLiu Zhe 42204bad30fSLiu Zhe /** 42304bad30fSLiu Zhe * Test Insert Footer to Slide, use Apply to All 42422a14f28SLiu Zhe * 42504bad30fSLiu Zhe * @throws Exception 42604bad30fSLiu Zhe */ 42704bad30fSLiu Zhe @Test 42822a14f28SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 42904bad30fSLiu Zhe 43022a14f28SLiu Zhe // add header and footer to focus slide. 4313816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 43204bad30fSLiu Zhe 433b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 434b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 435b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 436b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 437b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 438b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 439b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 44004bad30fSLiu Zhe 4413816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 442b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 443b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 444b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 445b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 446b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 447b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 44822a14f28SLiu Zhe // close header and footer dialog. 449b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 45004bad30fSLiu Zhe typeKeys("<tab>"); 45104bad30fSLiu Zhe typeKeys("<enter>"); 45222a14f28SLiu Zhe // end close 45304bad30fSLiu Zhe 454b4d2d410SLiu Zhe impressSlideSorter.focus(); 45504bad30fSLiu Zhe typeKeys("<up>"); 45604bad30fSLiu Zhe 4573816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 458b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 459b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 460b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 461b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 462b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 463b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 46422a14f28SLiu Zhe // close header and footer dialog. 465b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 46604bad30fSLiu Zhe typeKeys("<tab>"); 46704bad30fSLiu Zhe typeKeys("<enter>"); 46822a14f28SLiu Zhe // end close 46904bad30fSLiu Zhe 470b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 4713816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 472b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 473b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 474b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 475b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 476b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 477b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 478*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 47904bad30fSLiu Zhe } 48004bad30fSLiu Zhe 48104bad30fSLiu Zhe /** 48204bad30fSLiu Zhe * Test Insert update automatically time footer to slides. 48322a14f28SLiu Zhe * 48404bad30fSLiu Zhe * @throws Exception 48504bad30fSLiu Zhe */ 48604bad30fSLiu Zhe @Test 48722a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 48804bad30fSLiu Zhe 48922a14f28SLiu Zhe // add header and footer 4903816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 491b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 492b4d2d410SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 493b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 494b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 4953816404dSLiu Zhe sleep(1); // Wait some time to check the time update 49604bad30fSLiu Zhe 4973816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 498b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 4993816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 500*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 50104bad30fSLiu Zhe } 50204bad30fSLiu Zhe 50304bad30fSLiu Zhe /** 50404bad30fSLiu Zhe * Test Insert update automatically time footer to Notes view. 50522a14f28SLiu Zhe * 50604bad30fSLiu Zhe * @throws Exception 50704bad30fSLiu Zhe */ 50804bad30fSLiu Zhe @Test 50922a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 51004bad30fSLiu Zhe 51122a14f28SLiu Zhe // add header and footer 5123816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 513b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 514b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 515b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 516b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 5173816404dSLiu Zhe sleep(1); // Wait some time to check the time update 51804bad30fSLiu Zhe 5193816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 520b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 521b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 52204bad30fSLiu Zhe 5233816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 524*bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 52504bad30fSLiu Zhe } 52604bad30fSLiu Zhe 52704bad30fSLiu Zhe /** 52822a14f28SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 52922a14f28SLiu Zhe * 53004bad30fSLiu Zhe * @throws Exception 53104bad30fSLiu Zhe */ 53204bad30fSLiu Zhe @Test 53322a14f28SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 53404bad30fSLiu Zhe 53522a14f28SLiu Zhe // add header and footer 5363816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 537b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 538b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 539b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 540b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 541b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 542b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 543b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 544b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 545b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 546b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 547b4d2d410SLiu Zhe 548b4d2d410SLiu Zhe impressSlideSorter.focus(); 54904bad30fSLiu Zhe typeKeys("<up>"); 55004bad30fSLiu Zhe 5513816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 552b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 553b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 554b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 555b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 556b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 557b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 55804bad30fSLiu Zhe 55922a14f28SLiu Zhe // save this file 5603816404dSLiu Zhe app.dispatch(".uno:SaveAs"); 56195269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 56204bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 56322a14f28SLiu Zhe submitSaveDlg(saveTo); 5644a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 5654a13b48eSLi Feng Wang activeMsgBox.yes(); 5664a13b48eSLi Feng Wang sleep(2); 5674a13b48eSLi Feng Wang } 5684a13b48eSLi Feng Wang sleep(5); 5693816404dSLiu Zhe app.dispatch(".uno:CloseDoc"); 57004bad30fSLiu Zhe 57122a14f28SLiu Zhe // Reopen this file 57204bad30fSLiu Zhe openStartcenter(); 57304bad30fSLiu Zhe app.dispatch(".uno:Open"); 57422a14f28SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 57504bad30fSLiu Zhe submitOpenDlg(openFrom); 5764a13b48eSLi Feng Wang sleep(5); 57722a14f28SLiu Zhe // check after reopen 5783816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 579b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 580b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 581b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 582b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 583b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 584*bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 58504bad30fSLiu Zhe } 58604bad30fSLiu Zhe 58704bad30fSLiu Zhe /** 58822a14f28SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 58922a14f28SLiu Zhe * 59004bad30fSLiu Zhe * @throws Exception 59104bad30fSLiu Zhe */ 59204bad30fSLiu Zhe @Test 59322a14f28SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 59404bad30fSLiu Zhe 59522a14f28SLiu Zhe // add header and footer 5963816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 597b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 598b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 599b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 600b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 601b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 602b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 603b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 60404bad30fSLiu Zhe 605b4d2d410SLiu Zhe impressSlideSorter.focus(); 60604bad30fSLiu Zhe typeKeys("<up>"); 60704bad30fSLiu Zhe 6083816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 609b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 610b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 611b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 61204bad30fSLiu Zhe 61322a14f28SLiu Zhe // close header and footer dialog. 614b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 61504bad30fSLiu Zhe typeKeys("<tab>"); 61604bad30fSLiu Zhe typeKeys("<enter>"); 61704bad30fSLiu Zhe 61822a14f28SLiu Zhe // save this file 6193816404dSLiu Zhe app.dispatch(".uno:SaveAs"); 62095269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 62104bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 62222a14f28SLiu Zhe submitSaveDlg(saveTo); 6234a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 6244a13b48eSLi Feng Wang activeMsgBox.yes(); 6254a13b48eSLi Feng Wang sleep(2); 6264a13b48eSLi Feng Wang } 6274a13b48eSLi Feng Wang sleep(5); 6283816404dSLiu Zhe app.dispatch(".uno:CloseDoc"); 62904bad30fSLiu Zhe 63022a14f28SLiu Zhe // Reopen this file 63104bad30fSLiu Zhe openStartcenter(); 63204bad30fSLiu Zhe app.dispatch(".uno:Open"); 63322a14f28SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 63404bad30fSLiu Zhe submitOpenDlg(openFrom); 6354a13b48eSLi Feng Wang sleep(5); 63622a14f28SLiu Zhe // check after reopen 6373816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 638b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 639b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 640b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 641*bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 64204bad30fSLiu Zhe } 64304bad30fSLiu Zhe } 644