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*1ff8e3a9SLi Feng Wang if (sdNavigatorDlg.exists()) { 68*1ff8e3a9SLi Feng Wang app.dispatch(".uno:Navigator"); 69*1ff8e3a9SLi Feng Wang } 704a13b48eSLi Feng Wang app.stop(); 7180a6f5c5SLiu Zhe } 7280a6f5c5SLiu Zhe 7380a6f5c5SLiu Zhe /** 7480a6f5c5SLiu Zhe * Test Copy slide with Apply Footer to same file and different file 7580a6f5c5SLiu Zhe * 7680a6f5c5SLiu Zhe * @throws Exception 7780a6f5c5SLiu Zhe */ 7880a6f5c5SLiu Zhe @Test 7980a6f5c5SLiu Zhe public void testCopySlideWithApplyFooter() throws Exception { 8080a6f5c5SLiu Zhe 8180a6f5c5SLiu Zhe // add header and footer 8280a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 8380a6f5c5SLiu Zhe 8480a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 8580a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 8680a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 8780a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 8880a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 8980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 9080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 9180a6f5c5SLiu Zhe 9280a6f5c5SLiu Zhe // Click slide 3 9380a6f5c5SLiu Zhe impressSlideSorter.focus(); 9480a6f5c5SLiu Zhe typeKeys("<up><up><up>"); 9580a6f5c5SLiu Zhe sleep(1); 9680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 9780a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 9880a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 9980a6f5c5SLiu Zhe 10080a6f5c5SLiu Zhe // paste to the same file 10180a6f5c5SLiu Zhe impressSlideSorter.focus(); 10280a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 10380a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 10480a6f5c5SLiu Zhe 10580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 10680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 10780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 10880a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 10980a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 11080a6f5c5SLiu Zhe 11180a6f5c5SLiu Zhe // paste to different file 11280a6f5c5SLiu Zhe impress.focus(); 11380a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 11480a6f5c5SLiu Zhe presentationWizard.ok(); 11580a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 11680a6f5c5SLiu Zhe impressSlideSorter.focus(); 11780a6f5c5SLiu Zhe typeKeys("<down>"); 11880a6f5c5SLiu Zhe sleep(1); 11980a6f5c5SLiu Zhe 12080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 12180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 12280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 12380a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 12480a6f5c5SLiu Zhe } 12580a6f5c5SLiu Zhe 12680a6f5c5SLiu Zhe /** 12780a6f5c5SLiu Zhe * Test Copy slide with Apply to all Footer to same file and different file 12880a6f5c5SLiu Zhe * 12980a6f5c5SLiu Zhe * @throws Exception 13080a6f5c5SLiu Zhe */ 13180a6f5c5SLiu Zhe @Test 13280a6f5c5SLiu Zhe public void testCopySlideWithApplyToAllFooter() throws Exception { 13380a6f5c5SLiu Zhe 13480a6f5c5SLiu Zhe // add header and footer 13580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 13680a6f5c5SLiu Zhe 13780a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 13880a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 13980a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 14080a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 14180a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 14280a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 14380a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 14480a6f5c5SLiu Zhe 14580a6f5c5SLiu Zhe impressSlideSorter.focus(); 14680a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 14780a6f5c5SLiu Zhe typeKeys("<up>"); 14880a6f5c5SLiu Zhe } 14980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 15080a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.uncheck(); 15180a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 15280a6f5c5SLiu Zhe 15380a6f5c5SLiu Zhe // paste to the same file 15480a6f5c5SLiu Zhe impressSlideSorter.focus(); 15580a6f5c5SLiu Zhe typeKeys("<up>"); 15680a6f5c5SLiu Zhe app.dispatch(".uno:Copy"); 15780a6f5c5SLiu Zhe typeKeys("<down>"); 15880a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 15980a6f5c5SLiu Zhe 16080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 16180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 16280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 16380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 16480a6f5c5SLiu Zhe sdHeaderAndFooterDlgSlideTab.cancel(); 16580a6f5c5SLiu Zhe 16680a6f5c5SLiu Zhe // paste to different file 16780a6f5c5SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 16880a6f5c5SLiu Zhe presentationWizard.ok(); 16980a6f5c5SLiu Zhe app.dispatch(".uno:Paste"); 17080a6f5c5SLiu Zhe impressSlideSorter.focus(); 17180a6f5c5SLiu Zhe typeKeys("<down>"); 17280a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 17380a6f5c5SLiu Zhe 17480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 17580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 17680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 17780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 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 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()); 23080a6f5c5SLiu Zhe } 23180a6f5c5SLiu Zhe 23280a6f5c5SLiu Zhe /** 23380a6f5c5SLiu Zhe * Test duplicate slide with Apply to all Footer to same file 23480a6f5c5SLiu Zhe * 23580a6f5c5SLiu Zhe * @throws Exception 23680a6f5c5SLiu Zhe */ 23780a6f5c5SLiu Zhe @Test 23880a6f5c5SLiu Zhe public void testDuplicateSlideWithApplyToAllFooter() throws Exception { 23980a6f5c5SLiu Zhe 24080a6f5c5SLiu Zhe // add header and footer 24180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 24280a6f5c5SLiu Zhe 24380a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 24480a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 24580a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 24680a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 24780a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 24880a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 24980a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 25080a6f5c5SLiu Zhe 25180a6f5c5SLiu Zhe impressSlideSorter.focus(); 25280a6f5c5SLiu Zhe for (int j = 0; j <= 2; j++) { 25380a6f5c5SLiu Zhe typeKeys("<up>"); 25480a6f5c5SLiu Zhe } 25580a6f5c5SLiu Zhe app.dispatch(".uno:DuplicatePage"); 25680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 25780a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 25880a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 25980a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 26080a6f5c5SLiu Zhe } 26180a6f5c5SLiu Zhe 26280a6f5c5SLiu Zhe /** 26380a6f5c5SLiu Zhe * Test footer not show on the first slide. 26480a6f5c5SLiu Zhe * 26580a6f5c5SLiu Zhe * @throws Exception 26680a6f5c5SLiu Zhe */ 26780a6f5c5SLiu Zhe @Test 26880a6f5c5SLiu Zhe public void testFooterNotShowOn1stSlide() throws Exception { 26980a6f5c5SLiu Zhe 27080a6f5c5SLiu Zhe // add header and footer 27180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 27280a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 27380a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 27480a6f5c5SLiu Zhe sdFooterNotShowOn1stSlide.check(); 27580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 27680a6f5c5SLiu Zhe 27780a6f5c5SLiu Zhe // Check slide 1 27880a6f5c5SLiu Zhe impressSlideSorter.focus(); 27980a6f5c5SLiu Zhe // typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04 28080a6f5c5SLiu Zhe // sleep(1); // If no sleep, error occur 28180a6f5c5SLiu Zhe for (int i = 0; i < 5; i++) { 28280a6f5c5SLiu Zhe typeKeys("<up>"); 28380a6f5c5SLiu Zhe sleep(1); 28480a6f5c5SLiu Zhe } 28580a6f5c5SLiu Zhe 28680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 28780a6f5c5SLiu Zhe assertEquals(true, sdFooterNotShowOn1stSlide.isChecked()); 28880a6f5c5SLiu Zhe assertEquals(false, sdFooterTextOnSlide.isChecked()); 28980a6f5c5SLiu Zhe } 29080a6f5c5SLiu Zhe 29180a6f5c5SLiu Zhe /** 29280a6f5c5SLiu Zhe * Test Insert Footer to focus slide. 29380a6f5c5SLiu Zhe * 29480a6f5c5SLiu Zhe * @throws Exception 29580a6f5c5SLiu Zhe */ 29680a6f5c5SLiu Zhe @Test 29780a6f5c5SLiu Zhe public void testInsertApplyFooterOnSlide() throws Exception { 29880a6f5c5SLiu Zhe 29980a6f5c5SLiu Zhe // add header and footer to focus slide. 30080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 30180a6f5c5SLiu Zhe 30280a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 30380a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 30480a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 30580a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 30680a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 30780a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 30880a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.click(); 30980a6f5c5SLiu Zhe 31080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 31180a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 31280a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 31380a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 31480a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 31580a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 31680a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 31780a6f5c5SLiu Zhe // close header and footer dialog. 31880a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 31980a6f5c5SLiu Zhe typeKeys("<tab>"); 32080a6f5c5SLiu Zhe typeKeys("<enter>"); 32180a6f5c5SLiu Zhe // end close 32280a6f5c5SLiu Zhe 32380a6f5c5SLiu Zhe impressSlideSorter.focus(); 32480a6f5c5SLiu Zhe typeKeys("<up>"); 32580a6f5c5SLiu Zhe sleep(1); // If no sleep, error occur 32680a6f5c5SLiu Zhe 32780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 32880a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 32980a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 33080a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 33180a6f5c5SLiu Zhe // close header and footer dialog. 33280a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 33380a6f5c5SLiu Zhe typeKeys("<tab>"); 33480a6f5c5SLiu Zhe typeKeys("<enter>"); 33580a6f5c5SLiu Zhe // end close 33680a6f5c5SLiu Zhe 33780a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 33880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 33980a6f5c5SLiu Zhe assertEquals("", sdFixedDateAndTimeOnSlideInput.getText()); 34080a6f5c5SLiu Zhe assertEquals("", sdFooterTextOnSlideInput.getText()); 34180a6f5c5SLiu Zhe assertEquals(false, sdSlideNumAsFooterOnSlide.isChecked()); 34280a6f5c5SLiu Zhe } 34380a6f5c5SLiu Zhe 34480a6f5c5SLiu Zhe /** 34580a6f5c5SLiu Zhe * Test Insert Footer to Notes View 34680a6f5c5SLiu Zhe * 34780a6f5c5SLiu Zhe * @throws Exception 34880a6f5c5SLiu Zhe */ 34980a6f5c5SLiu Zhe @Test 35080a6f5c5SLiu Zhe public void testInsertApplyToAllFooterOnNotes() throws Exception { 35180a6f5c5SLiu Zhe 35280a6f5c5SLiu Zhe // add header and footer to focus slide. 35380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 35480a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 35580a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 35680a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 35780a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 35880a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 35980a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); 36080a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 36180a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 36280a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 36380a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 36480a6f5c5SLiu Zhe 36580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 36680a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 36780a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 36880a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 36980a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 37080a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 37180a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 37280a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 37380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 37480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 37580a6f5c5SLiu Zhe // close header and footer dialog. 37680a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 37780a6f5c5SLiu Zhe typeKeys("<tab>"); 37880a6f5c5SLiu Zhe typeKeys("<enter>"); 37980a6f5c5SLiu Zhe // end close 38080a6f5c5SLiu Zhe 38180a6f5c5SLiu Zhe impressSlideSorter.focus(); 38280a6f5c5SLiu Zhe typeKeys("<up>"); 38380a6f5c5SLiu Zhe 38480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 38580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 38680a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 38780a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 38880a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 38980a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 39080a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 39180a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 39280a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 39380a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 39480a6f5c5SLiu Zhe // close header and footer dialog. 39580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.focus(); 39680a6f5c5SLiu Zhe typeKeys("<tab>"); 39780a6f5c5SLiu Zhe typeKeys("<enter>"); 39880a6f5c5SLiu Zhe // end close 39980a6f5c5SLiu Zhe 40080a6f5c5SLiu Zhe sdInsertPageButtonOnToolbar.click(); 40180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 40280a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 40380a6f5c5SLiu Zhe assertEquals(true, sdHeaderTextOnNotes.isChecked()); 40480a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 40580a6f5c5SLiu Zhe assertEquals(true, sdDateAndTimeFooterOnSlide.isChecked()); 40680a6f5c5SLiu Zhe assertEquals(true, sdFixedDateAndTimeFooterOnSlide.isChecked()); 40780a6f5c5SLiu Zhe assertEquals("Fix Date: 20120323", sdFixedDateAndTimeOnSlideInput.getText()); 40880a6f5c5SLiu Zhe assertEquals(true, sdFooterTextOnSlide.isChecked()); 40980a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 41080a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 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()); 46980a6f5c5SLiu Zhe } 47080a6f5c5SLiu Zhe 47180a6f5c5SLiu Zhe /** 47280a6f5c5SLiu Zhe * Test Insert update automatically time footer to slides. 47380a6f5c5SLiu Zhe * 47480a6f5c5SLiu Zhe * @throws Exception 47580a6f5c5SLiu Zhe */ 47680a6f5c5SLiu Zhe @Test 47780a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooter() throws Exception { 47880a6f5c5SLiu Zhe 47980a6f5c5SLiu Zhe // add header and footer 48080a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 48180a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 48280a6f5c5SLiu Zhe sdAutoUpdateTimeFooterType.select(7); 48380a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 48480a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 48580a6f5c5SLiu Zhe sleep(1); // Wait some time to check the time update 48680a6f5c5SLiu Zhe 48780a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 48880a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 48980a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 49080a6f5c5SLiu Zhe } 49180a6f5c5SLiu Zhe 49280a6f5c5SLiu Zhe /** 49380a6f5c5SLiu Zhe * Test Insert update automatically time footer to Notes view. 49480a6f5c5SLiu Zhe * 49580a6f5c5SLiu Zhe * @throws Exception 49680a6f5c5SLiu Zhe */ 49780a6f5c5SLiu Zhe @Test 49880a6f5c5SLiu Zhe public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception { 49980a6f5c5SLiu Zhe 50080a6f5c5SLiu Zhe // add header and footer 50180a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 50280a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 50380a6f5c5SLiu Zhe sdAutoUpdateTimeFooter.check(); 50480a6f5c5SLiu Zhe String currentTime = sdAutoUpdateTimeFooterType.getItemText(7); 50580a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 50680a6f5c5SLiu Zhe sleep(1); // Wait some time to check the time update 50780a6f5c5SLiu Zhe 50880a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 50980a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 51080a6f5c5SLiu Zhe String updatedTime = sdAutoUpdateTimeFooterType.getItemText(7); 51180a6f5c5SLiu Zhe 51280a6f5c5SLiu Zhe assertNotSame("Time can not update", currentTime, updatedTime); 51380a6f5c5SLiu Zhe } 51480a6f5c5SLiu Zhe 51580a6f5c5SLiu Zhe /** 51680a6f5c5SLiu Zhe * Test Insert Header and Footer to Notes view. Save and ReOpen 51780a6f5c5SLiu Zhe * 51880a6f5c5SLiu Zhe * @throws Exception 51980a6f5c5SLiu Zhe */ 52080a6f5c5SLiu Zhe @Test 52180a6f5c5SLiu Zhe public void testInsertHeaderFooterOnNotes() throws Exception { 52280a6f5c5SLiu Zhe 52380a6f5c5SLiu Zhe // add header and footer 52480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 52580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 52680a6f5c5SLiu Zhe sdHeaderTextOnNotes.check(); 52780a6f5c5SLiu Zhe sdHeaderTextOnNotesInput.setText("Header Test"); 52880a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 52980a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 53080a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 53180a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 53280a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 53380a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 53480a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 53580a6f5c5SLiu Zhe 53680a6f5c5SLiu Zhe impressSlideSorter.focus(); 53780a6f5c5SLiu Zhe typeKeys("<up>"); 53880a6f5c5SLiu Zhe 53980a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 54080a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 54180a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 54280a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 54380a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 54480a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 54580a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.cancel(); 54680a6f5c5SLiu Zhe 54780a6f5c5SLiu Zhe // save this file 54880a6f5c5SLiu Zhe app.dispatch(".uno:SaveAs"); 54980a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 55080a6f5c5SLiu Zhe FileUtil.deleteFile(saveTo); 55180a6f5c5SLiu Zhe submitSaveDlg(saveTo); 5524a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 5534a13b48eSLi Feng Wang activeMsgBox.yes(); 5544a13b48eSLi Feng Wang sleep(2); 5554a13b48eSLi Feng Wang } 5564a13b48eSLi Feng Wang sleep(5); 55780a6f5c5SLiu Zhe app.dispatch(".uno:CloseDoc"); 55880a6f5c5SLiu Zhe 55980a6f5c5SLiu Zhe // Reopen this file 56080a6f5c5SLiu Zhe openStartcenter(); 56180a6f5c5SLiu Zhe app.dispatch(".uno:Open"); 56280a6f5c5SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 56380a6f5c5SLiu Zhe submitOpenDlg(openFrom); 5644a13b48eSLi Feng Wang sleep(5); 56580a6f5c5SLiu Zhe // check after reopen 56680a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 56780a6f5c5SLiu Zhe sdHeaderAndFooterOnNotesTabPage.select(); 56880a6f5c5SLiu Zhe assertEquals("Header Test", sdHeaderTextOnNotesInput.getText()); 56980a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 57080a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 57180a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 57280a6f5c5SLiu Zhe } 57380a6f5c5SLiu Zhe 57480a6f5c5SLiu Zhe /** 57580a6f5c5SLiu Zhe * Test Insert Header and Footer to Slide Save and Reopen 57680a6f5c5SLiu Zhe * 57780a6f5c5SLiu Zhe * @throws Exception 57880a6f5c5SLiu Zhe */ 57980a6f5c5SLiu Zhe @Test 58080a6f5c5SLiu Zhe public void testInsertHeaderFooterOnSlide() throws Exception { 58180a6f5c5SLiu Zhe 58280a6f5c5SLiu Zhe // add header and footer 58380a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 58480a6f5c5SLiu Zhe sdDateAndTimeFooterOnSlide.check(); 58580a6f5c5SLiu Zhe sdFixedDateAndTimeFooterOnSlide.check(); 58680a6f5c5SLiu Zhe sdFixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); 58780a6f5c5SLiu Zhe sdFooterTextOnSlide.check(); 58880a6f5c5SLiu Zhe sdFooterTextOnSlideInput.setText("Footer Test"); 58980a6f5c5SLiu Zhe sdSlideNumAsFooterOnSlide.check(); 59080a6f5c5SLiu Zhe sdApplyToAllButtonOnSlideFooter.click(); 59180a6f5c5SLiu Zhe 59280a6f5c5SLiu Zhe impressSlideSorter.focus(); 59380a6f5c5SLiu Zhe typeKeys("<up>"); 59480a6f5c5SLiu Zhe 59580a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 59680a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 59780a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 59880a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 59980a6f5c5SLiu Zhe 60080a6f5c5SLiu Zhe // close header and footer dialog. 60180a6f5c5SLiu Zhe sdApplyButtonOnSlideFooter.focus(); 60280a6f5c5SLiu Zhe typeKeys("<tab>"); 60380a6f5c5SLiu Zhe typeKeys("<enter>"); 60480a6f5c5SLiu Zhe 60580a6f5c5SLiu Zhe // save this file 60680a6f5c5SLiu Zhe app.dispatch(".uno:SaveAs"); 60780a6f5c5SLiu Zhe String saveTo = getPath("temp/" + "hello.odp"); 60880a6f5c5SLiu Zhe FileUtil.deleteFile(saveTo); 60980a6f5c5SLiu Zhe submitSaveDlg(saveTo); 6104a13b48eSLi Feng Wang if (activeMsgBox.exists()) { 6114a13b48eSLi Feng Wang activeMsgBox.yes(); 6124a13b48eSLi Feng Wang sleep(2); 6134a13b48eSLi Feng Wang } 6144a13b48eSLi Feng Wang sleep(5); 61580a6f5c5SLiu Zhe app.dispatch(".uno:CloseDoc"); 61680a6f5c5SLiu Zhe 61780a6f5c5SLiu Zhe // Reopen this file 61880a6f5c5SLiu Zhe openStartcenter(); 61980a6f5c5SLiu Zhe app.dispatch(".uno:Open"); 62080a6f5c5SLiu Zhe String openFrom = getPath("temp/" + "hello.odp"); 62180a6f5c5SLiu Zhe submitOpenDlg(openFrom); 6224a13b48eSLi Feng Wang sleep(5); 62380a6f5c5SLiu Zhe // check after reopen 62480a6f5c5SLiu Zhe app.dispatch(".uno:HeaderAndFooter"); 62580a6f5c5SLiu Zhe assertEquals("Fix Date: 20120329", sdFixedDateAndTimeOnSlideInput.getText()); 62680a6f5c5SLiu Zhe assertEquals("Footer Test", sdFooterTextOnSlideInput.getText()); 62780a6f5c5SLiu Zhe assertEquals(true, sdSlideNumAsFooterOnSlide.isChecked()); 62880a6f5c5SLiu Zhe } 62980a6f5c5SLiu Zhe } 630