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