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.Test; 3604bad30fSLiu Zhe import org.openoffice.test.common.FileUtil; 3795269d92SLiu Zhe 38*c37bcbf4SLi Feng Wang import testlib.gui.AppTool; 39b4d2d410SLiu Zhe import testlib.gui.SDTool; 4004bad30fSLiu Zhe 4122a14f28SLiu Zhe public class HeaderAndFooterSetting { 4204bad30fSLiu Zhe 4304bad30fSLiu Zhe @Before 4404bad30fSLiu Zhe public void setUp() throws Exception { 45*c37bcbf4SLi Feng Wang app.start(true); 46*c37bcbf4SLi Feng Wang AppTool.newPresentation(); 4722a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 48b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 4904bad30fSLiu Zhe } 5004bad30fSLiu Zhe // Pop up navigator panel 51b4d2d410SLiu Zhe if (!sdNavigatorDlg.exists()) { 523816404dSLiu Zhe app.dispatch(".uno:Navigator"); 5304bad30fSLiu Zhe } 5404bad30fSLiu Zhe } 5504bad30fSLiu Zhe 5604bad30fSLiu Zhe @After 5704bad30fSLiu Zhe public void tearDown() throws Exception { 5870375b46SLi Feng Wang sleep(3); 591ff8e3a9SLi Feng Wang if (sdNavigatorDlg.exists()) { 601ff8e3a9SLi Feng Wang app.dispatch(".uno:Navigator"); 611ff8e3a9SLi Feng Wang } 624a13b48eSLi Feng Wang app.stop(); 6304bad30fSLiu Zhe } 6404bad30fSLiu Zhe 6504bad30fSLiu Zhe /** 6604bad30fSLiu Zhe * Test Copy slide with Apply Footer to same file and different file 6722a14f28SLiu Zhe * 6804bad30fSLiu Zhe * @throws Exception 6904bad30fSLiu Zhe */ 70d8cae8adSLiu Zhe @Test 7122a14f28SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 7204bad30fSLiu Zhe 7322a14f28SLiu Zhe // add header and footer 743816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 7504bad30fSLiu Zhe 76b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 77b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 78b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 79b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 80b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 81b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 82b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 8304bad30fSLiu Zhe 843816404dSLiu Zhe // Click slide 3 85b4d2d410SLiu Zhe impressSlideSorter.focus(); 863816404dSLiu Zhe typeKeys("<up><up><up>"); 8704bad30fSLiu Zhe sleep(1); 883816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 89b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 90b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 9104bad30fSLiu Zhe 9222a14f28SLiu Zhe // paste to the same file 93b4d2d410SLiu Zhe impressSlideSorter.focus(); 9404bad30fSLiu Zhe app.dispatch(".uno:Copy"); 9504bad30fSLiu Zhe app.dispatch(".uno:Paste"); 9604bad30fSLiu Zhe 973816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 98b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 99b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 100b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 101b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 10204bad30fSLiu Zhe 10322a14f28SLiu Zhe // paste to different file 10404bad30fSLiu Zhe impress.focus(); 10504bad30fSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 106b4d2d410SLiu Zhe presentationWizard.ok(); 10704bad30fSLiu Zhe app.dispatch(".uno:Paste"); 108b4d2d410SLiu Zhe impressSlideSorter.focus(); 10904bad30fSLiu Zhe typeKeys("<down>"); 11004bad30fSLiu Zhe sleep(1); 11104bad30fSLiu Zhe 1123816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 113b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 114b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 115b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 116bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 117bcbf76e8SLi Feng Wang 11804bad30fSLiu Zhe } 11904bad30fSLiu Zhe 12004bad30fSLiu Zhe /** 12104bad30fSLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12222a14f28SLiu Zhe * 12304bad30fSLiu Zhe * @throws Exception 12404bad30fSLiu Zhe */ 12504bad30fSLiu Zhe @Test 12622a14f28SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 12704bad30fSLiu Zhe 12822a14f28SLiu Zhe // add header and footer 1293816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13004bad30fSLiu Zhe 131b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 132b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 133b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 134b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 135b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 136b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 137b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 13804bad30fSLiu Zhe 139b4d2d410SLiu Zhe impressSlideSorter.focus(); 14022a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 14104bad30fSLiu Zhe typeKeys("<up>"); 14204bad30fSLiu Zhe } 1433816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 144b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 145b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 14604bad30fSLiu Zhe 14722a14f28SLiu Zhe // paste to the same file 148b4d2d410SLiu Zhe impressSlideSorter.focus(); 14904bad30fSLiu Zhe typeKeys("<up>"); 15004bad30fSLiu Zhe app.dispatch(".uno:Copy"); 15104bad30fSLiu Zhe typeKeys("<down>"); 15204bad30fSLiu Zhe app.dispatch(".uno:Paste"); 15304bad30fSLiu Zhe 1543816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 155b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 156b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 157b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 158b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 15904bad30fSLiu Zhe 16022a14f28SLiu Zhe // paste to different file 1613816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 162b4d2d410SLiu Zhe presentationWizard.ok(); 16304bad30fSLiu Zhe app.dispatch(".uno:Paste"); 164b4d2d410SLiu Zhe impressSlideSorter.focus(); 16504bad30fSLiu Zhe typeKeys("<down>"); 1663816404dSLiu Zhe sleep(1); // If no sleep, error occur 16704bad30fSLiu Zhe 1683816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 169b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 170b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 171b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 172bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 17304bad30fSLiu Zhe } 17404bad30fSLiu Zhe 17504bad30fSLiu Zhe /** 17604bad30fSLiu Zhe * Test Copy slide with Notes Footer to same file and different file 17722a14f28SLiu Zhe * 17804bad30fSLiu Zhe * @throws Exception 17904bad30fSLiu Zhe */ 18004bad30fSLiu Zhe @Test 18122a14f28SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 18204bad30fSLiu Zhe 18322a14f28SLiu Zhe // add header and footer 1843816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 185b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 186b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 187b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 188b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 189b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 190b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 191b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 192b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 193b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 194b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 19504bad30fSLiu Zhe 19622a14f28SLiu Zhe // paste to the same file 197b4d2d410SLiu Zhe impressSlideSorter.focus(); 19804bad30fSLiu Zhe typeKeys("<up>"); 19904bad30fSLiu Zhe app.dispatch(".uno:Copy"); 20004bad30fSLiu Zhe typeKeys("<down>"); 20104bad30fSLiu Zhe app.dispatch(".uno:Paste"); 20204bad30fSLiu Zhe 2033816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 204b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 205b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 206b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 207b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 208b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 209b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21004bad30fSLiu Zhe 21122a14f28SLiu Zhe // paste to different file 21204bad30fSLiu Zhe impress.focus(); 2133816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 214b4d2d410SLiu Zhe presentationWizard.ok(); 21504bad30fSLiu Zhe app.dispatch(".uno:Paste"); 216b4d2d410SLiu Zhe impressSlideSorter.focus(); 21704bad30fSLiu Zhe typeKeys("<down>"); 218b4d2d410SLiu Zhe SDTool.getActiveView().activate(); 2193816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 220b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 221b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 222b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 223b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 224b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 225bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 22604bad30fSLiu Zhe } 22704bad30fSLiu Zhe 22804bad30fSLiu Zhe /** 22922a14f28SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23022a14f28SLiu Zhe * 23104bad30fSLiu Zhe * @throws Exception 23204bad30fSLiu Zhe */ 23304bad30fSLiu Zhe @Test 23422a14f28SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 23504bad30fSLiu Zhe 23622a14f28SLiu Zhe // add header and footer 2373816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 23804bad30fSLiu Zhe 239b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 240b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 241b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 242b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 243b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 244b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 245b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 24604bad30fSLiu Zhe 247b4d2d410SLiu Zhe impressSlideSorter.focus(); 24822a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 24904bad30fSLiu Zhe typeKeys("<up>"); 25004bad30fSLiu Zhe } 2513816404dSLiu Zhe app.dispatch(".uno:DuplicatePage"); 2523816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 253b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 254b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 255b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 256bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 25704bad30fSLiu Zhe } 25804bad30fSLiu Zhe 25904bad30fSLiu Zhe /** 26022a14f28SLiu Zhe * Test footer not show on the first slide. 26122a14f28SLiu Zhe * 26204bad30fSLiu Zhe * @throws Exception 26304bad30fSLiu Zhe */ 264d8cae8adSLiu Zhe @Test 26522a14f28SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 26604bad30fSLiu Zhe 26722a14f28SLiu Zhe // add header and footer 2683816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 269b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 270b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 271b4d2d410SLiu Zhe sdFooterNotShowOn1stSlide.check(); 272b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27304bad30fSLiu Zhe 2743816404dSLiu Zhe // Check slide 1 275b4d2d410SLiu Zhe impressSlideSorter.focus(); 27622a14f28SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 27722a14f28SLiu Zhe // sleep(1); // If no sleep, error occur 27822a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 279d8cae8adSLiu Zhe typeKeys("<up>"); 280d8cae8adSLiu Zhe sleep(1); 281d8cae8adSLiu Zhe } 28204bad30fSLiu Zhe 2833816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 284b4d2d410SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 285b4d2d410SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 286bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 28704bad30fSLiu Zhe } 28804bad30fSLiu Zhe 28904bad30fSLiu Zhe /** 29004bad30fSLiu Zhe * Test Insert Footer to focus slide. 29122a14f28SLiu Zhe * 29204bad30fSLiu Zhe * @throws Exception 29304bad30fSLiu Zhe */ 29404bad30fSLiu Zhe @Test 29522a14f28SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 29604bad30fSLiu Zhe 29722a14f28SLiu Zhe // add header and footer to focus slide. 2983816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 29904bad30fSLiu Zhe 300b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 301b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 302b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 303b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 304b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 305b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 306b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 30704bad30fSLiu Zhe 3083816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 309b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 310b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 311b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 312b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 313b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 314b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 31522a14f28SLiu Zhe // close header and footer dialog. 316b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 31704bad30fSLiu Zhe typeKeys("<tab>"); 31804bad30fSLiu Zhe typeKeys("<enter>"); 31922a14f28SLiu Zhe // end close 32004bad30fSLiu Zhe 321b4d2d410SLiu Zhe impressSlideSorter.focus(); 32204bad30fSLiu Zhe typeKeys("<up>"); 32322a14f28SLiu Zhe sleep(1); // If no sleep, error occur 32404bad30fSLiu Zhe 3253816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 326b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 327b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 328b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 32922a14f28SLiu Zhe // close header and footer dialog. 330b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33104bad30fSLiu Zhe typeKeys("<tab>"); 33204bad30fSLiu Zhe typeKeys("<enter>"); 33322a14f28SLiu Zhe // end close 33404bad30fSLiu Zhe 335b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 3363816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 337b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 338b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 339b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 340bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 34104bad30fSLiu Zhe } 34204bad30fSLiu Zhe 34304bad30fSLiu Zhe /** 34404bad30fSLiu Zhe * Test Insert Footer to Notes View 34522a14f28SLiu Zhe * 34604bad30fSLiu Zhe * @throws Exception 34704bad30fSLiu Zhe */ 34804bad30fSLiu Zhe @Test 34922a14f28SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35004bad30fSLiu Zhe 35122a14f28SLiu Zhe // add header and footer to focus slide. 3523816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 353b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 354b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 355b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 356b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 357b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 358b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 359b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 360b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 361b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 362b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 363b4d2d410SLiu Zhe 364b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 365b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 366b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 367b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 368b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 369b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 370b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 371b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 372b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 373b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37422a14f28SLiu Zhe // close header and footer dialog. 375b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 37604bad30fSLiu Zhe typeKeys("<tab>"); 37704bad30fSLiu Zhe typeKeys("<enter>"); 37822a14f28SLiu Zhe // end close 37904bad30fSLiu Zhe 380b4d2d410SLiu Zhe impressSlideSorter.focus(); 38104bad30fSLiu Zhe typeKeys("<up>"); 38204bad30fSLiu Zhe 3833816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 384b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 385b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 386b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 387b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 388b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 389b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 390b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 391b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 392b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39322a14f28SLiu Zhe // close header and footer dialog. 394b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 39504bad30fSLiu Zhe typeKeys("<tab>"); 39604bad30fSLiu Zhe typeKeys("<enter>"); 39722a14f28SLiu Zhe // end close 39804bad30fSLiu Zhe 399b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 400b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 401b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 402b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 403b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 404b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 405b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 406b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 407b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 408b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 409b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 410bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 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()); 469bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 47004bad30fSLiu Zhe } 47104bad30fSLiu Zhe 47204bad30fSLiu Zhe /** 47304bad30fSLiu Zhe * Test Insert update automatically time footer to slides. 47422a14f28SLiu Zhe * 47504bad30fSLiu Zhe * @throws Exception 47604bad30fSLiu Zhe */ 47704bad30fSLiu Zhe @Test 47822a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 47904bad30fSLiu Zhe 48022a14f28SLiu Zhe // add header and footer 4813816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 482b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 483b4d2d410SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 484b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 485b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 486*c37bcbf4SLi Feng Wang sleep(1); 48704bad30fSLiu Zhe 4883816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 489b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 4903816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 491bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 49204bad30fSLiu Zhe } 49304bad30fSLiu Zhe 49404bad30fSLiu Zhe /** 49504bad30fSLiu Zhe * Test Insert update automatically time footer to Notes view. 49622a14f28SLiu Zhe * 49704bad30fSLiu Zhe * @throws Exception 49804bad30fSLiu Zhe */ 49904bad30fSLiu Zhe @Test 50022a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 50104bad30fSLiu Zhe 50222a14f28SLiu Zhe // add header and footer 5033816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 504b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 505b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 506b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 507b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 508*c37bcbf4SLi Feng Wang sleep(1); 50904bad30fSLiu Zhe 5103816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 511b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 512b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51304bad30fSLiu Zhe 5143816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 515bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 51604bad30fSLiu Zhe } 51704bad30fSLiu Zhe 51804bad30fSLiu Zhe /** 51922a14f28SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 52022a14f28SLiu Zhe * 52104bad30fSLiu Zhe * @throws Exception 52204bad30fSLiu Zhe */ 52304bad30fSLiu Zhe @Test 52422a14f28SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 52504bad30fSLiu Zhe 52622a14f28SLiu Zhe // add header and footer 5273816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 528b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 529b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 530b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 531b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 532b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 533b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 534b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 535b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 536b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 537b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 538b4d2d410SLiu Zhe 539b4d2d410SLiu Zhe impressSlideSorter.focus(); 54004bad30fSLiu Zhe typeKeys("<up>"); 54104bad30fSLiu Zhe 5423816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 543b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 544b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 545b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 546b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 547b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 548b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 54904bad30fSLiu Zhe 550*c37bcbf4SLi Feng Wang // save and reopen this file 55195269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55204bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 553*c37bcbf4SLi Feng Wang saveAs(saveTo); 554*c37bcbf4SLi Feng Wang close(); 555*c37bcbf4SLi Feng Wang open(saveTo); 556*c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 557*c37bcbf4SLi Feng Wang 55822a14f28SLiu Zhe // check after reopen 5593816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 560b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 561b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 562b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 563b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 564b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 565bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 56604bad30fSLiu Zhe } 56704bad30fSLiu Zhe 56804bad30fSLiu Zhe /** 56922a14f28SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57022a14f28SLiu Zhe * 57104bad30fSLiu Zhe * @throws Exception 57204bad30fSLiu Zhe */ 57304bad30fSLiu Zhe @Test 57422a14f28SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 57504bad30fSLiu Zhe 57622a14f28SLiu Zhe // add header and footer 5773816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 578b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 579b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 580b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 581b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 582b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 583b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 584b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 58504bad30fSLiu Zhe 586b4d2d410SLiu Zhe impressSlideSorter.focus(); 58704bad30fSLiu Zhe typeKeys("<up>"); 58804bad30fSLiu Zhe 5893816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 590b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 591b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 592b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59304bad30fSLiu Zhe 59422a14f28SLiu Zhe // close header and footer dialog. 595b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 59604bad30fSLiu Zhe typeKeys("<tab>"); 59704bad30fSLiu Zhe typeKeys("<enter>"); 59804bad30fSLiu Zhe 59922a14f28SLiu Zhe // save this file 60095269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60104bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 602*c37bcbf4SLi Feng Wang saveAs(saveTo); 603*c37bcbf4SLi Feng Wang close(); 604*c37bcbf4SLi Feng Wang open(saveTo); 605*c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 606*c37bcbf4SLi Feng Wang 60722a14f28SLiu Zhe // check after reopen 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()); 612bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 61304bad30fSLiu Zhe } 61404bad30fSLiu Zhe } 615