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; 35*fd348426SLi Feng Wang import org.junit.Rule; 3604bad30fSLiu Zhe import org.junit.Test; 3704bad30fSLiu Zhe import org.openoffice.test.common.FileUtil; 38*fd348426SLi Feng Wang import org.openoffice.test.common.Logger; 3995269d92SLiu Zhe 40c37bcbf4SLi Feng Wang import testlib.gui.AppTool; 41b4d2d410SLiu Zhe import testlib.gui.SDTool; 4204bad30fSLiu Zhe 4322a14f28SLiu Zhe public class HeaderAndFooterSetting { 4404bad30fSLiu Zhe 45*fd348426SLi Feng Wang @Rule 46*fd348426SLi Feng Wang public Logger log = Logger.getLogger(this); 47*fd348426SLi Feng Wang 4804bad30fSLiu Zhe @Before setUp()4904bad30fSLiu Zhe public void setUp() throws Exception { 50c37bcbf4SLi Feng Wang app.start(true); 51c37bcbf4SLi Feng Wang AppTool.newPresentation(); 5222a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 53b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 5404bad30fSLiu Zhe } 5504bad30fSLiu Zhe // Pop up navigator panel 56b4d2d410SLiu Zhe if (!sdNavigatorDlg.exists()) { 573816404dSLiu Zhe app.dispatch(".uno:Navigator"); 5804bad30fSLiu Zhe } 5904bad30fSLiu Zhe } 6004bad30fSLiu Zhe 6104bad30fSLiu Zhe @After tearDown()6204bad30fSLiu Zhe public void tearDown() throws Exception { 6370375b46SLi Feng Wang sleep(3); 641ff8e3a9SLi Feng Wang if (sdNavigatorDlg.exists()) { 651ff8e3a9SLi Feng Wang app.dispatch(".uno:Navigator"); 661ff8e3a9SLi Feng Wang } 674a13b48eSLi Feng Wang app.stop(); 6804bad30fSLiu Zhe } 6904bad30fSLiu Zhe 7004bad30fSLiu Zhe /** 7104bad30fSLiu Zhe * Test Copy slide with Apply Footer to same file and different file 7222a14f28SLiu Zhe * 7304bad30fSLiu Zhe * @throws Exception 7404bad30fSLiu Zhe */ 75d8cae8adSLiu Zhe @Test testCopySlideWithApplyFooter()7622a14f28SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 7704bad30fSLiu Zhe 7822a14f28SLiu Zhe // add header and footer 793816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 8004bad30fSLiu Zhe 81b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 82b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 83b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 84b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 85b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 86b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 87b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 8804bad30fSLiu Zhe 893816404dSLiu Zhe // Click slide 3 90b4d2d410SLiu Zhe impressSlideSorter.focus(); 913816404dSLiu Zhe typeKeys("<up><up><up>"); 9204bad30fSLiu Zhe sleep(1); 933816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 94b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 95b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 9604bad30fSLiu Zhe 9722a14f28SLiu Zhe // paste to the same file 98b4d2d410SLiu Zhe impressSlideSorter.focus(); 9904bad30fSLiu Zhe app.dispatch(".uno:Copy"); 10004bad30fSLiu Zhe app.dispatch(".uno:Paste"); 10104bad30fSLiu Zhe 1023816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 103b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 104b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 105b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 106b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 10704bad30fSLiu Zhe 10822a14f28SLiu Zhe // paste to different file 10904bad30fSLiu Zhe impress.focus(); 11004bad30fSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 111b4d2d410SLiu Zhe presentationWizard.ok(); 11204bad30fSLiu Zhe app.dispatch(".uno:Paste"); 113b4d2d410SLiu Zhe impressSlideSorter.focus(); 11404bad30fSLiu Zhe typeKeys("<down>"); 11504bad30fSLiu Zhe sleep(1); 11604bad30fSLiu Zhe 1173816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 118b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 119b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 120b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 121bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 122bcbf76e8SLi Feng Wang 12304bad30fSLiu Zhe } 12404bad30fSLiu Zhe 12504bad30fSLiu Zhe /** 12604bad30fSLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12722a14f28SLiu Zhe * 12804bad30fSLiu Zhe * @throws Exception 12904bad30fSLiu Zhe */ 13004bad30fSLiu Zhe @Test testCopySlideWithApplyToAllFooter()13122a14f28SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13204bad30fSLiu Zhe 13322a14f28SLiu Zhe // add header and footer 1343816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13504bad30fSLiu Zhe 136b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 137b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 138b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 139b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 140b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 141b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 142b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14304bad30fSLiu Zhe 144b4d2d410SLiu Zhe impressSlideSorter.focus(); 14522a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 14604bad30fSLiu Zhe typeKeys("<up>"); 14704bad30fSLiu Zhe } 1483816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 149b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 150b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 15104bad30fSLiu Zhe 15222a14f28SLiu Zhe // paste to the same file 153b4d2d410SLiu Zhe impressSlideSorter.focus(); 15404bad30fSLiu Zhe typeKeys("<up>"); 15504bad30fSLiu Zhe app.dispatch(".uno:Copy"); 15604bad30fSLiu Zhe typeKeys("<down>"); 15704bad30fSLiu Zhe app.dispatch(".uno:Paste"); 15804bad30fSLiu Zhe 1593816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 160b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 161b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 162b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 163b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16404bad30fSLiu Zhe 16522a14f28SLiu Zhe // paste to different file 1663816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 167b4d2d410SLiu Zhe presentationWizard.ok(); 16804bad30fSLiu Zhe app.dispatch(".uno:Paste"); 169b4d2d410SLiu Zhe impressSlideSorter.focus(); 17004bad30fSLiu Zhe typeKeys("<down>"); 1713816404dSLiu Zhe sleep(1); // If no sleep, error occur 17204bad30fSLiu Zhe 1733816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 174b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 175b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 176b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 177bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 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 testCopySlideWithNotesHeaderFooter()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()); 230bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 23104bad30fSLiu Zhe } 23204bad30fSLiu Zhe 23304bad30fSLiu Zhe /** 23422a14f28SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23522a14f28SLiu Zhe * 23604bad30fSLiu Zhe * @throws Exception 23704bad30fSLiu Zhe */ 23804bad30fSLiu Zhe @Test testDuplicateSlideWithApplyToAllFooter()23922a14f28SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 24004bad30fSLiu Zhe 24122a14f28SLiu Zhe // add header and footer 2423816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 24304bad30fSLiu Zhe 244b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 245b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 246b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 247b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 248b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 249b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 250b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 25104bad30fSLiu Zhe 252b4d2d410SLiu Zhe impressSlideSorter.focus(); 25322a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 25404bad30fSLiu Zhe typeKeys("<up>"); 25504bad30fSLiu Zhe } 2563816404dSLiu Zhe app.dispatch(".uno:DuplicatePage"); 2573816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 258b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 259b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 260b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 261bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 26204bad30fSLiu Zhe } 26304bad30fSLiu Zhe 26404bad30fSLiu Zhe /** 26522a14f28SLiu Zhe * Test footer not show on the first slide. 26622a14f28SLiu Zhe * 26704bad30fSLiu Zhe * @throws Exception 26804bad30fSLiu Zhe */ 269d8cae8adSLiu Zhe @Test testFooterNotShowOn1stSlide()27022a14f28SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 27104bad30fSLiu Zhe 27222a14f28SLiu Zhe // add header and footer 2733816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 274b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 275b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 276b4d2d410SLiu Zhe sdFooterNotShowOn1stSlide.check(); 277b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27804bad30fSLiu Zhe 2793816404dSLiu Zhe // Check slide 1 280b4d2d410SLiu Zhe impressSlideSorter.focus(); 28122a14f28SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 28222a14f28SLiu Zhe // sleep(1); // If no sleep, error occur 28322a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 284d8cae8adSLiu Zhe typeKeys("<up>"); 285d8cae8adSLiu Zhe sleep(1); 286d8cae8adSLiu Zhe } 28704bad30fSLiu Zhe 2883816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 289b4d2d410SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 290b4d2d410SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 291bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 29204bad30fSLiu Zhe } 29304bad30fSLiu Zhe 29404bad30fSLiu Zhe /** 29504bad30fSLiu Zhe * Test Insert Footer to focus slide. 29622a14f28SLiu Zhe * 29704bad30fSLiu Zhe * @throws Exception 29804bad30fSLiu Zhe */ 29904bad30fSLiu Zhe @Test testInsertApplyFooterOnSlide()30022a14f28SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 30104bad30fSLiu Zhe 30222a14f28SLiu Zhe // add header and footer to focus slide. 3033816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30404bad30fSLiu Zhe 305b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 306b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 307b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 308b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 309b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 310b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 311b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 31204bad30fSLiu Zhe 3133816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 314b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 315b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 316b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 317b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 318b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 319b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 32022a14f28SLiu Zhe // close header and footer dialog. 321b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 32204bad30fSLiu Zhe typeKeys("<tab>"); 32304bad30fSLiu Zhe typeKeys("<enter>"); 32422a14f28SLiu Zhe // end close 32504bad30fSLiu Zhe 326b4d2d410SLiu Zhe impressSlideSorter.focus(); 32704bad30fSLiu Zhe typeKeys("<up>"); 32822a14f28SLiu Zhe sleep(1); // If no sleep, error occur 32904bad30fSLiu Zhe 3303816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 331b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 332b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 333b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33422a14f28SLiu Zhe // close header and footer dialog. 335b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33604bad30fSLiu Zhe typeKeys("<tab>"); 33704bad30fSLiu Zhe typeKeys("<enter>"); 33822a14f28SLiu Zhe // end close 33904bad30fSLiu Zhe 340b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 3413816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 342b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 343b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 344b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 345bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 34604bad30fSLiu Zhe } 34704bad30fSLiu Zhe 34804bad30fSLiu Zhe /** 34904bad30fSLiu Zhe * Test Insert Footer to Notes View 35022a14f28SLiu Zhe * 35104bad30fSLiu Zhe * @throws Exception 35204bad30fSLiu Zhe */ 35304bad30fSLiu Zhe @Test testInsertApplyToAllFooterOnNotes()35422a14f28SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35504bad30fSLiu Zhe 35622a14f28SLiu Zhe // add header and footer to focus slide. 3573816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 358b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 359b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 360b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 361b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 362b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 363b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 364b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 365b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 366b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 367b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 368b4d2d410SLiu Zhe 369b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 370b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 371b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 372b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 373b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 374b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 375b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 376b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 377b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 378b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37922a14f28SLiu Zhe // close header and footer dialog. 380b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 38104bad30fSLiu Zhe typeKeys("<tab>"); 38204bad30fSLiu Zhe typeKeys("<enter>"); 38322a14f28SLiu Zhe // end close 38404bad30fSLiu Zhe 385b4d2d410SLiu Zhe impressSlideSorter.focus(); 38604bad30fSLiu Zhe typeKeys("<up>"); 38704bad30fSLiu Zhe 3883816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 389b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 390b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 391b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 392b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 393b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 394b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 395b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 396b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 397b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39822a14f28SLiu Zhe // close header and footer dialog. 399b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 40004bad30fSLiu Zhe typeKeys("<tab>"); 40104bad30fSLiu Zhe typeKeys("<enter>"); 40222a14f28SLiu Zhe // end close 40304bad30fSLiu Zhe 404b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 405b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 406b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 407b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 408b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 409b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 410b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 411b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 412b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 413b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 414b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 415bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 41604bad30fSLiu Zhe } 41704bad30fSLiu Zhe 41804bad30fSLiu Zhe /** 41904bad30fSLiu Zhe * Test Insert Footer to Slide, use Apply to All 42022a14f28SLiu Zhe * 42104bad30fSLiu Zhe * @throws Exception 42204bad30fSLiu Zhe */ 42304bad30fSLiu Zhe @Test testInsertApplyToAllFooterOnSlide()42422a14f28SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 42504bad30fSLiu Zhe 42622a14f28SLiu Zhe // add header and footer to focus slide. 4273816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 42804bad30fSLiu Zhe 429b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 430b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 431b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 432b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 433b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 434b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 435b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 43604bad30fSLiu Zhe 4373816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 438b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 439b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 440b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 441b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 442b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 443b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 44422a14f28SLiu Zhe // close header and footer dialog. 445b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 44604bad30fSLiu Zhe typeKeys("<tab>"); 44704bad30fSLiu Zhe typeKeys("<enter>"); 44822a14f28SLiu Zhe // end close 44904bad30fSLiu Zhe 450b4d2d410SLiu Zhe impressSlideSorter.focus(); 45104bad30fSLiu Zhe typeKeys("<up>"); 45204bad30fSLiu Zhe 4533816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 454b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 455b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 456b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 457b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 458b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 459b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 46022a14f28SLiu Zhe // close header and footer dialog. 461b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 46204bad30fSLiu Zhe typeKeys("<tab>"); 46304bad30fSLiu Zhe typeKeys("<enter>"); 46422a14f28SLiu Zhe // end close 46504bad30fSLiu Zhe 466b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 4673816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 468b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 469b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 470b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 471b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 472b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 473b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 474bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 47504bad30fSLiu Zhe } 47604bad30fSLiu Zhe 47704bad30fSLiu Zhe /** 47804bad30fSLiu Zhe * Test Insert update automatically time footer to slides. 47922a14f28SLiu Zhe * 48004bad30fSLiu Zhe * @throws Exception 48104bad30fSLiu Zhe */ 48204bad30fSLiu Zhe @Test testInsertAutoUpdateTimeFooter()48322a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 48404bad30fSLiu Zhe 48522a14f28SLiu Zhe // add header and footer 4863816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 487b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 488b4d2d410SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 489b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 490b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 491c37bcbf4SLi Feng Wang sleep(1); 49204bad30fSLiu Zhe 4933816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 494b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 4953816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 496bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 49704bad30fSLiu Zhe } 49804bad30fSLiu Zhe 49904bad30fSLiu Zhe /** 50004bad30fSLiu Zhe * Test Insert update automatically time footer to Notes view. 50122a14f28SLiu Zhe * 50204bad30fSLiu Zhe * @throws Exception 50304bad30fSLiu Zhe */ 50404bad30fSLiu Zhe @Test testInsertAutoUpdateTimeFooterOnNotes()50522a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 50604bad30fSLiu Zhe 50722a14f28SLiu Zhe // add header and footer 5083816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 509b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 510b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 511b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 512b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 513c37bcbf4SLi Feng Wang sleep(1); 51404bad30fSLiu Zhe 5153816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 516b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 517b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51804bad30fSLiu Zhe 5193816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 520bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 52104bad30fSLiu Zhe } 52204bad30fSLiu Zhe 52304bad30fSLiu Zhe /** 52422a14f28SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 52522a14f28SLiu Zhe * 52604bad30fSLiu Zhe * @throws Exception 52704bad30fSLiu Zhe */ 52804bad30fSLiu Zhe @Test testInsertHeaderFooterOnNotes()52922a14f28SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 53004bad30fSLiu Zhe 53122a14f28SLiu Zhe // add header and footer 5323816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 533b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 534b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 535b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 536b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 537b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 538b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 539b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 540b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 541b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 542b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 543b4d2d410SLiu Zhe 544b4d2d410SLiu Zhe impressSlideSorter.focus(); 54504bad30fSLiu Zhe typeKeys("<up>"); 54604bad30fSLiu Zhe 5473816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 548b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 549b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 550b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 551b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 552b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 553b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 55404bad30fSLiu Zhe 555c37bcbf4SLi Feng Wang // save and reopen this file 55695269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55704bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 558c37bcbf4SLi Feng Wang saveAs(saveTo); 559c37bcbf4SLi Feng Wang close(); 560c37bcbf4SLi Feng Wang open(saveTo); 561c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 562c37bcbf4SLi Feng Wang 56322a14f28SLiu Zhe // check after reopen 5643816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 565b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 566b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 567b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 568b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 569b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 570bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 57104bad30fSLiu Zhe } 57204bad30fSLiu Zhe 57304bad30fSLiu Zhe /** 57422a14f28SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57522a14f28SLiu Zhe * 57604bad30fSLiu Zhe * @throws Exception 57704bad30fSLiu Zhe */ 57804bad30fSLiu Zhe @Test testInsertHeaderFooterOnSlide()57922a14f28SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 58004bad30fSLiu Zhe 58122a14f28SLiu Zhe // add header and footer 5823816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 583b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 584b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 585b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 586b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 587b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 588b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 589b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 59004bad30fSLiu Zhe 591b4d2d410SLiu Zhe impressSlideSorter.focus(); 59204bad30fSLiu Zhe typeKeys("<up>"); 59304bad30fSLiu Zhe 5943816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 595b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 596b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 597b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59804bad30fSLiu Zhe 59922a14f28SLiu Zhe // close header and footer dialog. 600b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 60104bad30fSLiu Zhe typeKeys("<tab>"); 60204bad30fSLiu Zhe typeKeys("<enter>"); 60304bad30fSLiu Zhe 60422a14f28SLiu Zhe // save this file 60595269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60604bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 607c37bcbf4SLi Feng Wang saveAs(saveTo); 608c37bcbf4SLi Feng Wang close(); 609c37bcbf4SLi Feng Wang open(saveTo); 610c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 611c37bcbf4SLi Feng Wang 61222a14f28SLiu Zhe // check after reopen 6133816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 614b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 615b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 616b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 617bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 61804bad30fSLiu Zhe } 61904bad30fSLiu Zhe } 620