104bad30fSLiu Zhe /************************************************************** 204bad30fSLiu Zhe * 304bad30fSLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 404bad30fSLiu Zhe * or more contributor license agreements. See the NOTICE file 504bad30fSLiu Zhe * distributed with this work for additional information 604bad30fSLiu Zhe * regarding copyright ownership. The ASF licenses this file 704bad30fSLiu Zhe * to you under the Apache License, Version 2.0 (the 804bad30fSLiu Zhe * "License"); you may not use this file except in compliance 904bad30fSLiu Zhe * with the License. You may obtain a copy of the License at 1004bad30fSLiu Zhe * 1104bad30fSLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 1204bad30fSLiu Zhe * 1304bad30fSLiu Zhe * Unless required by applicable law or agreed to in writing, 1404bad30fSLiu Zhe * software distributed under the License is distributed on an 1504bad30fSLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1604bad30fSLiu Zhe * KIND, either express or implied. See the License for the 1704bad30fSLiu Zhe * specific language governing permissions and limitations 1804bad30fSLiu Zhe * under the License. 1904bad30fSLiu Zhe * 2004bad30fSLiu Zhe *************************************************************/ 2104bad30fSLiu Zhe 2204bad30fSLiu Zhe /** 2304bad30fSLiu Zhe * 2404bad30fSLiu Zhe */ 2580a6f5c5SLiu Zhe package fvt.gui.sd.headerandfooter; 2622a14f28SLiu Zhe 2722a14f28SLiu Zhe import static org.junit.Assert.*; 2895269d92SLiu Zhe import static org.openoffice.test.common.Testspace.*; 2922a14f28SLiu Zhe import static org.openoffice.test.vcl.Tester.*; 30b4d2d410SLiu Zhe import static testlib.gui.AppTool.*; 3195269d92SLiu Zhe import static testlib.gui.UIMap.*; 3222a14f28SLiu Zhe 3304bad30fSLiu Zhe import org.junit.After; 3404bad30fSLiu Zhe import org.junit.Before; 3504bad30fSLiu Zhe import org.junit.Rule; 3604bad30fSLiu Zhe import org.junit.Test; 3704bad30fSLiu Zhe import org.openoffice.test.common.FileUtil; 3822a14f28SLiu Zhe import org.openoffice.test.common.Logger; 3995269d92SLiu Zhe 40b4d2d410SLiu Zhe import testlib.gui.SDTool; 4104bad30fSLiu Zhe 4222a14f28SLiu Zhe public class HeaderAndFooterSetting { 4304bad30fSLiu Zhe 4404bad30fSLiu Zhe @Rule 4522a14f28SLiu Zhe public Logger log = Logger.getLogger(this); 4604bad30fSLiu Zhe 4704bad30fSLiu Zhe @Before 4804bad30fSLiu Zhe public void setUp() throws Exception { 4922a14f28SLiu Zhe app.start(true); // Bug 120476 5004bad30fSLiu Zhe 5104bad30fSLiu Zhe // New a impress, insert some slides 5204bad30fSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 53b4d2d410SLiu Zhe presentationWizard.ok(); 54d8cae8adSLiu Zhe impress.waitForExistence(10, 2); 5504bad30fSLiu Zhe 5622a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 57b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 5804bad30fSLiu Zhe } 5904bad30fSLiu Zhe // Pop up navigator panel 60b4d2d410SLiu Zhe if (!sdNavigatorDlg.exists()) { 613816404dSLiu Zhe app.dispatch(".uno:Navigator"); 6204bad30fSLiu Zhe } 6304bad30fSLiu Zhe } 6404bad30fSLiu Zhe 6504bad30fSLiu Zhe @After 6604bad30fSLiu Zhe public void tearDown() throws Exception { 67*70375b46SLi 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()); 12504bad30fSLiu Zhe } 12604bad30fSLiu Zhe 12704bad30fSLiu Zhe /** 12804bad30fSLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12922a14f28SLiu Zhe * 13004bad30fSLiu Zhe * @throws Exception 13104bad30fSLiu Zhe */ 13204bad30fSLiu Zhe @Test 13322a14f28SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13404bad30fSLiu Zhe 13522a14f28SLiu Zhe // add header and footer 1363816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13704bad30fSLiu Zhe 138b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 139b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 140b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 141b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 142b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 143b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 144b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14504bad30fSLiu Zhe 146b4d2d410SLiu Zhe impressSlideSorter.focus(); 14722a14f28SLiu Zhe for (int j = 0; j <= 2; j++) { 14804bad30fSLiu Zhe typeKeys("<up>"); 14904bad30fSLiu Zhe } 1503816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 151b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 152b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 15304bad30fSLiu Zhe 15422a14f28SLiu Zhe // paste to the same file 155b4d2d410SLiu Zhe impressSlideSorter.focus(); 15604bad30fSLiu Zhe typeKeys("<up>"); 15704bad30fSLiu Zhe app.dispatch(".uno:Copy"); 15804bad30fSLiu Zhe typeKeys("<down>"); 15904bad30fSLiu Zhe app.dispatch(".uno:Paste"); 16004bad30fSLiu Zhe 1613816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 162b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 163b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 164b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 165b4d2d410SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16604bad30fSLiu Zhe 16722a14f28SLiu Zhe // paste to different file 1683816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 169b4d2d410SLiu Zhe presentationWizard.ok(); 17004bad30fSLiu Zhe app.dispatch(".uno:Paste"); 171b4d2d410SLiu Zhe impressSlideSorter.focus(); 17204bad30fSLiu Zhe typeKeys("<down>"); 1733816404dSLiu Zhe sleep(1); // If no sleep, error occur 17404bad30fSLiu Zhe 1753816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 176b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 177b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 178b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 17904bad30fSLiu Zhe } 18004bad30fSLiu Zhe 18104bad30fSLiu Zhe /** 18204bad30fSLiu Zhe * Test Copy slide with Notes Footer to same file and different file 18322a14f28SLiu Zhe * 18404bad30fSLiu Zhe * @throws Exception 18504bad30fSLiu Zhe */ 18604bad30fSLiu Zhe @Test 18722a14f28SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 18804bad30fSLiu Zhe 18922a14f28SLiu Zhe // add header and footer 1903816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 191b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 192b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 193b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 194b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 195b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 196b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 197b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 198b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 199b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 200b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 20104bad30fSLiu Zhe 20222a14f28SLiu Zhe // paste to the same file 203b4d2d410SLiu Zhe impressSlideSorter.focus(); 20404bad30fSLiu Zhe typeKeys("<up>"); 20504bad30fSLiu Zhe app.dispatch(".uno:Copy"); 20604bad30fSLiu Zhe typeKeys("<down>"); 20704bad30fSLiu Zhe app.dispatch(".uno:Paste"); 20804bad30fSLiu Zhe 2093816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 210b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 211b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 212b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 213b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 214b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 215b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21604bad30fSLiu Zhe 21722a14f28SLiu Zhe // paste to different file 21804bad30fSLiu Zhe impress.focus(); 2193816404dSLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 220b4d2d410SLiu Zhe presentationWizard.ok(); 22104bad30fSLiu Zhe app.dispatch(".uno:Paste"); 222b4d2d410SLiu Zhe impressSlideSorter.focus(); 22304bad30fSLiu Zhe typeKeys("<down>"); 224b4d2d410SLiu Zhe SDTool.getActiveView().activate(); 2253816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 226b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 227b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 228b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 229b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 230b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 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 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()); 26104bad30fSLiu Zhe } 26204bad30fSLiu Zhe 26304bad30fSLiu Zhe /** 26422a14f28SLiu Zhe * Test footer not show on the first slide. 26522a14f28SLiu Zhe * 26604bad30fSLiu Zhe * @throws Exception 26704bad30fSLiu Zhe */ 268d8cae8adSLiu Zhe @Test 26922a14f28SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 27004bad30fSLiu Zhe 27122a14f28SLiu Zhe // add header and footer 2723816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 273b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 274b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 275b4d2d410SLiu Zhe sdFooterNotShowOn1stSlide.check(); 276b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27704bad30fSLiu Zhe 2783816404dSLiu Zhe // Check slide 1 279b4d2d410SLiu Zhe impressSlideSorter.focus(); 28022a14f28SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 28122a14f28SLiu Zhe // sleep(1); // If no sleep, error occur 28222a14f28SLiu Zhe for (int i = 0; i < 5; i++) { 283d8cae8adSLiu Zhe typeKeys("<up>"); 284d8cae8adSLiu Zhe sleep(1); 285d8cae8adSLiu Zhe } 28604bad30fSLiu Zhe 2873816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 288b4d2d410SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 289b4d2d410SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 29004bad30fSLiu Zhe } 29104bad30fSLiu Zhe 29204bad30fSLiu Zhe /** 29304bad30fSLiu Zhe * Test Insert Footer to focus slide. 29422a14f28SLiu Zhe * 29504bad30fSLiu Zhe * @throws Exception 29604bad30fSLiu Zhe */ 29704bad30fSLiu Zhe @Test 29822a14f28SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 29904bad30fSLiu Zhe 30022a14f28SLiu Zhe // add header and footer to focus slide. 3013816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30204bad30fSLiu Zhe 303b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 304b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 305b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 306b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 307b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 308b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 309b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.click(); 31004bad30fSLiu Zhe 3113816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 312b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 313b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 314b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 315b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 316b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 317b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 31822a14f28SLiu Zhe // close header and footer dialog. 319b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 32004bad30fSLiu Zhe typeKeys("<tab>"); 32104bad30fSLiu Zhe typeKeys("<enter>"); 32222a14f28SLiu Zhe // end close 32304bad30fSLiu Zhe 324b4d2d410SLiu Zhe impressSlideSorter.focus(); 32504bad30fSLiu Zhe typeKeys("<up>"); 32622a14f28SLiu Zhe sleep(1); // If no sleep, error occur 32704bad30fSLiu Zhe 3283816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 329b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 330b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 331b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33222a14f28SLiu Zhe // close header and footer dialog. 333b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33404bad30fSLiu Zhe typeKeys("<tab>"); 33504bad30fSLiu Zhe typeKeys("<enter>"); 33622a14f28SLiu Zhe // end close 33704bad30fSLiu Zhe 338b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 3393816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 340b4d2d410SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 341b4d2d410SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 342b4d2d410SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 34304bad30fSLiu Zhe } 34404bad30fSLiu Zhe 34504bad30fSLiu Zhe /** 34604bad30fSLiu Zhe * Test Insert Footer to Notes View 34722a14f28SLiu Zhe * 34804bad30fSLiu Zhe * @throws Exception 34904bad30fSLiu Zhe */ 35004bad30fSLiu Zhe @Test 35122a14f28SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35204bad30fSLiu Zhe 35322a14f28SLiu Zhe // add header and footer to focus slide. 3543816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 355b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 356b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 357b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 358b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 359b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 360b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 361b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 362b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 363b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 364b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 365b4d2d410SLiu Zhe 366b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 367b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 368b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 369b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 370b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 371b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 372b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 373b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 374b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 375b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37622a14f28SLiu Zhe // close header and footer dialog. 377b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 37804bad30fSLiu Zhe typeKeys("<tab>"); 37904bad30fSLiu Zhe typeKeys("<enter>"); 38022a14f28SLiu Zhe // end close 38104bad30fSLiu Zhe 382b4d2d410SLiu Zhe impressSlideSorter.focus(); 38304bad30fSLiu Zhe typeKeys("<up>"); 38404bad30fSLiu Zhe 3853816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 386b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 387b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 388b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 389b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 390b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 391b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 392b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 393b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 394b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39522a14f28SLiu Zhe // close header and footer dialog. 396b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 39704bad30fSLiu Zhe typeKeys("<tab>"); 39804bad30fSLiu Zhe typeKeys("<enter>"); 39922a14f28SLiu Zhe // end close 40004bad30fSLiu Zhe 401b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 402b4d2d410SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 403b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 404b4d2d410SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 405b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 406b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 407b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 408b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 409b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 410b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 411b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 41204bad30fSLiu Zhe } 41304bad30fSLiu Zhe 41404bad30fSLiu Zhe /** 41504bad30fSLiu Zhe * Test Insert Footer to Slide, use Apply to All 41622a14f28SLiu Zhe * 41704bad30fSLiu Zhe * @throws Exception 41804bad30fSLiu Zhe */ 41904bad30fSLiu Zhe @Test 42022a14f28SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 42104bad30fSLiu Zhe 42222a14f28SLiu Zhe // add header and footer to focus slide. 4233816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 42404bad30fSLiu Zhe 425b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 426b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 427b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 428b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 429b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 430b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 431b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 43204bad30fSLiu Zhe 4333816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 434b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 435b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 436b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 437b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 438b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 439b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 44022a14f28SLiu Zhe // close header and footer dialog. 441b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 44204bad30fSLiu Zhe typeKeys("<tab>"); 44304bad30fSLiu Zhe typeKeys("<enter>"); 44422a14f28SLiu Zhe // end close 44504bad30fSLiu Zhe 446b4d2d410SLiu Zhe impressSlideSorter.focus(); 44704bad30fSLiu Zhe typeKeys("<up>"); 44804bad30fSLiu Zhe 4493816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 450b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 451b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 452b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 453b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 454b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 455b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 45622a14f28SLiu Zhe // close header and footer dialog. 457b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 45804bad30fSLiu Zhe typeKeys("<tab>"); 45904bad30fSLiu Zhe typeKeys("<enter>"); 46022a14f28SLiu Zhe // end close 46104bad30fSLiu Zhe 462b4d2d410SLiu Zhe sdInsertPageButtonOnToolbar.click(); 4633816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 464b4d2d410SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 465b4d2d410SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 466b4d2d410SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 467b4d2d410SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 468b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 469b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 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(); 4863816404dSLiu Zhe sleep(1); // Wait some time to check the time update 48704bad30fSLiu Zhe 4883816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 489b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 4903816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 49104bad30fSLiu Zhe } 49204bad30fSLiu Zhe 49304bad30fSLiu Zhe /** 49404bad30fSLiu Zhe * Test Insert update automatically time footer to Notes view. 49522a14f28SLiu Zhe * 49604bad30fSLiu Zhe * @throws Exception 49704bad30fSLiu Zhe */ 49804bad30fSLiu Zhe @Test 49922a14f28SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 50004bad30fSLiu Zhe 50122a14f28SLiu Zhe // add header and footer 5023816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 503b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 504b4d2d410SLiu Zhe sdAutoUpdateTimeFooter.check(); 505b4d2d410SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 506b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 5073816404dSLiu Zhe sleep(1); // Wait some time to check the time update 50804bad30fSLiu Zhe 5093816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 510b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 511b4d2d410SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51204bad30fSLiu Zhe 5133816404dSLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 51404bad30fSLiu Zhe } 51504bad30fSLiu Zhe 51604bad30fSLiu Zhe /** 51722a14f28SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 51822a14f28SLiu Zhe * 51904bad30fSLiu Zhe * @throws Exception 52004bad30fSLiu Zhe */ 52104bad30fSLiu Zhe @Test 52222a14f28SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 52304bad30fSLiu Zhe 52422a14f28SLiu Zhe // add header and footer 5253816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 526b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 527b4d2d410SLiu Zhe sdHeaderTextOnNotes.check(); 528b4d2d410SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 529b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 530b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 531b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 532b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 533b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 534b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 535b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 536b4d2d410SLiu Zhe 537b4d2d410SLiu Zhe impressSlideSorter.focus(); 53804bad30fSLiu Zhe typeKeys("<up>"); 53904bad30fSLiu Zhe 5403816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 541b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 542b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 543b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 544b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 545b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 546b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 54704bad30fSLiu Zhe 54822a14f28SLiu Zhe // save this file 5493816404dSLiu Zhe app.dispatch(".uno:SaveAs"); 55095269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55104bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 55222a14f28SLiu Zhe submitSaveDlg(saveTo); 5534a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 5544a13b48eSLi Feng Wang activeMsgBox.yes(); 5554a13b48eSLi Feng Wang sleep(2); 5564a13b48eSLi Feng Wang } 5574a13b48eSLi Feng Wang sleep(5); 5583816404dSLiu Zhe app.dispatch(".uno:CloseDoc"); 55904bad30fSLiu Zhe 56022a14f28SLiu Zhe // Reopen this file 56104bad30fSLiu Zhe openStartcenter(); 56204bad30fSLiu Zhe app.dispatch(".uno:Open"); 56322a14f28SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 56404bad30fSLiu Zhe submitOpenDlg(openFrom); 5654a13b48eSLi Feng Wang sleep(5); 56622a14f28SLiu Zhe // check after reopen 5673816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 568b4d2d410SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 569b4d2d410SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 570b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 571b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 572b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 57304bad30fSLiu Zhe } 57404bad30fSLiu Zhe 57504bad30fSLiu Zhe /** 57622a14f28SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57722a14f28SLiu Zhe * 57804bad30fSLiu Zhe * @throws Exception 57904bad30fSLiu Zhe */ 58004bad30fSLiu Zhe @Test 58122a14f28SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 58204bad30fSLiu Zhe 58322a14f28SLiu Zhe // add header and footer 5843816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 585b4d2d410SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 586b4d2d410SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 587b4d2d410SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 588b4d2d410SLiu Zhe sdFooterTextOnSlide.check(); 589b4d2d410SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 590b4d2d410SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 591b4d2d410SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 59204bad30fSLiu Zhe 593b4d2d410SLiu Zhe impressSlideSorter.focus(); 59404bad30fSLiu Zhe typeKeys("<up>"); 59504bad30fSLiu Zhe 5963816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 597b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 598b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 599b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 60004bad30fSLiu Zhe 60122a14f28SLiu Zhe // close header and footer dialog. 602b4d2d410SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 60304bad30fSLiu Zhe typeKeys("<tab>"); 60404bad30fSLiu Zhe typeKeys("<enter>"); 60504bad30fSLiu Zhe 60622a14f28SLiu Zhe // save this file 6073816404dSLiu Zhe app.dispatch(".uno:SaveAs"); 60895269d92SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60904bad30fSLiu Zhe FileUtil.deleteFile(saveTo); 61022a14f28SLiu Zhe submitSaveDlg(saveTo); 6114a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 6124a13b48eSLi Feng Wang activeMsgBox.yes(); 6134a13b48eSLi Feng Wang sleep(2); 6144a13b48eSLi Feng Wang } 6154a13b48eSLi Feng Wang sleep(5); 6163816404dSLiu Zhe app.dispatch(".uno:CloseDoc"); 61704bad30fSLiu Zhe 61822a14f28SLiu Zhe // Reopen this file 61904bad30fSLiu Zhe openStartcenter(); 62004bad30fSLiu Zhe app.dispatch(".uno:Open"); 62122a14f28SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 62204bad30fSLiu Zhe submitOpenDlg(openFrom); 6234a13b48eSLi Feng Wang sleep(5); 62422a14f28SLiu Zhe // check after reopen 6253816404dSLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 626b4d2d410SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 627b4d2d410SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 628b4d2d410SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 62904bad30fSLiu Zhe } 63004bad30fSLiu Zhe } 631