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.Rule; 3680a6f5c5SLiu Zhe import org.junit.Test; 3780a6f5c5SLiu Zhe import org.openoffice.test.common.FileUtil; 3880a6f5c5SLiu Zhe import org.openoffice.test.common.Logger; 3980a6f5c5SLiu Zhe 4080a6f5c5SLiu Zhe import testlib.gui.SDTool; 4180a6f5c5SLiu Zhe 4280a6f5c5SLiu Zhe public class HeaderAndFooterSetting { 4380a6f5c5SLiu Zhe 4480a6f5c5SLiu Zhe @Rule 4580a6f5c5SLiu Zhe public Logger log = Logger.getLogger(this); 4680a6f5c5SLiu Zhe 4780a6f5c5SLiu Zhe @Before 4880a6f5c5SLiu Zhe public void setUp() throws Exception { 4980a6f5c5SLiu Zhe app.start(true); // Bug 120476 5080a6f5c5SLiu Zhe 5180a6f5c5SLiu Zhe // New a impress, insert some slides 5280a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 5380a6f5c5SLiu Zhe presentationWizard.ok(); 5480a6f5c5SLiu Zhe impress.waitForExistence(10, 2); 5580a6f5c5SLiu Zhe 5680a6f5c5SLiu Zhe for (int i = 0; i < 5; i++) { 5780a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 5880a6f5c5SLiu Zhe } 5980a6f5c5SLiu Zhe // Pop up navigator panel 6080a6f5c5SLiu Zhe if (!sdNavigatorDlg.exists()) { 6180a6f5c5SLiu Zhe app.dispatch(".uno:Navigator"); 6280a6f5c5SLiu Zhe } 6380a6f5c5SLiu Zhe } 6480a6f5c5SLiu Zhe 6580a6f5c5SLiu Zhe @After 6680a6f5c5SLiu Zhe public void tearDown() throws Exception { 67*4a13b48eSLi 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 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()); 12180a6f5c5SLiu Zhe } 12280a6f5c5SLiu Zhe 12380a6f5c5SLiu Zhe /** 12480a6f5c5SLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12580a6f5c5SLiu Zhe * 12680a6f5c5SLiu Zhe * @throws Exception 12780a6f5c5SLiu Zhe */ 12880a6f5c5SLiu Zhe @Test 12980a6f5c5SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13080a6f5c5SLiu Zhe 13180a6f5c5SLiu Zhe // add header and footer 13280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13380a6f5c5SLiu Zhe 13480a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 13580a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 13680a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 13780a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 13880a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 13980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 14080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14180a6f5c5SLiu Zhe 14280a6f5c5SLiu Zhe impressSlideSorter.focus(); 14380a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 14480a6f5c5SLiu Zhe typeKeys("<up>"); 14580a6f5c5SLiu Zhe } 14680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 14780a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 14880a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 14980a6f5c5SLiu Zhe 15080a6f5c5SLiu Zhe // paste to the same file 15180a6f5c5SLiu Zhe impressSlideSorter.focus(); 15280a6f5c5SLiu Zhe typeKeys("<up>"); 15380a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 15480a6f5c5SLiu Zhe typeKeys("<down>"); 15580a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 15680a6f5c5SLiu Zhe 15780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 15880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 15980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 16080a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 16180a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16280a6f5c5SLiu Zhe 16380a6f5c5SLiu Zhe // paste to different file 16480a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 16580a6f5c5SLiu Zhe presentationWizard.ok(); 16680a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 16780a6f5c5SLiu Zhe impressSlideSorter.focus(); 16880a6f5c5SLiu Zhe typeKeys("<down>"); 16980a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 17080a6f5c5SLiu Zhe 17180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 17280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 17380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 17480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 17580a6f5c5SLiu Zhe } 17680a6f5c5SLiu Zhe 17780a6f5c5SLiu Zhe /** 17880a6f5c5SLiu Zhe * Test Copy slide with Notes Footer to same file and different file 17980a6f5c5SLiu Zhe * 18080a6f5c5SLiu Zhe * @throws Exception 18180a6f5c5SLiu Zhe */ 18280a6f5c5SLiu Zhe @Test 18380a6f5c5SLiu Zhe public void testCopySlideWithNotesHeaderFooter() throws Exception { 18480a6f5c5SLiu Zhe 18580a6f5c5SLiu Zhe // add header and footer 18680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 18780a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 18880a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 18980a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 19080a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 19180a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 19280a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 19380a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 19480a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 19580a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 19680a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 19780a6f5c5SLiu Zhe 19880a6f5c5SLiu Zhe // paste to the same file 19980a6f5c5SLiu Zhe impressSlideSorter.focus(); 20080a6f5c5SLiu Zhe typeKeys("<up>"); 20180a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 20280a6f5c5SLiu Zhe typeKeys("<down>"); 20380a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 20480a6f5c5SLiu Zhe 20580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 20680a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 20780a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 20880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 20980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 21080a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 21180a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 21280a6f5c5SLiu Zhe 21380a6f5c5SLiu Zhe // paste to different file 21480a6f5c5SLiu Zhe impress.focus(); 21580a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 21680a6f5c5SLiu Zhe presentationWizard.ok(); 21780a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 21880a6f5c5SLiu Zhe impressSlideSorter.focus(); 21980a6f5c5SLiu Zhe typeKeys("<down>"); 22080a6f5c5SLiu Zhe SDTool.getActiveView().activate(); 22180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 22280a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 22380a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 22480a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 22580a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 22680a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 22780a6f5c5SLiu Zhe } 22880a6f5c5SLiu Zhe 22980a6f5c5SLiu Zhe /** 23080a6f5c5SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23180a6f5c5SLiu Zhe * 23280a6f5c5SLiu Zhe * @throws Exception 23380a6f5c5SLiu Zhe */ 23480a6f5c5SLiu Zhe @Test 23580a6f5c5SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 23680a6f5c5SLiu Zhe 23780a6f5c5SLiu Zhe // add header and footer 23880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 23980a6f5c5SLiu Zhe 24080a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 24180a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 24280a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 24380a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 24480a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 24580a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 24680a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 24780a6f5c5SLiu Zhe 24880a6f5c5SLiu Zhe impressSlideSorter.focus(); 24980a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 25080a6f5c5SLiu Zhe typeKeys("<up>"); 25180a6f5c5SLiu Zhe } 25280a6f5c5SLiu Zhe app.dispatch(".uno:DuplicatePage"); 25380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 25480a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 25580a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 25680a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 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()); 28680a6f5c5SLiu Zhe } 28780a6f5c5SLiu Zhe 28880a6f5c5SLiu Zhe /** 28980a6f5c5SLiu Zhe * Test Insert Footer to focus slide. 29080a6f5c5SLiu Zhe * 29180a6f5c5SLiu Zhe * @throws Exception 29280a6f5c5SLiu Zhe */ 29380a6f5c5SLiu Zhe @Test 29480a6f5c5SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 29580a6f5c5SLiu Zhe 29680a6f5c5SLiu Zhe // add header and footer to focus slide. 29780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 29880a6f5c5SLiu Zhe 29980a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 30080a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 30180a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 30280a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 30380a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 30480a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 30580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 30680a6f5c5SLiu Zhe 30780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30880a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 30980a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 31080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 31180a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 31280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 31380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 31480a6f5c5SLiu Zhe // close header and footer dialog. 31580a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 31680a6f5c5SLiu Zhe typeKeys("<tab>"); 31780a6f5c5SLiu Zhe typeKeys("<enter>"); 31880a6f5c5SLiu Zhe // end close 31980a6f5c5SLiu Zhe 32080a6f5c5SLiu Zhe impressSlideSorter.focus(); 32180a6f5c5SLiu Zhe typeKeys("<up>"); 32280a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 32380a6f5c5SLiu Zhe 32480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 32580a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 32680a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 32780a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 32880a6f5c5SLiu Zhe // close header and footer dialog. 32980a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33080a6f5c5SLiu Zhe typeKeys("<tab>"); 33180a6f5c5SLiu Zhe typeKeys("<enter>"); 33280a6f5c5SLiu Zhe // end close 33380a6f5c5SLiu Zhe 33480a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 33580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 33680a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 33780a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 33880a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33980a6f5c5SLiu Zhe } 34080a6f5c5SLiu Zhe 34180a6f5c5SLiu Zhe /** 34280a6f5c5SLiu Zhe * Test Insert Footer to Notes View 34380a6f5c5SLiu Zhe * 34480a6f5c5SLiu Zhe * @throws Exception 34580a6f5c5SLiu Zhe */ 34680a6f5c5SLiu Zhe @Test 34780a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 34880a6f5c5SLiu Zhe 34980a6f5c5SLiu Zhe // add header and footer to focus slide. 35080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 35180a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 35280a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 35380a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 35480a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 35580a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 35680a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 35780a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 35880a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 35980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 36080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 36180a6f5c5SLiu Zhe 36280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 36380a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 36480a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 36580a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 36680a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 36780a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 36880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 36980a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 37080a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 37180a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37280a6f5c5SLiu Zhe // close header and footer dialog. 37380a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 37480a6f5c5SLiu Zhe typeKeys("<tab>"); 37580a6f5c5SLiu Zhe typeKeys("<enter>"); 37680a6f5c5SLiu Zhe // end close 37780a6f5c5SLiu Zhe 37880a6f5c5SLiu Zhe impressSlideSorter.focus(); 37980a6f5c5SLiu Zhe typeKeys("<up>"); 38080a6f5c5SLiu Zhe 38180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 38280a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 38380a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 38480a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 38580a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 38680a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 38780a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 38880a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 38980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 39080a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39180a6f5c5SLiu Zhe // close header and footer dialog. 39280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 39380a6f5c5SLiu Zhe typeKeys("<tab>"); 39480a6f5c5SLiu Zhe typeKeys("<enter>"); 39580a6f5c5SLiu Zhe // end close 39680a6f5c5SLiu Zhe 39780a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 39880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 39980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 40080a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 40180a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 40280a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 40380a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 40480a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 40580a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 40680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 40780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 40880a6f5c5SLiu Zhe } 40980a6f5c5SLiu Zhe 41080a6f5c5SLiu Zhe /** 41180a6f5c5SLiu Zhe * Test Insert Footer to Slide, use Apply to All 41280a6f5c5SLiu Zhe * 41380a6f5c5SLiu Zhe * @throws Exception 41480a6f5c5SLiu Zhe */ 41580a6f5c5SLiu Zhe @Test 41680a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnSlide() throws Exception { 41780a6f5c5SLiu Zhe 41880a6f5c5SLiu Zhe // add header and footer to focus slide. 41980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 42080a6f5c5SLiu Zhe 42180a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 42280a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 42380a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 42480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 42580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 42680a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 42780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 42880a6f5c5SLiu Zhe 42980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 43080a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 43180a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 43280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 43380a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 43480a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 43580a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 43680a6f5c5SLiu Zhe // close header and footer dialog. 43780a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 43880a6f5c5SLiu Zhe typeKeys("<tab>"); 43980a6f5c5SLiu Zhe typeKeys("<enter>"); 44080a6f5c5SLiu Zhe // end close 44180a6f5c5SLiu Zhe 44280a6f5c5SLiu Zhe impressSlideSorter.focus(); 44380a6f5c5SLiu Zhe typeKeys("<up>"); 44480a6f5c5SLiu Zhe 44580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 44680a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 44780a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 44880a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 44980a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 45080a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 45180a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 45280a6f5c5SLiu Zhe // close header and footer dialog. 45380a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 45480a6f5c5SLiu Zhe typeKeys("<tab>"); 45580a6f5c5SLiu Zhe typeKeys("<enter>"); 45680a6f5c5SLiu Zhe // end close 45780a6f5c5SLiu Zhe 45880a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 45980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 46080a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 46180a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 46280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 46380a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 46480a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 46580a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 46680a6f5c5SLiu Zhe } 46780a6f5c5SLiu Zhe 46880a6f5c5SLiu Zhe /** 46980a6f5c5SLiu Zhe * Test Insert update automatically time footer to slides. 47080a6f5c5SLiu Zhe * 47180a6f5c5SLiu Zhe * @throws Exception 47280a6f5c5SLiu Zhe */ 47380a6f5c5SLiu Zhe @Test 47480a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 47580a6f5c5SLiu Zhe 47680a6f5c5SLiu Zhe // add header and footer 47780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 47880a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 47980a6f5c5SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 48080a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 48180a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 48280a6f5c5SLiu Zhe sleep(1); // Wait some time to check the time update 48380a6f5c5SLiu Zhe 48480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 48580a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 48680a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 48780a6f5c5SLiu Zhe } 48880a6f5c5SLiu Zhe 48980a6f5c5SLiu Zhe /** 49080a6f5c5SLiu Zhe * Test Insert update automatically time footer to Notes view. 49180a6f5c5SLiu Zhe * 49280a6f5c5SLiu Zhe * @throws Exception 49380a6f5c5SLiu Zhe */ 49480a6f5c5SLiu Zhe @Test 49580a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 49680a6f5c5SLiu Zhe 49780a6f5c5SLiu Zhe // add header and footer 49880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 49980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 50080a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 50180a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 50280a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 50380a6f5c5SLiu Zhe sleep(1); // Wait some time to check the time update 50480a6f5c5SLiu Zhe 50580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 50680a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 50780a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 50880a6f5c5SLiu Zhe 50980a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 51080a6f5c5SLiu Zhe } 51180a6f5c5SLiu Zhe 51280a6f5c5SLiu Zhe /** 51380a6f5c5SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 51480a6f5c5SLiu Zhe * 51580a6f5c5SLiu Zhe * @throws Exception 51680a6f5c5SLiu Zhe */ 51780a6f5c5SLiu Zhe @Test 51880a6f5c5SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 51980a6f5c5SLiu Zhe 52080a6f5c5SLiu Zhe // add header and footer 52180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 52280a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 52380a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 52480a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 52580a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 52680a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 52780a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 52880a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 52980a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 53080a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 53180a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 53280a6f5c5SLiu Zhe 53380a6f5c5SLiu Zhe impressSlideSorter.focus(); 53480a6f5c5SLiu Zhe typeKeys("<up>"); 53580a6f5c5SLiu Zhe 53680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 53780a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 53880a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 53980a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 54080a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 54180a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 54280a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 54380a6f5c5SLiu Zhe 54480a6f5c5SLiu Zhe // save this file 54580a6f5c5SLiu Zhe app.dispatch(".uno:SaveAs"); 54680a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 54780a6f5c5SLiu Zhe FileUtil.deleteFile(saveTo); 54880a6f5c5SLiu Zhe submitSaveDlg(saveTo); 549*4a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 550*4a13b48eSLi Feng Wang activeMsgBox.yes(); 551*4a13b48eSLi Feng Wang sleep(2); 552*4a13b48eSLi Feng Wang } 553*4a13b48eSLi Feng Wang sleep(5); 55480a6f5c5SLiu Zhe app.dispatch(".uno:CloseDoc"); 55580a6f5c5SLiu Zhe 55680a6f5c5SLiu Zhe // Reopen this file 55780a6f5c5SLiu Zhe openStartcenter(); 55880a6f5c5SLiu Zhe app.dispatch(".uno:Open"); 55980a6f5c5SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 56080a6f5c5SLiu Zhe submitOpenDlg(openFrom); 561*4a13b48eSLi Feng Wang sleep(5); 56280a6f5c5SLiu Zhe // check after reopen 56380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 56480a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 56580a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 56680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 56780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 56880a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 56980a6f5c5SLiu Zhe } 57080a6f5c5SLiu Zhe 57180a6f5c5SLiu Zhe /** 57280a6f5c5SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57380a6f5c5SLiu Zhe * 57480a6f5c5SLiu Zhe * @throws Exception 57580a6f5c5SLiu Zhe */ 57680a6f5c5SLiu Zhe @Test 57780a6f5c5SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 57880a6f5c5SLiu Zhe 57980a6f5c5SLiu Zhe // add header and footer 58080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 58180a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 58280a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 58380a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 58480a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 58580a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 58680a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 58780a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 58880a6f5c5SLiu Zhe 58980a6f5c5SLiu Zhe impressSlideSorter.focus(); 59080a6f5c5SLiu Zhe typeKeys("<up>"); 59180a6f5c5SLiu Zhe 59280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 59380a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 59480a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 59580a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59680a6f5c5SLiu Zhe 59780a6f5c5SLiu Zhe // close header and footer dialog. 59880a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 59980a6f5c5SLiu Zhe typeKeys("<tab>"); 60080a6f5c5SLiu Zhe typeKeys("<enter>"); 60180a6f5c5SLiu Zhe 60280a6f5c5SLiu Zhe // save this file 60380a6f5c5SLiu Zhe app.dispatch(".uno:SaveAs"); 60480a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60580a6f5c5SLiu Zhe FileUtil.deleteFile(saveTo); 60680a6f5c5SLiu Zhe submitSaveDlg(saveTo); 607*4a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 608*4a13b48eSLi Feng Wang activeMsgBox.yes(); 609*4a13b48eSLi Feng Wang sleep(2); 610*4a13b48eSLi Feng Wang } 611*4a13b48eSLi Feng Wang sleep(5); 61280a6f5c5SLiu Zhe app.dispatch(".uno:CloseDoc"); 61380a6f5c5SLiu Zhe 61480a6f5c5SLiu Zhe // Reopen this file 61580a6f5c5SLiu Zhe openStartcenter(); 61680a6f5c5SLiu Zhe app.dispatch(".uno:Open"); 61780a6f5c5SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 61880a6f5c5SLiu Zhe submitOpenDlg(openFrom); 619*4a13b48eSLi Feng Wang sleep(5); 62080a6f5c5SLiu Zhe // check after reopen 62180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 62280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 62380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 62480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 62580a6f5c5SLiu Zhe } 62680a6f5c5SLiu Zhe } 627