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; 3580a6f5c5SLiu Zhe import org.junit.Test; 3680a6f5c5SLiu Zhe import org.openoffice.test.common.FileUtil; 3780a6f5c5SLiu Zhe 38*c37bcbf4SLi Feng Wang import testlib.gui.AppTool; 3980a6f5c5SLiu Zhe import testlib.gui.SDTool; 4080a6f5c5SLiu Zhe 4180a6f5c5SLiu Zhe public class HeaderAndFooterSetting { 4280a6f5c5SLiu Zhe 4380a6f5c5SLiu Zhe @Before 4480a6f5c5SLiu Zhe public void setUp() throws Exception { 45*c37bcbf4SLi Feng Wang app.start(true); 46*c37bcbf4SLi Feng Wang AppTool.newPresentation(); 4780a6f5c5SLiu Zhe for (int i = 0; i < 5; i++) { 4880a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 4980a6f5c5SLiu Zhe } 5080a6f5c5SLiu Zhe // Pop up navigator panel 5180a6f5c5SLiu Zhe if (!sdNavigatorDlg.exists()) { 5280a6f5c5SLiu Zhe app.dispatch(".uno:Navigator"); 5380a6f5c5SLiu Zhe } 5480a6f5c5SLiu Zhe } 5580a6f5c5SLiu Zhe 5680a6f5c5SLiu Zhe @After 5780a6f5c5SLiu 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(); 6380a6f5c5SLiu Zhe } 6480a6f5c5SLiu Zhe 6580a6f5c5SLiu Zhe /** 6680a6f5c5SLiu Zhe * Test Copy slide with Apply Footer to same file and different file 6780a6f5c5SLiu Zhe * 6880a6f5c5SLiu Zhe * @throws Exception 6980a6f5c5SLiu Zhe */ 7080a6f5c5SLiu Zhe @Test 7180a6f5c5SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 7280a6f5c5SLiu Zhe 7380a6f5c5SLiu Zhe // add header and footer 7480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 7580a6f5c5SLiu Zhe 7680a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 7780a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 7880a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 7980a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 8080a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 8180a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 8280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 8380a6f5c5SLiu Zhe 8480a6f5c5SLiu Zhe // Click slide 3 8580a6f5c5SLiu Zhe impressSlideSorter.focus(); 8680a6f5c5SLiu Zhe typeKeys("<up><up><up>"); 8780a6f5c5SLiu Zhe sleep(1); 8880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 8980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 9080a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 9180a6f5c5SLiu Zhe 9280a6f5c5SLiu Zhe // paste to the same file 9380a6f5c5SLiu Zhe impressSlideSorter.focus(); 9480a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 9580a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 9680a6f5c5SLiu Zhe 9780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 9880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 9980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 10080a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 10180a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 10280a6f5c5SLiu Zhe 10380a6f5c5SLiu Zhe // paste to different file 10480a6f5c5SLiu Zhe impress.focus(); 10580a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 10680a6f5c5SLiu Zhe presentationWizard.ok(); 10780a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 10880a6f5c5SLiu Zhe impressSlideSorter.focus(); 10980a6f5c5SLiu Zhe typeKeys("<down>"); 11080a6f5c5SLiu Zhe sleep(1); 11180a6f5c5SLiu Zhe 11280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 11380a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 11480a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 11580a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 116bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 117bcbf76e8SLi Feng Wang 11880a6f5c5SLiu Zhe } 11980a6f5c5SLiu Zhe 12080a6f5c5SLiu Zhe /** 12180a6f5c5SLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12280a6f5c5SLiu Zhe * 12380a6f5c5SLiu Zhe * @throws Exception 12480a6f5c5SLiu Zhe */ 12580a6f5c5SLiu Zhe @Test 12680a6f5c5SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 12780a6f5c5SLiu Zhe 12880a6f5c5SLiu Zhe // add header and footer 12980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13080a6f5c5SLiu Zhe 13180a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 13280a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 13380a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 13480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 13580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 13680a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 13780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 13880a6f5c5SLiu Zhe 13980a6f5c5SLiu Zhe impressSlideSorter.focus(); 14080a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 14180a6f5c5SLiu Zhe typeKeys("<up>"); 14280a6f5c5SLiu Zhe } 14380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 14480a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 14580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 14680a6f5c5SLiu Zhe 14780a6f5c5SLiu Zhe // paste to the same file 14880a6f5c5SLiu Zhe impressSlideSorter.focus(); 14980a6f5c5SLiu Zhe typeKeys("<up>"); 15080a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 15180a6f5c5SLiu Zhe typeKeys("<down>"); 15280a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 15380a6f5c5SLiu Zhe 15480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 15580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 15680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 15780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 15880a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 15980a6f5c5SLiu Zhe 16080a6f5c5SLiu Zhe // paste to different file 16180a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 16280a6f5c5SLiu Zhe presentationWizard.ok(); 16380a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 16480a6f5c5SLiu Zhe impressSlideSorter.focus(); 16580a6f5c5SLiu Zhe typeKeys("<down>"); 16680a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 16780a6f5c5SLiu Zhe 16880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 16980a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 17080a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 17180a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 172bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 17380a6f5c5SLiu Zhe } 17480a6f5c5SLiu Zhe 17580a6f5c5SLiu Zhe /** 17680a6f5c5SLiu Zhe * Test Copy slide with Notes Footer to same file and different file 17780a6f5c5SLiu Zhe * 17880a6f5c5SLiu Zhe * @throws Exception 17980a6f5c5SLiu Zhe */ 18080a6f5c5SLiu Zhe @Test 18180a6f5c5SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 18280a6f5c5SLiu Zhe 18380a6f5c5SLiu Zhe // add header and footer 18480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 18580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 18680a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 18780a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 18880a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 18980a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 19080a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 19180a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 19280a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 19380a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 19480a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 19580a6f5c5SLiu Zhe 19680a6f5c5SLiu Zhe // paste to the same file 19780a6f5c5SLiu Zhe impressSlideSorter.focus(); 19880a6f5c5SLiu Zhe typeKeys("<up>"); 19980a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 20080a6f5c5SLiu Zhe typeKeys("<down>"); 20180a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 20280a6f5c5SLiu Zhe 20380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 20480a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 20580a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 20680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 20780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 20880a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 20980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21080a6f5c5SLiu Zhe 21180a6f5c5SLiu Zhe // paste to different file 21280a6f5c5SLiu Zhe impress.focus(); 21380a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 21480a6f5c5SLiu Zhe presentationWizard.ok(); 21580a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 21680a6f5c5SLiu Zhe impressSlideSorter.focus(); 21780a6f5c5SLiu Zhe typeKeys("<down>"); 21880a6f5c5SLiu Zhe SDTool.getActiveView().activate(); 21980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 22080a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 22180a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 22280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 22380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 22480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 225bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 22680a6f5c5SLiu Zhe } 22780a6f5c5SLiu Zhe 22880a6f5c5SLiu Zhe /** 22980a6f5c5SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23080a6f5c5SLiu Zhe * 23180a6f5c5SLiu Zhe * @throws Exception 23280a6f5c5SLiu Zhe */ 23380a6f5c5SLiu Zhe @Test 23480a6f5c5SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 23580a6f5c5SLiu Zhe 23680a6f5c5SLiu Zhe // add header and footer 23780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 23880a6f5c5SLiu Zhe 23980a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 24080a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 24180a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 24280a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 24380a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 24480a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 24580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 24680a6f5c5SLiu Zhe 24780a6f5c5SLiu Zhe impressSlideSorter.focus(); 24880a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 24980a6f5c5SLiu Zhe typeKeys("<up>"); 25080a6f5c5SLiu Zhe } 25180a6f5c5SLiu Zhe app.dispatch(".uno:DuplicatePage"); 25280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 25380a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 25480a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 25580a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 256bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 25780a6f5c5SLiu Zhe } 25880a6f5c5SLiu Zhe 25980a6f5c5SLiu Zhe /** 26080a6f5c5SLiu Zhe * Test footer not show on the first slide. 26180a6f5c5SLiu Zhe * 26280a6f5c5SLiu Zhe * @throws Exception 26380a6f5c5SLiu Zhe */ 26480a6f5c5SLiu Zhe @Test 26580a6f5c5SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 26680a6f5c5SLiu Zhe 26780a6f5c5SLiu Zhe // add header and footer 26880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 26980a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 27080a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 27180a6f5c5SLiu Zhe sdFooterNotShowOn1stSlide.check(); 27280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27380a6f5c5SLiu Zhe 27480a6f5c5SLiu Zhe // Check slide 1 27580a6f5c5SLiu Zhe impressSlideSorter.focus(); 27680a6f5c5SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 27780a6f5c5SLiu Zhe // sleep(1); // If no sleep, error occur 27880a6f5c5SLiu Zhe for (int i = 0; i < 5; i++) { 27980a6f5c5SLiu Zhe typeKeys("<up>"); 28080a6f5c5SLiu Zhe sleep(1); 28180a6f5c5SLiu Zhe } 28280a6f5c5SLiu Zhe 28380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 28480a6f5c5SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 28580a6f5c5SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 286bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 28780a6f5c5SLiu Zhe } 28880a6f5c5SLiu Zhe 28980a6f5c5SLiu Zhe /** 29080a6f5c5SLiu Zhe * Test Insert Footer to focus slide. 29180a6f5c5SLiu Zhe * 29280a6f5c5SLiu Zhe * @throws Exception 29380a6f5c5SLiu Zhe */ 29480a6f5c5SLiu Zhe @Test 29580a6f5c5SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 29680a6f5c5SLiu Zhe 29780a6f5c5SLiu Zhe // add header and footer to focus slide. 29880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 29980a6f5c5SLiu Zhe 30080a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 30180a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 30280a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 30380a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 30480a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 30580a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 30680a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 30780a6f5c5SLiu Zhe 30880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30980a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 31080a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 31180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 31280a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 31380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 31480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 31580a6f5c5SLiu Zhe // close header and footer dialog. 31680a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 31780a6f5c5SLiu Zhe typeKeys("<tab>"); 31880a6f5c5SLiu Zhe typeKeys("<enter>"); 31980a6f5c5SLiu Zhe // end close 32080a6f5c5SLiu Zhe 32180a6f5c5SLiu Zhe impressSlideSorter.focus(); 32280a6f5c5SLiu Zhe typeKeys("<up>"); 32380a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 32480a6f5c5SLiu Zhe 32580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 32680a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 32780a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 32880a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 32980a6f5c5SLiu Zhe // close header and footer dialog. 33080a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33180a6f5c5SLiu Zhe typeKeys("<tab>"); 33280a6f5c5SLiu Zhe typeKeys("<enter>"); 33380a6f5c5SLiu Zhe // end close 33480a6f5c5SLiu Zhe 33580a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 33680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 33780a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 33880a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 33980a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 340bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 34180a6f5c5SLiu Zhe } 34280a6f5c5SLiu Zhe 34380a6f5c5SLiu Zhe /** 34480a6f5c5SLiu Zhe * Test Insert Footer to Notes View 34580a6f5c5SLiu Zhe * 34680a6f5c5SLiu Zhe * @throws Exception 34780a6f5c5SLiu Zhe */ 34880a6f5c5SLiu Zhe @Test 34980a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35080a6f5c5SLiu Zhe 35180a6f5c5SLiu Zhe // add header and footer to focus slide. 35280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 35380a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 35480a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 35580a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 35680a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 35780a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 35880a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 35980a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 36080a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 36180a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 36280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 36380a6f5c5SLiu Zhe 36480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 36580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 36680a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 36780a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 36880a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 36980a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 37080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 37180a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 37280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 37380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37480a6f5c5SLiu Zhe // close header and footer dialog. 37580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 37680a6f5c5SLiu Zhe typeKeys("<tab>"); 37780a6f5c5SLiu Zhe typeKeys("<enter>"); 37880a6f5c5SLiu Zhe // end close 37980a6f5c5SLiu Zhe 38080a6f5c5SLiu Zhe impressSlideSorter.focus(); 38180a6f5c5SLiu Zhe typeKeys("<up>"); 38280a6f5c5SLiu Zhe 38380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 38480a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 38580a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 38680a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 38780a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 38880a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 38980a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 39080a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 39180a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 39280a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39380a6f5c5SLiu Zhe // close header and footer dialog. 39480a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 39580a6f5c5SLiu Zhe typeKeys("<tab>"); 39680a6f5c5SLiu Zhe typeKeys("<enter>"); 39780a6f5c5SLiu Zhe // end close 39880a6f5c5SLiu Zhe 39980a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 40080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 40180a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 40280a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 40380a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 40480a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 40580a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 40680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 40780a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 40880a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 40980a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 410bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 41180a6f5c5SLiu Zhe } 41280a6f5c5SLiu Zhe 41380a6f5c5SLiu Zhe /** 41480a6f5c5SLiu Zhe * Test Insert Footer to Slide, use Apply to All 41580a6f5c5SLiu Zhe * 41680a6f5c5SLiu Zhe * @throws Exception 41780a6f5c5SLiu Zhe */ 41880a6f5c5SLiu Zhe @Test 41980a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 42080a6f5c5SLiu Zhe 42180a6f5c5SLiu Zhe // add header and footer to focus slide. 42280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 42380a6f5c5SLiu Zhe 42480a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 42580a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 42680a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 42780a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 42880a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 42980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 43080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 43180a6f5c5SLiu Zhe 43280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 43380a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 43480a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 43580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 43680a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 43780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 43880a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 43980a6f5c5SLiu Zhe // close header and footer dialog. 44080a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 44180a6f5c5SLiu Zhe typeKeys("<tab>"); 44280a6f5c5SLiu Zhe typeKeys("<enter>"); 44380a6f5c5SLiu Zhe // end close 44480a6f5c5SLiu Zhe 44580a6f5c5SLiu Zhe impressSlideSorter.focus(); 44680a6f5c5SLiu Zhe typeKeys("<up>"); 44780a6f5c5SLiu Zhe 44880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 44980a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 45080a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 45180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 45280a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 45380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 45480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 45580a6f5c5SLiu Zhe // close header and footer dialog. 45680a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 45780a6f5c5SLiu Zhe typeKeys("<tab>"); 45880a6f5c5SLiu Zhe typeKeys("<enter>"); 45980a6f5c5SLiu Zhe // end close 46080a6f5c5SLiu Zhe 46180a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 46280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 46380a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 46480a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 46580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 46680a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 46780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 46880a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 469bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 47080a6f5c5SLiu Zhe } 47180a6f5c5SLiu Zhe 47280a6f5c5SLiu Zhe /** 47380a6f5c5SLiu Zhe * Test Insert update automatically time footer to slides. 47480a6f5c5SLiu Zhe * 47580a6f5c5SLiu Zhe * @throws Exception 47680a6f5c5SLiu Zhe */ 47780a6f5c5SLiu Zhe @Test 47880a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 47980a6f5c5SLiu Zhe 48080a6f5c5SLiu Zhe // add header and footer 48180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 48280a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 48380a6f5c5SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 48480a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 48580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 486*c37bcbf4SLi Feng Wang sleep(1); 48780a6f5c5SLiu Zhe 48880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 48980a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 49080a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 491bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 49280a6f5c5SLiu Zhe } 49380a6f5c5SLiu Zhe 49480a6f5c5SLiu Zhe /** 49580a6f5c5SLiu Zhe * Test Insert update automatically time footer to Notes view. 49680a6f5c5SLiu Zhe * 49780a6f5c5SLiu Zhe * @throws Exception 49880a6f5c5SLiu Zhe */ 49980a6f5c5SLiu Zhe @Test 50080a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 50180a6f5c5SLiu Zhe 50280a6f5c5SLiu Zhe // add header and footer 50380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 50480a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 50580a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 50680a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 50780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 508*c37bcbf4SLi Feng Wang sleep(1); 50980a6f5c5SLiu Zhe 51080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 51180a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 51280a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51380a6f5c5SLiu Zhe 51480a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 515bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 51680a6f5c5SLiu Zhe } 51780a6f5c5SLiu Zhe 51880a6f5c5SLiu Zhe /** 51980a6f5c5SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 52080a6f5c5SLiu Zhe * 52180a6f5c5SLiu Zhe * @throws Exception 52280a6f5c5SLiu Zhe */ 52380a6f5c5SLiu Zhe @Test 52480a6f5c5SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 52580a6f5c5SLiu Zhe 52680a6f5c5SLiu Zhe // add header and footer 52780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 52880a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 52980a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 53080a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 53180a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 53280a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 53380a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 53480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 53580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 53680a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 53780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 53880a6f5c5SLiu Zhe 53980a6f5c5SLiu Zhe impressSlideSorter.focus(); 54080a6f5c5SLiu Zhe typeKeys("<up>"); 54180a6f5c5SLiu Zhe 54280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 54380a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 54480a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 54580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 54680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 54780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 54880a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 54980a6f5c5SLiu Zhe 550*c37bcbf4SLi Feng Wang // save and reopen this file 55180a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55280a6f5c5SLiu 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); 55780a6f5c5SLiu Zhe 55880a6f5c5SLiu Zhe // check after reopen 55980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 56080a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 56180a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 56280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 56380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 56480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 565bcbf76e8SLi Feng Wang sdHeaderAndFooterOnNotesTabPage.cancel(); 56680a6f5c5SLiu Zhe } 56780a6f5c5SLiu Zhe 56880a6f5c5SLiu Zhe /** 56980a6f5c5SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57080a6f5c5SLiu Zhe * 57180a6f5c5SLiu Zhe * @throws Exception 57280a6f5c5SLiu Zhe */ 57380a6f5c5SLiu Zhe @Test 57480a6f5c5SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 57580a6f5c5SLiu Zhe 57680a6f5c5SLiu Zhe // add header and footer 57780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 57880a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 57980a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 58080a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 58180a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 58280a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 58380a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 58480a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 58580a6f5c5SLiu Zhe 58680a6f5c5SLiu Zhe impressSlideSorter.focus(); 58780a6f5c5SLiu Zhe typeKeys("<up>"); 58880a6f5c5SLiu Zhe 58980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 59080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 59180a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 59280a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59380a6f5c5SLiu Zhe 59480a6f5c5SLiu Zhe // close header and footer dialog. 59580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 59680a6f5c5SLiu Zhe typeKeys("<tab>"); 59780a6f5c5SLiu Zhe typeKeys("<enter>"); 59880a6f5c5SLiu Zhe 59980a6f5c5SLiu Zhe // save this file 60080a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60180a6f5c5SLiu 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); 60680a6f5c5SLiu Zhe 60780a6f5c5SLiu Zhe // check after reopen 60880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 60980a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 61080a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 61180a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 612bcbf76e8SLi Feng Wang sdHeaderAndFooterDlgSlideTab.cancel(); 61380a6f5c5SLiu Zhe } 61480a6f5c5SLiu Zhe } 615