180a6f5c5SLiu Zhe /************************************************************** 280a6f5c5SLiu Zhe * 380a6f5c5SLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 480a6f5c5SLiu Zhe * or more contributor license agreements. See the NOTICE file 580a6f5c5SLiu Zhe * distributed with this work for additional information 680a6f5c5SLiu Zhe * regarding copyright ownership. The ASF licenses this file 780a6f5c5SLiu Zhe * to you under the Apache License, Version 2.0 (the 880a6f5c5SLiu Zhe * "License"); you may not use this file except in compliance 980a6f5c5SLiu Zhe * with the License. You may obtain a copy of the License at 1080a6f5c5SLiu Zhe * 1180a6f5c5SLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 1280a6f5c5SLiu Zhe * 1380a6f5c5SLiu Zhe * Unless required by applicable law or agreed to in writing, 1480a6f5c5SLiu Zhe * software distributed under the License is distributed on an 1580a6f5c5SLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1680a6f5c5SLiu Zhe * KIND, either express or implied. See the License for the 1780a6f5c5SLiu Zhe * specific language governing permissions and limitations 1880a6f5c5SLiu Zhe * under the License. 1980a6f5c5SLiu Zhe * 2080a6f5c5SLiu Zhe *************************************************************/ 2180a6f5c5SLiu Zhe 2280a6f5c5SLiu Zhe /** 2380a6f5c5SLiu Zhe * 2480a6f5c5SLiu Zhe */ 2580a6f5c5SLiu Zhe package fvt.gui.sd.headerandfooter; 2680a6f5c5SLiu Zhe 2780a6f5c5SLiu Zhe import static org.junit.Assert.*; 2880a6f5c5SLiu Zhe import static org.openoffice.test.common.Testspace.*; 2980a6f5c5SLiu Zhe import static org.openoffice.test.vcl.Tester.*; 3080a6f5c5SLiu Zhe import static testlib.gui.AppTool.*; 3180a6f5c5SLiu Zhe import static testlib.gui.UIMap.*; 3280a6f5c5SLiu Zhe 3380a6f5c5SLiu Zhe import org.junit.After; 3480a6f5c5SLiu Zhe import org.junit.Before; 35*fd348426SLi Feng Wang import org.junit.Rule; 3680a6f5c5SLiu Zhe import org.junit.Test; 3780a6f5c5SLiu Zhe import org.openoffice.test.common.FileUtil; 38*fd348426SLi Feng Wang import org.openoffice.test.common.Logger; 3980a6f5c5SLiu Zhe 40c37bcbf4SLi Feng Wang import testlib.gui.AppTool; 4180a6f5c5SLiu Zhe import testlib.gui.SDTool; 4280a6f5c5SLiu Zhe 4380a6f5c5SLiu Zhe public class HeaderAndFooterSetting { 4480a6f5c5SLiu Zhe 45*fd348426SLi Feng Wang @Rule 46*fd348426SLi Feng Wang public Logger log = Logger.getLogger(this); 47*fd348426SLi Feng Wang 4880a6f5c5SLiu Zhe @Before setUp()4980a6f5c5SLiu Zhe public void setUp() throws Exception { 50c37bcbf4SLi Feng Wang app.start(true); 51c37bcbf4SLi Feng Wang AppTool.newPresentation(); 5280a6f5c5SLiu Zhe for (int i = 0; i < 5; i++) { 5380a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 5480a6f5c5SLiu Zhe } 5580a6f5c5SLiu Zhe // Pop up navigator panel 5680a6f5c5SLiu Zhe if (!sdNavigatorDlg.exists()) { 5780a6f5c5SLiu Zhe app.dispatch(".uno:Navigator"); 5880a6f5c5SLiu Zhe } 5980a6f5c5SLiu Zhe } 6080a6f5c5SLiu Zhe 6180a6f5c5SLiu Zhe @After tearDown()6280a6f5c5SLiu 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(); 6880a6f5c5SLiu Zhe } 6980a6f5c5SLiu Zhe 7080a6f5c5SLiu Zhe /** 7180a6f5c5SLiu Zhe * Test Copy slide with Apply Footer to same file and different file 7280a6f5c5SLiu Zhe * 7380a6f5c5SLiu Zhe * @throws Exception 7480a6f5c5SLiu Zhe */ 7580a6f5c5SLiu Zhe @Test testCopySlideWithApplyFooter()7680a6f5c5SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 7780a6f5c5SLiu Zhe 7880a6f5c5SLiu Zhe // add header and footer 7980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 8080a6f5c5SLiu Zhe 8180a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 8280a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 8380a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 8480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 8580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 8680a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 8780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 8880a6f5c5SLiu Zhe 8980a6f5c5SLiu Zhe // Click slide 3 9080a6f5c5SLiu Zhe impressSlideSorter.focus(); 9180a6f5c5SLiu Zhe typeKeys("<up><up><up>"); 9280a6f5c5SLiu Zhe sleep(1); 9380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 9480a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 9580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 9680a6f5c5SLiu Zhe 9780a6f5c5SLiu Zhe // paste to the same file 9880a6f5c5SLiu Zhe impressSlideSorter.focus(); 9980a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 10080a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 10180a6f5c5SLiu Zhe 10280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 10380a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 10480a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 10580a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 10680a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 10780a6f5c5SLiu Zhe 10880a6f5c5SLiu Zhe // paste to different file 10980a6f5c5SLiu Zhe impress.focus(); 11080a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 11180a6f5c5SLiu Zhe presentationWizard.ok(); 11280a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 11380a6f5c5SLiu Zhe impressSlideSorter.focus(); 11480a6f5c5SLiu Zhe typeKeys("<down>"); 11580a6f5c5SLiu Zhe sleep(1); 11680a6f5c5SLiu Zhe 11780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 11880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 11980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 12080a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 121bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 122bcbf76e8SLi Feng Wang 12380a6f5c5SLiu Zhe } 12480a6f5c5SLiu Zhe 12580a6f5c5SLiu Zhe /** 12680a6f5c5SLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12780a6f5c5SLiu Zhe * 12880a6f5c5SLiu Zhe * @throws Exception 12980a6f5c5SLiu Zhe */ 13080a6f5c5SLiu Zhe @Test testCopySlideWithApplyToAllFooter()13180a6f5c5SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13280a6f5c5SLiu Zhe 13380a6f5c5SLiu Zhe // add header and footer 13480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13580a6f5c5SLiu Zhe 13680a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 13780a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 13880a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 13980a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 14080a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 14180a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 14280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14380a6f5c5SLiu Zhe 14480a6f5c5SLiu Zhe impressSlideSorter.focus(); 14580a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 14680a6f5c5SLiu Zhe typeKeys("<up>"); 14780a6f5c5SLiu Zhe } 14880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 14980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 15080a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 15180a6f5c5SLiu Zhe 15280a6f5c5SLiu Zhe // paste to the same file 15380a6f5c5SLiu Zhe impressSlideSorter.focus(); 15480a6f5c5SLiu Zhe typeKeys("<up>"); 15580a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 15680a6f5c5SLiu Zhe typeKeys("<down>"); 15780a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 15880a6f5c5SLiu Zhe 15980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 16080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 16180a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 16280a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 16380a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16480a6f5c5SLiu Zhe 16580a6f5c5SLiu Zhe // paste to different file 16680a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 16780a6f5c5SLiu Zhe presentationWizard.ok(); 16880a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 16980a6f5c5SLiu Zhe impressSlideSorter.focus(); 17080a6f5c5SLiu Zhe typeKeys("<down>"); 17180a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 17280a6f5c5SLiu Zhe 17380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 17480a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 17580a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 17680a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 177bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 17880a6f5c5SLiu Zhe } 17980a6f5c5SLiu Zhe 18080a6f5c5SLiu Zhe /** 18180a6f5c5SLiu Zhe * Test Copy slide with Notes Footer to same file and different file 18280a6f5c5SLiu Zhe * 18380a6f5c5SLiu Zhe * @throws Exception 18480a6f5c5SLiu Zhe */ 18580a6f5c5SLiu Zhe @Test testCopySlideWithNotesHeaderFooter()18680a6f5c5SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 18780a6f5c5SLiu Zhe 18880a6f5c5SLiu Zhe // add header and footer 18980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 19080a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 19180a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 19280a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 19380a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 19480a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 19580a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 19680a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 19780a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 19880a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 19980a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 20080a6f5c5SLiu Zhe 20180a6f5c5SLiu Zhe // paste to the same file 20280a6f5c5SLiu Zhe impressSlideSorter.focus(); 20380a6f5c5SLiu Zhe typeKeys("<up>"); 20480a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 20580a6f5c5SLiu Zhe typeKeys("<down>"); 20680a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 20780a6f5c5SLiu Zhe 20880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 20980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 21080a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 21180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 21280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 21380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 21480a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21580a6f5c5SLiu Zhe 21680a6f5c5SLiu Zhe // paste to different file 21780a6f5c5SLiu Zhe impress.focus(); 21880a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 21980a6f5c5SLiu Zhe presentationWizard.ok(); 22080a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 22180a6f5c5SLiu Zhe impressSlideSorter.focus(); 22280a6f5c5SLiu Zhe typeKeys("<down>"); 22380a6f5c5SLiu Zhe SDTool.getActiveView().activate(); 22480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 22580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 22680a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 22780a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 22880a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 22980a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 230bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 23180a6f5c5SLiu Zhe } 23280a6f5c5SLiu Zhe 23380a6f5c5SLiu Zhe /** 23480a6f5c5SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23580a6f5c5SLiu Zhe * 23680a6f5c5SLiu Zhe * @throws Exception 23780a6f5c5SLiu Zhe */ 23880a6f5c5SLiu Zhe @Test testDuplicateSlideWithApplyToAllFooter()23980a6f5c5SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 24080a6f5c5SLiu Zhe 24180a6f5c5SLiu Zhe // add header and footer 24280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 24380a6f5c5SLiu Zhe 24480a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 24580a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 24680a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 24780a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 24880a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 24980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 25080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 25180a6f5c5SLiu Zhe 25280a6f5c5SLiu Zhe impressSlideSorter.focus(); 25380a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 25480a6f5c5SLiu Zhe typeKeys("<up>"); 25580a6f5c5SLiu Zhe } 25680a6f5c5SLiu Zhe app.dispatch(".uno:DuplicatePage"); 25780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 25880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 25980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 26080a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 261bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 26280a6f5c5SLiu Zhe } 26380a6f5c5SLiu Zhe 26480a6f5c5SLiu Zhe /** 26580a6f5c5SLiu Zhe * Test footer not show on the first slide. 26680a6f5c5SLiu Zhe * 26780a6f5c5SLiu Zhe * @throws Exception 26880a6f5c5SLiu Zhe */ 26980a6f5c5SLiu Zhe @Test testFooterNotShowOn1stSlide()27080a6f5c5SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 27180a6f5c5SLiu Zhe 27280a6f5c5SLiu Zhe // add header and footer 27380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 27480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 27580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 27680a6f5c5SLiu Zhe sdFooterNotShowOn1stSlide.check(); 27780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27880a6f5c5SLiu Zhe 27980a6f5c5SLiu Zhe // Check slide 1 28080a6f5c5SLiu Zhe impressSlideSorter.focus(); 28180a6f5c5SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 28280a6f5c5SLiu Zhe // sleep(1); // If no sleep, error occur 28380a6f5c5SLiu Zhe for (int i = 0; i < 5; i++) { 28480a6f5c5SLiu Zhe typeKeys("<up>"); 28580a6f5c5SLiu Zhe sleep(1); 28680a6f5c5SLiu Zhe } 28780a6f5c5SLiu Zhe 28880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 28980a6f5c5SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 29080a6f5c5SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 291bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 29280a6f5c5SLiu Zhe } 29380a6f5c5SLiu Zhe 29480a6f5c5SLiu Zhe /** 29580a6f5c5SLiu Zhe * Test Insert Footer to focus slide. 29680a6f5c5SLiu Zhe * 29780a6f5c5SLiu Zhe * @throws Exception 29880a6f5c5SLiu Zhe */ 29980a6f5c5SLiu Zhe @Test testInsertApplyFooterOnSlide()30080a6f5c5SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 30180a6f5c5SLiu Zhe 30280a6f5c5SLiu Zhe // add header and footer to focus slide. 30380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30480a6f5c5SLiu Zhe 30580a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 30680a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 30780a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 30880a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 30980a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 31080a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 31180a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 31280a6f5c5SLiu Zhe 31380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 31480a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 31580a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 31680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 31780a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 31880a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 31980a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 32080a6f5c5SLiu Zhe // close header and footer dialog. 32180a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 32280a6f5c5SLiu Zhe typeKeys("<tab>"); 32380a6f5c5SLiu Zhe typeKeys("<enter>"); 32480a6f5c5SLiu Zhe // end close 32580a6f5c5SLiu Zhe 32680a6f5c5SLiu Zhe impressSlideSorter.focus(); 32780a6f5c5SLiu Zhe typeKeys("<up>"); 32880a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 32980a6f5c5SLiu Zhe 33080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 33180a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 33280a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 33380a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33480a6f5c5SLiu Zhe // close header and footer dialog. 33580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33680a6f5c5SLiu Zhe typeKeys("<tab>"); 33780a6f5c5SLiu Zhe typeKeys("<enter>"); 33880a6f5c5SLiu Zhe // end close 33980a6f5c5SLiu Zhe 34080a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 34180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 34280a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 34380a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 34480a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 345bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 34680a6f5c5SLiu Zhe } 34780a6f5c5SLiu Zhe 34880a6f5c5SLiu Zhe /** 34980a6f5c5SLiu Zhe * Test Insert Footer to Notes View 35080a6f5c5SLiu Zhe * 35180a6f5c5SLiu Zhe * @throws Exception 35280a6f5c5SLiu Zhe */ 35380a6f5c5SLiu Zhe @Test testInsertApplyToAllFooterOnNotes()35480a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35580a6f5c5SLiu Zhe 35680a6f5c5SLiu Zhe // add header and footer to focus slide. 35780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 35880a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 35980a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 36080a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 36180a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 36280a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 36380a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 36480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 36580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 36680a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 36780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 36880a6f5c5SLiu Zhe 36980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 37080a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 37180a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 37280a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 37380a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 37480a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 37580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 37680a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 37780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 37880a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37980a6f5c5SLiu Zhe // close header and footer dialog. 38080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 38180a6f5c5SLiu Zhe typeKeys("<tab>"); 38280a6f5c5SLiu Zhe typeKeys("<enter>"); 38380a6f5c5SLiu Zhe // end close 38480a6f5c5SLiu Zhe 38580a6f5c5SLiu Zhe impressSlideSorter.focus(); 38680a6f5c5SLiu Zhe typeKeys("<up>"); 38780a6f5c5SLiu Zhe 38880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 38980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 39080a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 39180a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 39280a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 39380a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 39480a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 39580a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 39680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 39780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39880a6f5c5SLiu Zhe // close header and footer dialog. 39980a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 40080a6f5c5SLiu Zhe typeKeys("<tab>"); 40180a6f5c5SLiu Zhe typeKeys("<enter>"); 40280a6f5c5SLiu Zhe // end close 40380a6f5c5SLiu Zhe 40480a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 40580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 40680a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 40780a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 40880a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 40980a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 41080a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 41180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 41280a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 41380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 41480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 415bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 41680a6f5c5SLiu Zhe } 41780a6f5c5SLiu Zhe 41880a6f5c5SLiu Zhe /** 41980a6f5c5SLiu Zhe * Test Insert Footer to Slide, use Apply to All 42080a6f5c5SLiu Zhe * 42180a6f5c5SLiu Zhe * @throws Exception 42280a6f5c5SLiu Zhe */ 42380a6f5c5SLiu Zhe @Test testInsertApplyToAllFooterOnSlide()42480a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 42580a6f5c5SLiu Zhe 42680a6f5c5SLiu Zhe // add header and footer to focus slide. 42780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 42880a6f5c5SLiu Zhe 42980a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 43080a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 43180a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 43280a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 43380a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 43480a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 43580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 43680a6f5c5SLiu Zhe 43780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 43880a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 43980a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 44080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 44180a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 44280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 44380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 44480a6f5c5SLiu Zhe // close header and footer dialog. 44580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 44680a6f5c5SLiu Zhe typeKeys("<tab>"); 44780a6f5c5SLiu Zhe typeKeys("<enter>"); 44880a6f5c5SLiu Zhe // end close 44980a6f5c5SLiu Zhe 45080a6f5c5SLiu Zhe impressSlideSorter.focus(); 45180a6f5c5SLiu Zhe typeKeys("<up>"); 45280a6f5c5SLiu Zhe 45380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 45480a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 45580a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 45680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 45780a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 45880a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 45980a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 46080a6f5c5SLiu Zhe // close header and footer dialog. 46180a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 46280a6f5c5SLiu Zhe typeKeys("<tab>"); 46380a6f5c5SLiu Zhe typeKeys("<enter>"); 46480a6f5c5SLiu Zhe // end close 46580a6f5c5SLiu Zhe 46680a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 46780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 46880a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 46980a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 47080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 47180a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 47280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 47380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 474bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 47580a6f5c5SLiu Zhe } 47680a6f5c5SLiu Zhe 47780a6f5c5SLiu Zhe /** 47880a6f5c5SLiu Zhe * Test Insert update automatically time footer to slides. 47980a6f5c5SLiu Zhe * 48080a6f5c5SLiu Zhe * @throws Exception 48180a6f5c5SLiu Zhe */ 48280a6f5c5SLiu Zhe @Test testInsertAutoUpdateTimeFooter()48380a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 48480a6f5c5SLiu Zhe 48580a6f5c5SLiu Zhe // add header and footer 48680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 48780a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 48880a6f5c5SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 48980a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 49080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 491c37bcbf4SLi Feng Wang sleep(1); 49280a6f5c5SLiu Zhe 49380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 49480a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 49580a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 496bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 49780a6f5c5SLiu Zhe } 49880a6f5c5SLiu Zhe 49980a6f5c5SLiu Zhe /** 50080a6f5c5SLiu Zhe * Test Insert update automatically time footer to Notes view. 50180a6f5c5SLiu Zhe * 50280a6f5c5SLiu Zhe * @throws Exception 50380a6f5c5SLiu Zhe */ 50480a6f5c5SLiu Zhe @Test testInsertAutoUpdateTimeFooterOnNotes()50580a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 50680a6f5c5SLiu Zhe 50780a6f5c5SLiu Zhe // add header and footer 50880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 50980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 51080a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 51180a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 51280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 513c37bcbf4SLi Feng Wang sleep(1); 51480a6f5c5SLiu Zhe 51580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 51680a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 51780a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51880a6f5c5SLiu Zhe 51980a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 520bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 52180a6f5c5SLiu Zhe } 52280a6f5c5SLiu Zhe 52380a6f5c5SLiu Zhe /** 52480a6f5c5SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 52580a6f5c5SLiu Zhe * 52680a6f5c5SLiu Zhe * @throws Exception 52780a6f5c5SLiu Zhe */ 52880a6f5c5SLiu Zhe @Test testInsertHeaderFooterOnNotes()52980a6f5c5SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 53080a6f5c5SLiu Zhe 53180a6f5c5SLiu Zhe // add header and footer 53280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 53380a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 53480a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 53580a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 53680a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 53780a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 53880a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 53980a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 54080a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 54180a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 54280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 54380a6f5c5SLiu Zhe 54480a6f5c5SLiu Zhe impressSlideSorter.focus(); 54580a6f5c5SLiu Zhe typeKeys("<up>"); 54680a6f5c5SLiu Zhe 54780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 54880a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 54980a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 55080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 55180a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 55280a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 55380a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 55480a6f5c5SLiu Zhe 555c37bcbf4SLi Feng Wang // save and reopen this file 55680a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55780a6f5c5SLiu 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); 56280a6f5c5SLiu Zhe 56380a6f5c5SLiu Zhe // check after reopen 56480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 56580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 56680a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 56780a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 56880a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 56980a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 570bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 57180a6f5c5SLiu Zhe } 57280a6f5c5SLiu Zhe 57380a6f5c5SLiu Zhe /** 57480a6f5c5SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57580a6f5c5SLiu Zhe * 57680a6f5c5SLiu Zhe * @throws Exception 57780a6f5c5SLiu Zhe */ 57880a6f5c5SLiu Zhe @Test testInsertHeaderFooterOnSlide()57980a6f5c5SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 58080a6f5c5SLiu Zhe 58180a6f5c5SLiu Zhe // add header and footer 58280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 58380a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 58480a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 58580a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 58680a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 58780a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 58880a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 58980a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 59080a6f5c5SLiu Zhe 59180a6f5c5SLiu Zhe impressSlideSorter.focus(); 59280a6f5c5SLiu Zhe typeKeys("<up>"); 59380a6f5c5SLiu Zhe 59480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 59580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 59680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 59780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59880a6f5c5SLiu Zhe 59980a6f5c5SLiu Zhe // close header and footer dialog. 60080a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 60180a6f5c5SLiu Zhe typeKeys("<tab>"); 60280a6f5c5SLiu Zhe typeKeys("<enter>"); 60380a6f5c5SLiu Zhe 60480a6f5c5SLiu Zhe // save this file 60580a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60680a6f5c5SLiu 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); 61180a6f5c5SLiu Zhe 61280a6f5c5SLiu Zhe // check after reopen 61380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 61480a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 61580a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 61680a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 617bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 61880a6f5c5SLiu Zhe } 61980a6f5c5SLiu Zhe } 620