1c37bcbf4SLi Feng Wang /************************************************************** 2c37bcbf4SLi Feng Wang * 3c37bcbf4SLi Feng Wang * Licensed to the Apache Software Foundation (ASF) under one 4c37bcbf4SLi Feng Wang * or more contributor license agreements. See the NOTICE file 5c37bcbf4SLi Feng Wang * distributed with this work for additional information 6c37bcbf4SLi Feng Wang * regarding copyright ownership. The ASF licenses this file 7c37bcbf4SLi Feng Wang * to you under the Apache License, Version 2.0 (the 8c37bcbf4SLi Feng Wang * "License"); you may not use this file except in compliance 9c37bcbf4SLi Feng Wang * with the License. You may obtain a copy of the License at 10c37bcbf4SLi Feng Wang * 11c37bcbf4SLi Feng Wang * http://www.apache.org/licenses/LICENSE-2.0 12c37bcbf4SLi Feng Wang * 13c37bcbf4SLi Feng Wang * Unless required by applicable law or agreed to in writing, 14c37bcbf4SLi Feng Wang * software distributed under the License is distributed on an 15c37bcbf4SLi Feng Wang * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c37bcbf4SLi Feng Wang * KIND, either express or implied. See the License for the 17c37bcbf4SLi Feng Wang * specific language governing permissions and limitations 18c37bcbf4SLi Feng Wang * under the License. 19c37bcbf4SLi Feng Wang * 20c37bcbf4SLi Feng Wang *************************************************************/ 21c37bcbf4SLi Feng Wang 22c37bcbf4SLi Feng Wang /** 23c37bcbf4SLi Feng Wang * 24c37bcbf4SLi Feng Wang */ 25c37bcbf4SLi Feng Wang package fvt.gui.sd.headerandfooter; 26c37bcbf4SLi Feng Wang 27c37bcbf4SLi Feng Wang import static org.junit.Assert.*; 28c37bcbf4SLi Feng Wang import static org.openoffice.test.common.Testspace.*; 29c37bcbf4SLi Feng Wang import static org.openoffice.test.vcl.Tester.sleep; 30c37bcbf4SLi Feng Wang import static testlib.gui.AppTool.*; 31c37bcbf4SLi Feng Wang import static testlib.gui.UIMap.*; 32c37bcbf4SLi Feng Wang 33c37bcbf4SLi Feng Wang import org.junit.After; 34c37bcbf4SLi Feng Wang import org.junit.Before; 35*fd348426SLi Feng Wang import org.junit.Rule; 36c37bcbf4SLi Feng Wang import org.junit.Test; 37c37bcbf4SLi Feng Wang import org.openoffice.test.common.FileUtil; 38*fd348426SLi Feng Wang import org.openoffice.test.common.Logger; 39c37bcbf4SLi Feng Wang 40c37bcbf4SLi Feng Wang public class DocumentWithHeaderFooter { 41*fd348426SLi Feng Wang @Rule 42*fd348426SLi Feng Wang public Logger log = Logger.getLogger(this); 43*fd348426SLi Feng Wang 44c37bcbf4SLi Feng Wang 45c37bcbf4SLi Feng Wang @Before setUp()46c37bcbf4SLi Feng Wang public void setUp() throws Exception { 47c37bcbf4SLi Feng Wang app.start(true); 48c37bcbf4SLi Feng Wang } 49c37bcbf4SLi Feng Wang 50c37bcbf4SLi Feng Wang @After tearDown()51c37bcbf4SLi Feng Wang public void tearDown() throws Exception { 52c37bcbf4SLi Feng Wang app.stop(); 53c37bcbf4SLi Feng Wang 54c37bcbf4SLi Feng Wang } 55c37bcbf4SLi Feng Wang 56c37bcbf4SLi Feng Wang /** 57c37bcbf4SLi Feng Wang * Test open AOO3.4 presentation with header and footer. edit and save to 58c37bcbf4SLi Feng Wang * ODP 59c37bcbf4SLi Feng Wang * 60c37bcbf4SLi Feng Wang * @throws Exception 61c37bcbf4SLi Feng Wang */ 62c37bcbf4SLi Feng Wang @Test testOpenAOO34WithHeaderFooter()63c37bcbf4SLi Feng Wang public void testOpenAOO34WithHeaderFooter() throws Exception { 64c37bcbf4SLi Feng Wang // open sample file 65c37bcbf4SLi Feng Wang String file = prepareData("sd/AOO3.4HeaderFooter.odp"); 66c37bcbf4SLi Feng Wang open(file); 67c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 68c37bcbf4SLi Feng Wang 69c37bcbf4SLi Feng Wang // check after reopen 70c37bcbf4SLi Feng Wang app.dispatch(".uno:HeaderAndFooter"); 71c37bcbf4SLi Feng Wang assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 72c37bcbf4SLi Feng Wang assertEquals("fixed date", sdFixedDateAndTimeOnSlideInput.getText()); 73c37bcbf4SLi Feng Wang assertEquals(true, sdFooterTextOnSlide.isChecked()); 74c37bcbf4SLi Feng Wang assertEquals("footer test", sdFooterTextOnSlideInput.getText()); 75c37bcbf4SLi Feng Wang assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 76c37bcbf4SLi Feng Wang 77c37bcbf4SLi Feng Wang sdSlideNumAsFooterOnSlide.uncheck(); 78c37bcbf4SLi Feng Wang sdApplyToAllButtonOnSlideFooter.click(); 79c37bcbf4SLi Feng Wang 80c37bcbf4SLi Feng Wang // save to odp and reopen 81c37bcbf4SLi Feng Wang String saveTo2 = getPath("temp/" + "AOO3.4HeaderFooter.odp"); 82c37bcbf4SLi Feng Wang FileUtil.deleteFile(saveTo2); 83c37bcbf4SLi Feng Wang saveAs(saveTo2); 84c37bcbf4SLi Feng Wang close(); 85c37bcbf4SLi Feng Wang open(saveTo2); 86c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 87c37bcbf4SLi Feng Wang 88c37bcbf4SLi Feng Wang app.dispatch(".uno:HeaderAndFooter"); 89c37bcbf4SLi Feng Wang assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 90c37bcbf4SLi Feng Wang } 91c37bcbf4SLi Feng Wang 92c37bcbf4SLi Feng Wang /** 93c37bcbf4SLi Feng Wang * Test open ppt file with header and footer. edit and save to PPT/ODP 94c37bcbf4SLi Feng Wang * 95c37bcbf4SLi Feng Wang * @throws Exception 96c37bcbf4SLi Feng Wang */ 97c37bcbf4SLi Feng Wang @Test testOpenPPTWithHeaderFooter()98c37bcbf4SLi Feng Wang public void testOpenPPTWithHeaderFooter() throws Exception { 99c37bcbf4SLi Feng Wang // open sample file 100c37bcbf4SLi Feng Wang String file = prepareData("sd/gfdd.ppt"); 101c37bcbf4SLi Feng Wang open(file); 102c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 103c37bcbf4SLi Feng Wang 104c37bcbf4SLi Feng Wang // check after reopen 105c37bcbf4SLi Feng Wang app.dispatch(".uno:HeaderAndFooter"); 106c37bcbf4SLi Feng Wang assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 107c37bcbf4SLi Feng Wang assertEquals("testdte", sdFixedDateAndTimeOnSlideInput.getText()); 108c37bcbf4SLi Feng Wang assertEquals(true, sdFooterTextOnSlide.isChecked()); 109c37bcbf4SLi Feng Wang assertEquals("yesy", sdFooterTextOnSlideInput.getText()); 110c37bcbf4SLi Feng Wang assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 111c37bcbf4SLi Feng Wang 112c37bcbf4SLi Feng Wang sdSlideNumAsFooterOnSlide.uncheck(); 113c37bcbf4SLi Feng Wang sdApplyToAllButtonOnSlideFooter.click(); 114c37bcbf4SLi Feng Wang 115c37bcbf4SLi Feng Wang // save to ppt and reopen 116c37bcbf4SLi Feng Wang String saveTo = getPath("temp/" + "gfdd.ppt"); 117c37bcbf4SLi Feng Wang FileUtil.deleteFile(saveTo); 118c37bcbf4SLi Feng Wang saveAs(saveTo); 119c37bcbf4SLi Feng Wang close(); 120c37bcbf4SLi Feng Wang open(saveTo); 121c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 122c37bcbf4SLi Feng Wang 123c37bcbf4SLi Feng Wang app.dispatch(".uno:HeaderAndFooter"); 124c37bcbf4SLi Feng Wang assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 125c37bcbf4SLi Feng Wang 126c37bcbf4SLi Feng Wang // close Header and Footer dialog. 127c37bcbf4SLi Feng Wang sdApplyButtonOnSlideFooter.focus(); 128c37bcbf4SLi Feng Wang typeKeys("<tab>"); 129c37bcbf4SLi Feng Wang typeKeys("<enter>"); 130c37bcbf4SLi Feng Wang 131c37bcbf4SLi Feng Wang // save to odp and reopen 132c37bcbf4SLi Feng Wang String saveTo2 = getPath("temp/" + "gfdd.odp"); 133c37bcbf4SLi Feng Wang FileUtil.deleteFile(saveTo); 134c37bcbf4SLi Feng Wang saveAs(saveTo2); 135c37bcbf4SLi Feng Wang close(); 136c37bcbf4SLi Feng Wang open(saveTo2); 137c37bcbf4SLi Feng Wang impress.waitForExistence(10, 2); 138c37bcbf4SLi Feng Wang 139c37bcbf4SLi Feng Wang app.dispatch(".uno:HeaderAndFooter"); 140c37bcbf4SLi Feng Wang assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 141c37bcbf4SLi Feng Wang } 142c37bcbf4SLi Feng Wang } 143