--- src/testcase/sc/validity/ValidityCellRangeSourcePicker.java (revision 1362802) +++ src/testcase/sc/validity/ValidityCellRangeSourcePicker.java (working copy) @@ -1,116 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class ValidityCellRangeSourcePicker { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Cell range source picker in Validity. Input from Edit Box. - */ - @Test - public void testValidityCellRangeSourcePicker() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Cell range"); - SC_ValiditySourcePicker.click(); - assertEquals(false,SC_ValidityCriteriaAllowList.exists()); - SC_ValiditySourceInput.setText("$Sheet1.$A$2:$C$5"); - SC_ValiditySourcePicker.click(); - assertEquals(true,SC_ValidityCriteriaAllowList.exists()); - typeKeys(""); - - calc.focus(); - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("test32"); - typeKeys(""); - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - ActiveMsgBox.focus(); - typeKeys(""); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - assertEquals("Test",CalcUtil.getCellText("Sheet1.A1")); - - } - -} - --- src/testcase/sc/datapilot/RemoveFunctionOfGroupedField.java (revision 1362802) +++ src/testcase/sc/datapilot/RemoveFunctionOfGroupedField.java (working copy) @@ -1,139 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class RemoveFunctionOfGroupedField { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify the Remove function of Grouped field - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - CalcUtil.selectRange("B4:C4"); - SpreadSheetCells.openContextMenu(); - menuItem("Group->Group Selected Items").select(); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellText("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - CalcUtil.selectRange("D4"); - SpreadSheetCells.openContextMenu(); - menuItem("Group->Ungroup").select(); - assertEquals("Name",CalcUtil.getCellText("B3")); - assertEquals("",CalcUtil.getCellText("C3")); - assertEquals("Bill Zhang",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J23")); - } - -} --- src/testcase/sc/datapilot/MoveFieldInSameAreaManualUpdate.java (revision 1362802) +++ src/testcase/sc/datapilot/MoveFieldInSameAreaManualUpdate.java (working copy) @@ -1,174 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class MoveFieldInSameAreaManualUpdate { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - sleep(1); - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("B1")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Order Number",CalcUtil.getCellText("B3")); - sleep(1); - - DataPilotFieldSelect.click(1,90); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - DataPilotAutomaticallyUpdateCheckBox.uncheck(); - DataPilotColumnArea.drag(1, 1, 1, 60); - assertEquals("Name",CalcUtil.getCellText("D1")); - assertEquals("Locale",CalcUtil.getCellText("C1")); - sleep(1); - - DataPilotPaneRowArea.drag(1,1, 1, 60); - assertEquals("Order Number",CalcUtil.getCellText("B3")); - assertEquals("Date",CalcUtil.getCellText("A3")); - sleep(1); - - CalcUtil.selectRange("A33"); - ActiveMsgBox.yes(); - assertEquals("Name",CalcUtil.getCellText("C1")); - assertEquals("Locale",CalcUtil.getCellText("D1")); - assertEquals("Order Number",CalcUtil.getCellText("A3")); - assertEquals("Date",CalcUtil.getCellText("B3")); - sleep(1); - - DataPilotColumnArea.click(1,1); - DataPilotColumnArea.openContextMenu(); - menuItem("Move Down").select(); - assertEquals("Name",CalcUtil.getCellText("C1")); - assertEquals("Locale",CalcUtil.getCellText("D1")); - sleep(1); - - DataPilotPaneRowArea.click(1,30); - DataPilotPaneRowArea.openContextMenu(); - menuItem("Move Up").select(); - assertEquals("Order Number",CalcUtil.getCellText("A3")); - assertEquals("Date",CalcUtil.getCellText("B3")); - sleep(1); - - CalcUtil.selectRange("A33"); - ActiveMsgBox.yes(); - assertEquals("Name",CalcUtil.getCellText("D1")); - assertEquals("Locale",CalcUtil.getCellText("C1")); - assertEquals("Order Number",CalcUtil.getCellText("B3")); - assertEquals("Date",CalcUtil.getCellText("A3")); - assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - DataPilotAutomaticallyUpdateCheckBox.check(); - sleep(1); - - } - -} --- src/testcase/sw/table/Table.java (revision 1362802) +++ src/testcase/sw/table/Table.java (working copy) @@ -24,7 +24,7 @@ /** * */ -package testcase.textdocument.table; +package testcase.sw.table; import static testlib.AppUtil.*; import static testlib.UIMap.*; --- src/testcase/sc/datapilot/HideShowPanel.java (revision 1362802) +++ src/testcase/sc/datapilot/HideShowPanel.java (working copy) @@ -1,165 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - - -/** - * - * - */ -public class HideShowPanel { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel while switch focus among tables with same/different source range. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - CalcUtil.selectRange("A1:J24"); - typeKeys("<$copy>"); - - CalcUtil.selectRange("A26"); - typeKeys("<$paste>"); - assertEquals("Locale",CalcUtil.getCellText("A26")); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A28")); - assertEquals("Name",CalcUtil.getCellText("B28")); - assertEquals("Date",CalcUtil.getCellText("A29")); - assertEquals("Total Result",CalcUtil.getCellText("A48")); - assertEquals("Total Result",CalcUtil.getCellText("J29")); - assertEquals("266773",CalcUtil.getCellText("J48")); - sleep(1); - - CalcUtil.selectRange("A1"); - SpreadSheetCells.openContextMenu(); - menuItem("Show DataPilot Panel").select(); - assertFalse(DataPilotPanel.exists()); - sleep(1); - - CalcUtil.selectRange("A1"); - SpreadSheetCells.openContextMenu(); - menuItem("Show DataPilot Panel").select(); - assertTrue(DataPilotPanel.exists()); - sleep(1); - - DataPilotPanel.close(); - assertFalse(DataPilotPanel.exists()); - sleep(1); - - CalcUtil.selectRange("A26"); - DataPilotButton.click(); - sleep(1); - assertTrue(DataPilotPanel.exists()); - assertEquals("Locale",CalcUtil.getCellText("A26")); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A28")); - assertEquals("Name",CalcUtil.getCellText("B28")); - assertEquals("Date",CalcUtil.getCellText("A29")); - assertEquals("Total Result",CalcUtil.getCellText("A48")); - assertEquals("Total Result",CalcUtil.getCellText("J29")); - assertEquals("266773",CalcUtil.getCellText("J48")); - } - -} --- src/testcase/presentation/headerandfooter/OpenDocumentWithHeaderFooter.java (revision 1362802) +++ src/testcase/presentation/headerandfooter/OpenDocumentWithHeaderFooter.java (working copy) @@ -1,171 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.presentation.headerandfooter; - -import static testlib.AppUtil.fullPath; -import static testlib.AppUtil.openStartcenter; -import static testlib.AppUtil.submitSaveDlg; -import static testlib.AppUtil.submitOpenDlg; -import static testlib.AppUtil.testFile; -import static testlib.UIMap.*; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import testlib.Log; - -public class OpenDocumentWithHeaderFooter { - - @Rule - public Log LOG = new Log(); - - @Before - public void setUp() throws Exception { - app.start(); - } - - @After - public void tearDown() throws Exception { - app.close(); - } - - /** - * Test open AOO3.4 presentation with header and footer. - * edit and save to ODP - * @throws Exception - */ - @Test - public void testOpenAOO34WithHeaderFooter() throws Exception{ - //open sample file - String file = testFile("sd/AOO3.4HeaderFooter.odp"); - app.dispatch(".uno:Open"); - submitOpenDlg(file); - - //check after reopen - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals("fixed date",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("footer test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - - SD_SlideNumAsFooterOnSlide.uncheck(); - SD_ApplyToAllButtonOnSlideFooter.click(); - - //save to odp and reopen - impress.menuItem("File->Save As...").select(); - String saveTo2 = fullPath("temp/" + "AOO3.4HeaderFooter.odp"); - FileUtil.deleteFile(saveTo2); - submitSaveDlg(saveTo2); - impress.menuItem("File->Close").select(); - sleep(1); - - openStartcenter(); - app.dispatch(".uno:Open"); - String openFrom2=fullPath("temp/" + "AOO3.4HeaderFooter.odp"); - submitOpenDlg(openFrom2); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked()); - //end-save to odp and reopen - } - - /** - * Test open ppt file with header and footer. - * edit and save to PPT/ODP - * @throws Exception - */ - @Test - public void testOpenPPTWithHeaderFooter() throws Exception{ - //open sample file - String file = testFile("sd/gfdd.ppt"); - app.dispatch(".uno:Open"); - submitOpenDlg(file); - - //check after reopen - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals("testdte",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("yesy",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - - SD_SlideNumAsFooterOnSlide.uncheck(); - SD_ApplyToAllButtonOnSlideFooter.click(); - - //save to ppt and reopen - impress.menuItem("File->Save As...").select(); - String saveTo = fullPath("temp/" + "gfdd.ppt"); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - if (AlienFormatDlg.exists(3)) - AlienFormatDlg.ok(); - sleep(1); - impress.menuItem("File->Close").select(); - sleep(1); - - openStartcenter(); - app.dispatch(".uno:Open"); - String openFrom=fullPath("temp/" + "gfdd.ppt"); - submitOpenDlg(openFrom); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked()); - //end-save to ppt and reopen - - //close Header and Footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end - - //save to odp and reopen - impress.menuItem("File->Save As...").select(); - String saveTo2 = fullPath("temp/" + "gfdd.odp"); - FileUtil.deleteFile(saveTo2); - submitSaveDlg(saveTo2); - impress.menuItem("File->Close").select(); - sleep(1); - - openStartcenter(); - app.dispatch(".uno:Open"); - String openFrom2=fullPath("temp/" + "gfdd.odp"); - submitOpenDlg(openFrom2); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked()); - //end-save to odp and reopen - } -} --- src/testcase/sc/validity/AllowWholeNumLessThan.java (revision 1362802) +++ src/testcase/sc/validity/AllowWholeNumLessThan.java (working copy) @@ -1,136 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowWholeNumLessThan { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow whole number, less than or equal to in Validity. - */ - @Test - public void testAllowWholeNumLessThan() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:C5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Whole Numbers"); - SC_ValidityDecimalCompareOperator.select("less than or equal"); - SC_ValiditySourceInput.setText("100"); - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorMessageTitle.setText("Stop to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("99"); - typeKeys(""); - assertEquals("99",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("100"); - typeKeys(""); - assertEquals("100",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.B1"); - SC_CellInput.activate(); - typeKeys("101"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B1")); - - CalcUtil.selectRange("Sheet1.B2"); - SC_CellInput.activate(); - typeKeys("45.5"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B2")); - - CalcUtil.selectRange("Sheet1.C1"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.C1")); - - } - -} - --- src/testcase/textdocument/table/Table.java (revision 1362802) +++ src/testcase/textdocument/table/Table.java (working copy) @@ -1,90 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.textdocument.table; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; -import static org.junit.Assert.*; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.SystemUtil; - -import testlib.Log; - -/** - * - */ -public class Table { - - @Rule - public Log LOG = new Log(); - - @Before - public void setUp() throws Exception { - app.start(); - } - - @After - public void tearDown() throws Exception { - app.close(); - } - - /** - * Test convert table to text in text document - * @throws Exception - */ - @Test - public void testConvertTableToText() throws Exception{ - - //Create a new text document - startcenter.menuItem("File->New->Text Document").select(); - sleep(3); - - // Insert a table and input some data - writer.menuItem("Insert->Table...").select(); - writer_InsertTable.ok(); - writer.focus(); - typeKeys("1234"); - sleep(1); - - // Convert table to text - writer.menuItem("Table->Convert->Table to Text...").select(); - assertTrue("Convert Table to Text dialog pop up", writer_ConvertTableToTextDlg.exists()); - typeKeys(""); - sleep(1); - - // Verify if text is converted successfully - writer.menuItem("Edit->Select All").select(); - app.dispatch(".uno:Copy"); - if (SystemUtil.isWindows()) - assertEquals("Converted text", "1\t2\r\n3\t4\r\n", app.getClipboard()); // windows�лس�������\r\n - else - assertEquals("Converted text", "1\t2\n3\t4\n", app.getClipboard()); - } -} --- src/testlib/UIMap.java (revision 1362802) +++ src/testlib/UIMap.java (working copy) @@ -242,7 +242,6 @@ public static final VclEditBox SD_FooterTextOnSlideInput = editbox("sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_FOOTER_FIXED"); public static final VclButton SD_SlideNumAsFooterOnSlide = button("sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_SLIDENUMBER"); public static final VclButton SD_ApplyToAllButtonOnSlideFooter = button("sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLYTOALL"); -// public static final VclWindow SD_SlidesPanel = window("HID_SD_WIN_DOCUMENT"); public static final VclControl SD_SlidelistInNaviagtor = control("HID_SD_NAVIGATOR_TLB"); public static final VclControl SD_HeaderAndFooterDialog = control("HID_SD_TABPAGE_HEADERFOOTER_SLIDE"); public static final VclButton SD_ApplyButtonOnSlideFooter = button("sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLY"); @@ -290,42 +289,41 @@ public static final VclButton SCSubtotalsIncludeFormatsCheckBox = button("sc:CheckBox:RID_SCPAGE_SUBT_OPTIONS:BTN_FORMATS"); public static final VclButton SCSubtotalsCustomSortOrderCheckBox = button("sc:CheckBox:RID_SCPAGE_SUBT_OPTIONS:BTN_USERDEF"); public static final VclListBox SCSubtotalsCustomSortListBox = listbox("sc:ListBox:RID_SCPAGE_SUBT_OPTIONS:LB_USERDEF"); - public static final VclListBox SC_ValidityCriteriaAllowList = listbox("548277762"); - public static final VclTabPage SC_ValidityCriteriaTabpage = tabpage("548274176"); - public static final VclButton SC_ValidityAllowBlankCells = button("548275203"); - public static final VclButton SC_ValidityShowSelectionList = button("548275227"); - public static final VclButton SC_ValiditySortEntriesAscending = button("548275228"); - public static final VclButton SC_ValiditySourcePicker = button("548286040"); - public static final VclTabPage SC_ValidityErrorAlertTabPage = tabpage("548306944"); - public static final VclButton SC_ValidityShowErrorMessage = button("548308501"); - public static final VclListBox SC_ValidityErrorAlertActionList = listbox("548310552"); - public static final VclEditBox SC_ValidityErrorMessageTitle = editbox("548309005"); - public static final VclEditBox SC_ValidityErrorMessage = editbox("548309529"); - public static final VclButton SC_ValidityErrorBrowseButton = button("548311578"); + public static final VclListBox SC_ValidityCriteriaAllowList = listbox("sc:ListBox:TP_VALIDATION_VALUES:LB_ALLOW"); + public static final VclTabPage SC_ValidityCriteriaTabpage = tabpage("sc:TabPage:TP_VALIDATION_VALUES"); + public static final VclButton SC_ValidityAllowBlankCells = button("sc:CheckBox:TP_VALIDATION_VALUES:TSB_ALLOW_BLANKS"); + public static final VclButton SC_ValidityShowSelectionList = button("sc:CheckBox:TP_VALIDATION_VALUES:CB_SHOWLIST"); + public static final VclButton SC_ValiditySortEntriesAscending = button("sc:CheckBox:TP_VALIDATION_VALUES:CB_SORTLIST"); + public static final VclButton SC_ValiditySourcePicker = button("sc:ImageButton:TP_VALIDATION_VALUES:RB_VALIDITY_REF"); + public static final VclTabPage SC_ValidityErrorAlertTabPage = tabpage("sc:TabPage:TP_VALIDATION_ERROR"); + public static final VclButton SC_ValidityShowErrorMessage = button("sc:TriStateBox:TP_VALIDATION_ERROR:TSB_SHOW"); + public static final VclListBox SC_ValidityErrorAlertActionList = listbox("sc:ListBox:TP_VALIDATION_ERROR:LB_ACTION"); + public static final VclEditBox SC_ValidityErrorMessageTitle = editbox("sc:Edit:TP_VALIDATION_ERROR:EDT_TITLE"); + public static final VclEditBox SC_ValidityErrorMessage = editbox("sc:MultiLineEdit:TP_VALIDATION_ERROR:EDT_ERROR"); + public static final VclButton SC_ValidityErrorBrowseButton = button("sc:PushButton:TP_VALIDATION_ERROR:BTN_SEARCH"); public static final VclTabPage SCSubTotalsOptionsTabPage = tabpage("SC_HID_SCPAGE_SUBT_OPTIONS"); public static final VclButton SCDeleteCellsDeleteRowsRadioButton = button("sc:RadioButton:RID_SCDLG_DELCELL:BTN_DELROWS"); public static final VclDialog SCDeleteCellsDialog = dialog(".uno:DeleteCell"); public static final VclTabPage SCSubTotalsGroup2Dialog = tabpage("SC_HID_SCPAGE_SUBT_GROUP2"); public static final VclTabPage SCSubTotalsGroup3Dialog = tabpage("SC_HID_SCPAGE_SUBT_GROUP3"); public static final VclListBox SCCalcSubTotolsFuncionList = listbox("SC_HID_SC_SUBT_FUNC"); - public static final VclEditBox SC_ValiditySourceInput = editbox("548276231"); - public static final VclWindow SC_CellInput = window("58774"); - public static final VclListBox SC_ValidityDecimalCompareOperator = listbox("548277765"); - public static final VclEditBox SC_ValidityMaxValueInput = editbox("548276233"); - public static final VclEditBox SC_ValidityEntries = editbox("548276765"); - public static final VclTabPage SC_ValidityInputHelpTabPage = tabpage("548290560"); - public static final VclButton SC_ValidityInputHelpCheckbox = button("548292107"); - public static final VclEditBox SC_ValidityInputHelpTitle = editbox("548292621"); - public static final VclEditBox SC_ValidityHelpMessage = editbox("548293135"); - public static final VclButton OptionsDlg_Copy = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_COPY"); + public static final VclEditBox SC_ValiditySourceInput = editbox("sc:Edit:TP_VALIDATION_VALUES:EDT_MIN"); + public static final VclListBox SC_ValidityDecimalCompareOperator = listbox("sc:ListBox:TP_VALIDATION_VALUES:LB_VALUE"); + public static final VclEditBox SC_ValidityMaxValueInput = editbox("sc:Edit:TP_VALIDATION_VALUES:EDT_MAX"); + public static final VclEditBox SC_ValidityEntries = editbox("sc:MultiLineEdit:TP_VALIDATION_VALUES:EDT_LIST"); + public static final VclTabPage SC_ValidityInputHelpTabPage = tabpage("sc:TabPage:TP_VALIDATION_INPUTHELP"); + public static final VclButton SC_ValidityInputHelpCheckbox = button("sc:TriStateBox:TP_VALIDATION_INPUTHELP:TSB_HELP"); + public static final VclEditBox SC_ValidityInputHelpTitle = editbox("sc:Edit:TP_VALIDATION_INPUTHELP:EDT_TITLE"); + public static final VclEditBox SC_ValidityHelpMessage = editbox("sc:MultiLineEdit:TP_VALIDATION_INPUTHELP:EDT_INPUTHELP"); + public static final VclButton OptionsDlg_SortListsTabCopy = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_COPY"); public static final VclButton SortOptionsPage_RangeContainsColumnLabels = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_LABEL"); public static final VclButton SortOptionsPage_CustomSortOrder = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_SORT_USER"); public static final VclButton SortOptionsPage_IncludeFormats = button("sc:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS"); public static final VclListBox SortOptionsPage_CustomSortOrderList = listbox("sc:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_SORT_USER"); public static final VclButton SortOptionsPage_TopToBottom = button("sc:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_TOP_DOWN"); public static final VclButton SortOptionsPage_LeftToRight = button("sc:RadioButton:RID_SCPAGE_SORT_OPTIONS:BTN_LEFT_RIGHT"); - public static final VclButton OptionsDlg_New = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_NEW"); - public static final VclButton OptionsDlg_Add = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_ADD"); + public static final VclButton OptionsDlg_SortListsTabNew = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_NEW"); + public static final VclButton OptionsDlg_SortListsTabAdd = button("sc:PushButton:RID_SCPAGE_USERLISTS:BTN_ADD"); public static final VclTabPage FormatCellsDlg_NumbersPage = tabpage("CUI_HID_NUMBERFORMAT"); public static final VclListBox FormatCellsDlg_NumbersPageCategory = listbox("cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CATEGORY"); public static final VclListBox FormatCellsDlg_NumbersPageCurrencyFormat = listbox("cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CURRENCY"); --- src/testcase/sc/datapilot/CopyPasteDataPilotTable.java (revision 1362802) +++ src/testcase/sc/datapilot/CopyPasteDataPilotTable.java (working copy) @@ -1,153 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; -/** - * - * - */ -public class CopyPasteDataPilotTable { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify copy and paste Data Pilot Table - */ - @Test - public void test() { - //Open the sample file - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - - //Create DataPilotTable and verify the content - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - //Add field into every area - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - //Copy and paste the data pilot table and verify the content - CalcUtil.selectRange("A1:J24"); - typeKeys("<$copy>"); - - CalcUtil.selectRange("A26"); - typeKeys("<$paste>"); - assertEquals("Locale",CalcUtil.getCellText("A26")); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A28")); - assertEquals("Name",CalcUtil.getCellText("B28")); - assertEquals("Date",CalcUtil.getCellText("A29")); - assertEquals("Total Result",CalcUtil.getCellText("A48")); - assertEquals("Total Result",CalcUtil.getCellText("J29")); - assertEquals("266773",CalcUtil.getCellText("J48")); - sleep(1); - - CalcUtil.selectRange("A1:J24"); - typeKeys("<$copy>"); - CalcUtil.selectRange("$A.$A29"); - typeKeys("<$paste>"); - assertEquals("Locale",CalcUtil.getCellText("A29")); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A31")); - assertEquals("Name",CalcUtil.getCellText("B31")); - assertEquals("Date",CalcUtil.getCellText("A32")); - assertEquals("Total Result",CalcUtil.getCellText("A51")); - assertEquals("Total Result",CalcUtil.getCellText("J32")); - assertEquals("266773",CalcUtil.getCellText("J51")); - - } - -} --- src/testcase/sc/validity/AllowGreaterTextLength.java (revision 1362802) +++ src/testcase/sc/validity/AllowGreaterTextLength.java (working copy) @@ -1,126 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowGreaterTextLength { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow Text length, greater than or equal to in Validity. - */ - @Test - public void testAllowDecimalEqual() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Text length"); - SC_ValidityDecimalCompareOperator.select("greater than or equal to"); - SC_ValiditySourceInput.setText("10"); - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorMessageTitle.setText("Stop to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("testtesttesttest"); - typeKeys(""); - assertEquals("Testtesttesttest",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("test test "); - typeKeys(""); - assertEquals("Test test ",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.A4"); - SC_CellInput.activate(); - typeKeys(" "); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A4")); - - CalcUtil.selectRange("Sheet1.A3"); - SC_CellInput.activate(); - typeKeys("Testatest"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A3")); - } - -} - --- src/testcase/presentation/headerandfooter/HeaderAndFooterSetting.java (revision 1362802) +++ src/testcase/presentation/headerandfooter/HeaderAndFooterSetting.java (working copy) @@ -1,724 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.presentation.headerandfooter; - -import static testlib.AppUtil.fullPath; -import static testlib.AppUtil.openStartcenter; -import static testlib.AppUtil.submitOpenDlg; -import static testlib.AppUtil.submitSaveDlg; -import static testlib.UIMap.*; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import testlib.ImpressUtil; -import testlib.Log; - -public class HeaderAndFooterSetting{ - - @Rule - public Log LOG = new Log(); - - @Before - public void setUp() throws Exception { - app.start(); - - // New a impress, insert some slides - app.dispatch("private:factory/simpress?slot=6686"); - PresentationWizard.ok(); - sleep(1); - - for(int i=0; i<5;i++){ - SD_InsertPageButtonOnToolbar.click(); - sleep(1); - } - // Pop up navigator panel - impress.menuItem("View").select(); - if(!impress.menuItem("View->Navigator").isSelected()){ - impress.menuItem("View->Navigator").select(); - } - } - - @After - public void tearDown() throws Exception { - app.close(); - } - - /** - * Test Copy slide with Apply Footer to same file and different file - * @throws Exception - */ - @Test - public void testCopySlideWithApplyFooter() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(2); - - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); - SD_FooterTextOnSlide.check(); - SD_FooterTextOnSlideInput.setText("Footer Test"); - SD_SlideNumAsFooterOnSlide.check(); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - ImpressSlideSorter.focus(); - for(int j=0; j<=2;j++){ - typeKeys(""); - } - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_SlideNumAsFooterOnSlide.uncheck(); - SD_ApplyButtonOnSlideFooter.click(); - - //paste to the same file - ImpressSlideSorter.focus(); - app.dispatch(".uno:Copy"); - app.dispatch(".uno:Paste"); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120323", SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test", SD_FooterTextOnSlideInput.getText()); - assertEquals(false, SD_SlideNumAsFooterOnSlide.isChecked()); - - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - - //paste to different file - impress.focus(); - app.dispatch("private:factory/simpress?slot=6686"); - PresentationWizard.ok(); - sleep(1); - app.dispatch(".uno:Paste"); - ImpressSlideSorter.focus(); - typeKeys(""); - sleep(1); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120323", SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test", SD_FooterTextOnSlideInput.getText()); - assertEquals(false, SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test Copy slide with Apply to all Footer to same file and different file - * @throws Exception - */ - @Test - public void testCopySlideWithApplyToAllFooter() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(2); - - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - ImpressSlideSorter.focus(); - for(int j=0; j<=2;j++){ - typeKeys(""); - sleep(1); - } - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_SlideNumAsFooterOnSlide.uncheck(); - SD_ApplyButtonOnSlideFooter.click(); - - //paste to the same file - ImpressSlideSorter.focus(); - typeKeys(""); - app.dispatch(".uno:Copy"); - typeKeys(""); - sleep(1); - app.dispatch(".uno:Paste"); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - - //paste to different file - impress.focus(); - impress.menuItem("File->New->Presentation").select(); - sleep(1); - app.dispatch(".uno:Paste"); - ImpressSlideSorter.focus(); - typeKeys(""); - sleep(1); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test Copy slide with Notes Footer to same file and different file - * @throws Exception - */ - @Test - public void testCopySlideWithNotesHeaderFooter() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - SD_HeaderTextOnNotes.check(); - SD_HeaderTextOnNotesInput.setText("Header Test"); - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - //paste to the same file - ImpressSlideSorter.focus(); - typeKeys(""); - app.dispatch(".uno:Copy"); - typeKeys(""); - sleep(1); - app.dispatch(".uno:Paste"); - - ImpressUtil.getCurView().activate(); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - - //close header and footer dialog. - SD_ApplyToAllButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - - //paste to different file - impress.focus(); - impress.menuItem("File->New->Presentation").select(); - sleep(1); - app.dispatch(".uno:Paste"); - ImpressSlideSorter.focus(); - typeKeys(""); - sleep(1); - ImpressUtil.getCurView().activate(); - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test duplicate slide with Apply to all Footer to same file - * @throws Exception - */ - @Test - public void testDuplicateSlideWithApplyToAllFooter() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(2); - - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - - ImpressSlideSorter.focus(); - for(int j=0; j<=2;j++){ - typeKeys(""); - sleep(1); - } - impress.menuItem("Insert->Duplicate Slide").select(); - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test footer not show on the first slide. - * @throws Exception - */ - @Test - public void testFooterNotShowOn1stSlide() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(2); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_FooterNotShowOn1stSlide.check(); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - ImpressSlideSorter.focus(); - for(int j=0; j<5; j++){ - typeKeys(""); - } - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_FooterNotShowOn1stSlide.isChecked()); - assertEquals(false,SD_FooterTextOnSlide.isChecked()); - } - - /** - * Test Insert Footer to focus slide. - * @throws Exception - */ - @Test - public void testInsertApplyFooterOnSlide() throws Exception{ - - //add header and footer to focus slide. - impress.menuItem("View->Header and Footer...").select(); - sleep(2); - - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyButtonOnSlideFooter.click(); - sleep(1); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end close - - ImpressSlideSorter.focus(); - typeKeys(""); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("",SD_FooterTextOnSlideInput.getText()); - assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked()); - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end close - - SD_InsertPageButtonOnToolbar.click(); - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("",SD_FooterTextOnSlideInput.getText()); - assertEquals(false,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test Insert Footer to Notes View - * @throws Exception - */ - @Test - public void testInsertApplyToAllFooterOnNotes() throws Exception{ - - //add header and footer to focus slide. - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - SD_HeaderTextOnNotes.check(); - SD_HeaderTextOnNotesInput.setText("Header Test"); - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals(true,SD_HeaderTextOnNotes.isChecked()); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - //close header and footer dialog. - SD_ApplyToAllButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end close - - ImpressSlideSorter.focus(); - typeKeys(""); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals(true,SD_HeaderTextOnNotes.isChecked()); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - //close header and footer dialog. - SD_ApplyToAllButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end close - - SD_InsertPageButtonOnToolbar.click(); - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals(true,SD_HeaderTextOnNotes.isChecked()); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test Insert Footer to Slide, use Apply to All - * @throws Exception - */ - @Test - public void testInsertApplyToAllFooterOnSlide() throws Exception{ - - //add header and footer to focus slide. - impress.menuItem("View->Header and Footer...").select(); - sleep(2); - - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120323"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end close - - ImpressSlideSorter.focus(); - typeKeys(""); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - //end close - - SD_InsertPageButtonOnToolbar.click(); - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals(true,SD_DateAndTimeFooterOnSlide.isChecked()); - assertEquals(true,SD_FixedDateAndTimeFooterOnSlide.isChecked()); - assertEquals("Fix Date: 20120323",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals(true,SD_FooterTextOnSlide.isChecked()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test Insert update automatically time footer to slides. - * @throws Exception - */ - @Test - public void testInsertAutoUpdateTimeFooter() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_AutoUpdateTimeFooter.check(); - SD_AutoUpdateTimeFooterType.select(7); - String currentTime=SD_AutoUpdateTimeFooterType.getItemText(7); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(2); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - - String currentTime2=SD_AutoUpdateTimeFooterType.getItemText(7); - assertFalse(currentTime.equals(currentTime2)); - } - - /** - * Test Insert update automatically time footer to Notes view. - * @throws Exception - */ - @Test - public void testInsertAutoUpdateTimeFooterOnNotes() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - SD_AutoUpdateTimeFooter.check(); - SD_AutoUpdateTimeFooterType.select(7); - String currentTime=SD_AutoUpdateTimeFooterType.getItemText(7); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(2); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - String currentTime2=SD_AutoUpdateTimeFooterType.getItemText(7); - - assertFalse(currentTime.equals(currentTime2)); - } - - /** - * Test Insert Header and Footer to Notes view. - * Save and ReOpen - * @throws Exception - */ - @Test - public void testInsertHeaderFooterOnNotes() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - SD_HeaderTextOnNotes.check(); - SD_HeaderTextOnNotesInput.setText("Header Test"); - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - ImpressSlideSorter.focus(); - typeKeys(""); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - - //close header and footer dialog. - SD_ApplyToAllButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - - //save this file - impress.menuItem("File->Save").select(); - String saveTo = fullPath("temp/" + "hello.odp"); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - impress.menuItem("File->Close").select(); - sleep(2); - - //Reopen this file - openStartcenter(); - app.dispatch(".uno:Open"); - String openFrom=fullPath("temp/" + "hello.odp"); - submitOpenDlg(openFrom); - - //check after reopen - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_HeaderAndFooterOnNotesTabPage.select(); - assertEquals("Header Test",SD_HeaderTextOnNotesInput.getText()); - assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } - - /** - * Test Insert Header and Footer to Slide - * Save and Reopen - * @throws Exception - */ - @Test - public void testInsertHeaderFooterOnSlide() throws Exception{ - - //add header and footer - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - SD_DateAndTimeFooterOnSlide.check(); - SD_FixedDateAndTimeFooterOnSlide.check(); - sleep(1); - SD_FixedDateAndTimeOnSlideInput.setText("Fix Date: 20120329"); - sleep(1); - SD_FooterTextOnSlide.check(); - sleep(1); - SD_FooterTextOnSlideInput.setText("Footer Test"); - sleep(1); - SD_SlideNumAsFooterOnSlide.check(); - sleep(1); - SD_ApplyToAllButtonOnSlideFooter.click(); - sleep(1); - - ImpressSlideSorter.focus(); - typeKeys(""); - - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - - //close header and footer dialog. - SD_ApplyButtonOnSlideFooter.focus(); - typeKeys(""); - typeKeys(""); - - //save this file - impress.menuItem("File->Save").select(); - String saveTo = fullPath("temp/" + "hello.odp"); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - impress.menuItem("File->Close").select(); - sleep(2); - - //Reopen this file - openStartcenter(); - app.dispatch(".uno:Open"); - String openFrom=fullPath("temp/" + "hello.odp"); - submitOpenDlg(openFrom); - - //check after reopen - impress.menuItem("View->Header and Footer...").select(); - sleep(1); - assertEquals("Fix Date: 20120329",SD_FixedDateAndTimeOnSlideInput.getText()); - assertEquals("Footer Test",SD_FooterTextOnSlideInput.getText()); - assertEquals(true,SD_SlideNumAsFooterOnSlide.isChecked()); - } -} --- src/testcase/sc/validity/AllowTimeGreaterThan.java (revision 1362802) +++ src/testcase/sc/validity/AllowTimeGreaterThan.java (working copy) @@ -1,123 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowTimeGreaterThan { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow time Greater than and equal to in Validity. - */ - @Test - public void testAllowTimeGreaterThan() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:C5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Time"); - SC_ValidityDecimalCompareOperator.select("greater than or equal to"); - SC_ValiditySourceInput.setText("8:00"); - - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorAlertActionList.select("Warning"); - - SC_ValidityErrorMessageTitle.setText("warning to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("7:30"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("07:30:00 AM",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("6:00"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.cancel(); - assertEquals("",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.A3"); - SC_CellInput.activate(); - typeKeys("8:00"); - typeKeys(""); - assertEquals("08:00:00 AM",CalcUtil.getCellText("Sheet1.A3")); - - } - -} - --- src/testcase/sc/validity/UncheckErrorAlert.java (revision 1362802) +++ src/testcase/sc/validity/UncheckErrorAlert.java (working copy) @@ -1,105 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class UncheckErrorAlert { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test uncheck Error Alert in Validity. - */ - @Test - public void testUncheckErrorAlert() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Decimal"); - SC_ValidityDecimalCompareOperator.select("equal"); - SC_ValiditySourceInput.setText("1"); - - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.uncheck(); - SC_ValidityErrorAlertActionList.select("Stop"); - typeKeys(""); - sleep(1); - - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("13"); - typeKeys(""); - assertEquals("13",CalcUtil.getCellText("Sheet1.A1")); - - } - -} - - --- src/testcase/sc/datapilot/DataPilotChangeDataFieldOptionAutoUpdate.java (revision 1362802) +++ src/testcase/sc/datapilot/DataPilotChangeDataFieldOptionAutoUpdate.java (working copy) @@ -1,198 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class DataPilotChangeDataFieldOptionAutoUpdate { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - //open the sample file Create DataPilotTable and verify the content - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - sleep(1); - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("B1")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Order Number",CalcUtil.getCellText("B3")); - sleep(1); - - DataPilotFieldSelect.click(1,90); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - //Change Locale option settings, and verify it - String target = "New Locale"; - DataPilotColumnArea.click(1,1); - DataPilotColumnArea.openContextMenu(); - menuItem("Field Option").select(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldDisplayNameEditBox.setText(target); - sleep(1); - - DataPilotFieldOptionFiledSubtotalsPage.select(); - sleep(1); - DataPilotFieldOptionSubTotalsManuallyRadioButton.check(); - sleep(1); - SC_DataPilotOptionSubtotalFunctionList.click(9,24); - sleep(1); - - DataPilotFieldOptionSortTabPageDialog.select(); - - - DataPilotFieldOptionSortDescendingRadioButton.check(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldOptionFieldTabPageDialog.ok(); - sleep(1); - - assertEquals("New Locale",CalcUtil.getCellText("C1")); - assertEquals("USA",CalcUtil.getCellText("C2")); - assertEquals("USA Count - Amount",CalcUtil.getCellInput("H2")); - assertEquals("17",CalcUtil.getCellInput("H30")); - assertEquals("China Count - Amount",CalcUtil.getCellInput("L2")); - assertEquals("9",CalcUtil.getCellInput("L30")); - assertEquals("32779.17",CalcUtil.getCellInput("M30")); - - DataPilotColumnArea.click(1,30); - DataPilotColumnArea.openContextMenu(); - menuItem("Field Option").select(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldShowItemWithoutDataCheckBox.check(); - DataPilotFieldOptionFieldTabPageDialog.ok(); - assertEquals("Emmy Ma",CalcUtil.getCellText("F3")); - assertEquals("32779.17",CalcUtil.getCellInput("U30")); - - CalcUtil.selectRange("C1"); - SpreadSheetCells.openContextMenu(); - menuItem("Field Option...").select(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldDisplayNameEditBox.setText("Locale"); - DataPilotFieldOptionFiledSubtotalsPage.select(); - DataPilotFieldOptionSubTotalsNeverRadioButton.check(); - sleep(1); - DataPilotFieldOptionSortTabPageDialog.select(); - DataPilotFieldOptionSortAscendingRadioButton.check(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldOptionFieldTabPageDialog.ok(); - - assertEquals("Locale",CalcUtil.getCellText("C1")); - assertEquals("China",CalcUtil.getCellText("C2")); - assertEquals("USA",CalcUtil.getCellText("K2")); - assertEquals("32779.17",CalcUtil.getCellInput("S30")); - - - CalcUtil.selectRange("D1"); - SpreadSheetCells.openContextMenu(); - menuItem("Field Option...").select(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldShowItemWithoutDataCheckBox.uncheck(); - DataPilotFieldOptionFieldTabPageDialog.ok(); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - } - -} --- src/testcase/sc/sort/RowsSortWithOptionsCopyResultTo.java (revision 1362802) +++ src/testcase/sc/sort/RowsSortWithOptionsCopyResultTo.java (working copy) @@ -1,167 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class RowsSortWithOptionsCopyResultTo { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test rows sort with options setting: copy sort result to - * @throws Exception - */ - @Ignore("Redo is not work when copy sort result to other sheet") - public void testRowsSortWithOptionsCopyResultTo() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"3", "D"}, - {"5", "FLK"}, - {"4", "E"}, - {"2", "BC"}, - {"6", "GE"}, - {"1", "AB"}, - }; - String[][] expectedSortedResult = new String[][] { - {"1", "AB"}, - {"2", "BC"}, - {"3", "D"}, - {"4", "E"}, - {"5", "FLK"}, - {"6", "GE"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("354261"); - CalcUtil.selectRange("B1"); - typeKeys("DFLKEBCGEAB"); - - // Data->Sort..., choose "Ascending", check "Copy sort results to:" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_CopyResultTo.check(); - SortOptionsPage_CopyResultToEdit.setText("$Sheet3.$A4"); - SortOptionsPage.ok(); - - // Verify sorted result - assertArrayEquals("Copy sorted result to", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet3.$A4")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9")); - - // Move focus to sheet2 then select a cell range, Insert->Names->Define... - CalcUtil.selectRange("$Sheet2.$A1:$B3"); - calc.menuItem("Insert->Names->Define...").select(); - sleep(1); - DefineNamesDlg_NameEdit.setText("cellRange"); - DefineNamesDlg.ok(); - - // Set focus to the original data, Data->Sort... - CalcUtil.selectRange("$Sheet1.$B1"); - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_CopyResultTo.check(); - SortOptionsPage_CopyResultToCellRange.select("cellRange"); - SortOptionsPage.ok(); - - // Verify sorted result - assertArrayEquals("Copy sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet2.$A1")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6")); - - // Save and close document - String saveTo = fullPath("temp/" + "RowsSortWithOptionsCopyResultTo.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9")); - assertArrayEquals("Saved sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6")); - } -} --- src/testcase/sc/sort/SortCriteriaSortSecondBy.java (revision 1362802) +++ src/testcase/sc/sort/SortCriteriaSortSecondBy.java (working copy) @@ -1,152 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortCriteriaSortSecondBy { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort criteria: sort second by - * @throws Exception - */ - @Test - public void testSortCriteriaSortSecondBy() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"3", "D"}, - {"5", "FLK"}, - {"4", "E"}, - {"1", "AB"}, - {"6", "GE"}, - {"2", "AB"}, - }; - String[][] expectedResultSortFirstByB = new String[][] { - {"1", "AB"}, - {"2", "AB"}, - {"3", "D"}, - {"4", "E"}, - {"5", "FLK"}, - {"6", "GE"}, - }; - String[][] expectedResultSortSecondByA= new String[][] { - {"2", "AB"}, - {"1", "AB"}, - {"3", "D"}, - {"4", "E"}, - {"5", "FLK"}, - {"6", "GE"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("354162"); - CalcUtil.selectRange("B1"); - typeKeys("DFLKEABGEAB"); - - // "Data->Sort...", choose "Ascending", sort first by Column B - calc.menuItem("Data->Sort...").select(); - SortPage_Ascending1.check(); - SortPage_By1.select("Column B"); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6")); - calc.menuItem("Edit->Undo: Sort").select(); - - // Save and close document - String saveTo = fullPath("temp/" + "SortCriteriaSortSecondBy.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column A "Descending" - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - calc.menuItem("Data->Sort...").select(); - SortPage_By1.select("Column B"); - SortPage_Ascending1.check(); - SortPage_By2.select("Column A"); - SortPage_Descending2.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Saved sorted result", expectedResultSortSecondByA, CalcUtil.getCellTexts("A1:B6")); - } -} --- src/testcase/sc/validity/AllowDateNotBetween.java (revision 1362802) +++ src/testcase/sc/validity/AllowDateNotBetween.java (working copy) @@ -1,158 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowDateNotBetween { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow not between Date type in Validity. - */ - @Test - public void testAllowDateNotBetween() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Date"); - SC_ValidityDecimalCompareOperator.select("not between"); - SC_ValiditySourceInput.setText("01/01/08"); - SC_ValidityMaxValueInput.setText("03/01/08"); - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorMessageTitle.setText("Stop to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("12/31/07"); - typeKeys(""); - assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("03/02/08"); - typeKeys(""); - assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.A3"); - SC_CellInput.activate(); - typeKeys("01/01/08"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A3")); - - CalcUtil.selectRange("Sheet1.A4"); - SC_CellInput.activate(); - typeKeys("03/01/08"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A4")); - - CalcUtil.selectRange("Sheet1.A5"); - SC_CellInput.activate(); - typeKeys("01/02/08"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A5")); - - CalcUtil.selectRange("Sheet1.B1"); - SC_CellInput.activate(); - typeKeys("02/29/08"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B1")); - - CalcUtil.selectRange("Sheet1.B2"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B2")); - - CalcUtil.selectRange("Sheet1.B3"); - SC_CellInput.activate(); - typeKeys("39448"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B3")); - - } - -} - --- src/testcase/sc/datapilot/SubtotalsFunctionInGroupedField.java (revision 1362802) +++ src/testcase/sc/datapilot/SubtotalsFunctionInGroupedField.java (working copy) @@ -1,214 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class SubtotalsFunctionInGroupedField { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - CalcUtil.selectRange("B4:C4"); - SpreadSheetCells.openContextMenu(); - menuItem("Group->Group Selected Items").select(); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellText("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - CalcUtil.selectRange("B3"); - SpreadSheetCells.openContextMenu(); - menuItem("Field Option...").select(); - DataPilotFieldOptionFiledSubtotalsPage.select(); - sleep(1); - - DataPilotFieldOptionSubTotalsManuallyRadioButton.check(); - - SC_DataPilotOptionSubtotalFunctionList.click(9,24); - sleep(1); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldOptionFieldTabPageDialog.ok(); - - assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4")); - assertEquals("5",CalcUtil.getCellText("C24")); - - assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4")); - assertEquals("2",CalcUtil.getCellText("E24")); - - assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4")); - assertEquals("9",CalcUtil.getCellText("H24")); - - assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4")); - assertEquals("1",CalcUtil.getCellText("J24")); - - assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4")); - assertEquals("2",CalcUtil.getCellText("L24")); - - assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4")); - assertEquals("4",CalcUtil.getCellText("N24")); - - assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4")); - assertEquals("3",CalcUtil.getCellText("P24")); - assertEquals("266773",CalcUtil.getCellText("Q24")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Emmy Ma",CalcUtil.getCellText("C4")); - assertEquals("20518",CalcUtil.getCellText("C24")); - - assertEquals("",CalcUtil.getCellText("E4")); - assertEquals("20528",CalcUtil.getCellText("E24")); - - assertEquals("Joe Liu",CalcUtil.getCellText("H4")); - assertEquals("41056",CalcUtil.getCellText("H24")); - - assertEquals("Total Result",CalcUtil.getCellText("J4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - - assertEquals("",CalcUtil.getCellText("L4")); - assertEquals("",CalcUtil.getCellText("L24")); - - assertEquals("",CalcUtil.getCellText("N4")); - assertEquals("",CalcUtil.getCellText("N24")); - - assertEquals("",CalcUtil.getCellText("P4")); - assertEquals("",CalcUtil.getCellText("P24")); - assertEquals("",CalcUtil.getCellText("Q24")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4")); - assertEquals("5",CalcUtil.getCellText("C24")); - - assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4")); - assertEquals("2",CalcUtil.getCellText("E24")); - - assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4")); - assertEquals("9",CalcUtil.getCellText("H24")); - - assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4")); - assertEquals("1",CalcUtil.getCellText("J24")); - - assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4")); - assertEquals("2",CalcUtil.getCellText("L24")); - - assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4")); - assertEquals("4",CalcUtil.getCellText("N24")); - - assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4")); - assertEquals("3",CalcUtil.getCellText("P24")); - assertEquals("266773",CalcUtil.getCellText("Q24")); - } - -} --- src/testcase/sc/datapilot/OneMRowDataPilotRefresh.java (revision 1362802) +++ src/testcase/sc/datapilot/OneMRowDataPilotRefresh.java (working copy) @@ -1,132 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - - -/** - * - * - */ -public class OneMRowDataPilotRefresh { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify the data pilot result table refresh after source data changed - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - calc.maximize(); - CalcUtil.selectRange("A1:E27"); - typeKeys("<$copy>"); - CalcUtil.selectRange("A1048540"); - typeKeys("<$paste>"); - calc.menuItem("Data->DataPilot->Start...").select(); - DataPilotTableToExistPlaceRadioButton.check(); - assertTrue(DataPilotTableToExistPlaceRadioButton.isChecked()); - DataPilotTableToExistPlaceEditBox.setText("$A.$F$1048540"); - CreateDataPilotTableDialog.ok(); - sleep(1); - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("F1048540")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("F1048542")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("F1048543")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("F1048542")); - assertEquals("266773",CalcUtil.getCellText("O1048562")); - sleep(1); - - CalcUtil.selectRange("D1048541"); - typeKeys("10000"); - sleep(1); - - CalcUtil.selectRange("O1048562"); - calc.menuItem("Data->DataPilot->Refresh").select(); - assertEquals("266525",CalcUtil.getCellText("O1048562")); - - } - -} --- src/testcase/sc/validity/FFCIgnoreBlank.java (revision 1362802) +++ src/testcase/sc/validity/FFCIgnoreBlank.java (working copy) @@ -1,97 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.fullPath; -import static testlib.AppUtil.initApp; -import static testlib.AppUtil.openStartcenter; -import static testlib.AppUtil.submitSaveDlg; -import static testlib.AppUtil.submitOpenDlg; -import static testlib.AppUtil.testFile; -import static testlib.UIMap.startcenter; -import static testlib.UIMap.*; - -import java.io.File; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - -import testlib.CalcUtil; -import testlib.Log; -import testlib.UIMap; - -public class FFCIgnoreBlank { - /** - * TestCapture helps us to doCalcUtil - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test open MS 2003 spreadsheet with ignore blank validity. - * - * @throws Exception - */ - @Test - public void testFFCNotIgnoreBlank() throws Exception{ - //open sample file - String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls"); - startcenter.menuItem("File->Open").select(); - submitOpenDlg(file); - - CalcUtil.selectRange("D5"); - SC_CellInput.activate(); - for(int i=1;i<=10;i++) - typeKeys(""); - typeKeys(""); - - assertEquals("",CalcUtil.getCellText("D5")); - } - - - -} --- src/testcase/sc/sort/SortDialogSetting.java (revision 1362802) +++ src/testcase/sc/sort/SortDialogSetting.java (working copy) @@ -28,55 +28,45 @@ import static testlib.AppUtil.*; import static testlib.UIMap.*; - import static org.junit.Assert.*; - +import static org.openoffice.test.vcl.Tester.*; +import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.openoffice.test.common.FileUtil; - import testlib.CalcUtil; import testlib.Log; /** - * + * Test Data->Sort dialog setting */ -public class RowsSortWithOptionsCaseSensitive { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ +public class SortDialogSetting { + @Rule public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ + @Before public void setUp() throws Exception { - initApp(); + app.start(); + + // Create a new spreadsheet document + startcenter.menuItem("File->New->Spreadsheet").select(); } - + + @After + public void tearDown() throws Exception { + app.close(); + } + /** - * Test rows sort with options setting: case sensitive + * Test sort with options setting: case sensitive * @throws Exception */ @Test - public void testRowsSortWithOptionsCaseSensitive() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - + public void testSortOptionsCaseSensitive() throws Exception{ + // Input some data: A1~A6: 1ColumnName,D,C,B,A,a String[][] data = new String[][] { {"D"}, @@ -95,23 +85,23 @@ CalcUtil.selectRange("A1"); typeKeys("1ColumnNameDCBAa"); CalcUtil.selectRange("A6"); - calc.menuItem("Format->Change Case->Lowercase").select(); // In case SC capitalize first letter automatically - + app.dispatch(".uno:ChangeCaseToLower"); // In case SC capitalize first letter automatically + // "Data->Sort...", choose "Ascending", check "Case sensitive" calc.menuItem("Data->Sort...").select(); SortOptionsPage.select(); SortOptionsPage_CaseSensitive.check(); SortOptionsPage.ok(); - + // Verify sorted result assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6")); - + // Uodo/redo calc.menuItem("Edit->Undo: Sort").select(); assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A2:A6")); calc.menuItem("Edit->Redo: Sort").select(); assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6")); - + // Save and close document String saveTo = fullPath("temp/" + "RowsSortWithOptionsCaseSensitive.ods"); calc.menuItem("File->Save As...").select(); @@ -119,11 +109,1052 @@ submitSaveDlg(saveTo); calc.menuItem("File->Close").select(); openStartcenter(); - + // Reopen and verify sorted result startcenter.menuItem("File->Open...").select(); submitOpenDlg(saveTo); calc.waitForExistence(10, 2); assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6")); } + + /** + * Test sort with options setting: copy sort result to + * @throws Exception + */ + @Ignore("Bug 119035") + public void testSortOptionsCopyResultTo() throws Exception{ + + // Input some data + // String[][] data = new String[][] { + // {"3", "D"}, + // {"5", "FLK"}, + // {"4", "E"}, + // {"2", "BC"}, + // {"6", "GE"}, + // {"1", "AB"}, + // }; + String[][] expectedSortedResult = new String[][] { + {"1", "AB"}, + {"2", "BC"}, + {"3", "D"}, + {"4", "E"}, + {"5", "FLK"}, + {"6", "GE"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("354261"); + CalcUtil.selectRange("B1"); + typeKeys("DFLKEBCGEAB"); + + // Data->Sort..., choose "Ascending", check "Copy sort results to:" + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_CopyResultTo.check(); + SortOptionsPage_CopyResultToEdit.setText("$Sheet3.$A4"); + SortOptionsPage.ok(); + + // Verify sorted result + assertArrayEquals("Copy sorted result to", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet3.$A4")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9")); + + // Move focus to sheet2 then select a cell range, Insert->Names->Define... + CalcUtil.selectRange("$Sheet2.$A1:$B3"); + calc.menuItem("Insert->Names->Define...").select(); + DefineNamesDlg_NameEdit.setText("cellRange"); + DefineNamesDlg.ok(); + + // Set focus to the original data, Data->Sort... + CalcUtil.selectRange("$Sheet1.$B1"); + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_CopyResultTo.check(); + SortOptionsPage_CopyResultToCellRange.select("cellRange"); + SortOptionsPage.ok(); + + // Verify sorted result + assertArrayEquals("Copy sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertEquals("Undo sorted result", "", CalcUtil.getCellText("$Sheet2.$A1")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6")); + + // Save and close document + String saveTo = fullPath("temp/" + "RowsSortWithOptionsCopyResultTo.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("$Sheet3.$A4:$B9")); + assertArrayEquals("Saved sorted result to cell range", expectedSortedResult, CalcUtil.getCellTexts("$Sheet2.$A1:$B6")); + } + + /** + * Test sort criteria: sort first by + * @throws Exception + */ + @Test + public void testSortCriteriaSortFirstBy() throws Exception{ + + // Input some data + String[][] data = new String[][] { + {"3", "D"}, + {"5", "FLK"}, + {"4", "E"}, + {"2", "BC"}, + {"6", "GE"}, + {"1", "AB"}, + }; + String[][] expectedResultSortByColumnBAscending = new String[][] { + {"1", "AB"}, + {"2", "BC"}, + {"3", "D"}, + {"4", "E"}, + {"5", "FLK"}, + {"6", "GE"}, + }; + String[][] expectedResultSortByColumnADescending = new String[][] { + {"6", "GE"}, + {"5", "FLK"}, + {"4", "E"}, + {"3", "D"}, + {"2", "BC"}, + {"1", "AB"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("354261"); + CalcUtil.selectRange("B1"); + typeKeys("DFLKEBCGEAB"); + + // "Data->Sort...", choose "Ascending", sort first by Column B + calc.menuItem("Data->Sort...").select(); + SortPage_Ascending1.check(); + SortPage_By1.select("Column B"); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6")); + calc.menuItem("Edit->Undo: Sort").select(); + + // Save and close document + String saveTo = fullPath("temp/" + "SortCriteriaSortFirstBy.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen, "Data->Sort...", choose "Descending", sort first by Column A + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + calc.menuItem("Data->Sort...").select(); + SortPage_Descending1.check(); + SortPage_By1.select("Column A"); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Saved sorted result", expectedResultSortByColumnADescending, CalcUtil.getCellTexts("A1:B6")); + } + + /** + * Test sort criteria: sort second by + * @throws Exception + */ + @Test + public void testSortCriteriaSortSecondBy() throws Exception{ + + // Input some data + String[][] data = new String[][] { + {"3", "D"}, + {"5", "FLK"}, + {"4", "E"}, + {"1", "AB"}, + {"6", "GE"}, + {"2", "AB"}, + }; + String[][] expectedResultSortFirstByB = new String[][] { + {"1", "AB"}, + {"2", "AB"}, + {"3", "D"}, + {"4", "E"}, + {"5", "FLK"}, + {"6", "GE"}, + }; + String[][] expectedResultSortSecondByA= new String[][] { + {"2", "AB"}, + {"1", "AB"}, + {"3", "D"}, + {"4", "E"}, + {"5", "FLK"}, + {"6", "GE"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("354162"); + CalcUtil.selectRange("B1"); + typeKeys("DFLKEABGEAB"); + + // "Data->Sort...", choose "Ascending", sort first by Column B + calc.menuItem("Data->Sort...").select(); + SortPage_Ascending1.check(); + SortPage_By1.select("Column B"); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:B6")); + calc.menuItem("Edit->Undo: Sort").select(); + + // Save and close document + String saveTo = fullPath("temp/" + "SortCriteriaSortSecondBy.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column A "Descending" + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + calc.menuItem("Data->Sort...").select(); + SortPage_By1.select("Column B"); + SortPage_Ascending1.check(); + SortPage_By2.select("Column A"); + SortPage_Descending2.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Saved sorted result", expectedResultSortSecondByA, CalcUtil.getCellTexts("A1:B6")); + } + + /** + * Test sort criteria: sort third by + * @throws Exception + */ + @Test + public void testSortCriteriaSortThirdBy() throws Exception{ + + // Input some data + String[][] data = new String[][] { + {"3", "AB", "2"}, + {"8", "FLK", "5"}, + {"6", "E", "4"}, + {"1", "AB", "1"}, + {"9", "GE", "6"}, + {"2", "AB", "2"}, + {"7", "EFYU", "7"}, + {"5", "DS", "8"}, + {"4", "AB", "1"}, + }; + String[][] expectedResultSortFirstByB = new String[][] { + {"3", "AB", "2"}, + {"1", "AB", "1"}, + {"2", "AB", "2"}, + {"4", "AB", "1"}, + {"5", "DS", "8"}, + {"6", "E", "4"}, + {"7", "EFYU", "7"}, + {"8", "FLK", "5"}, + {"9", "GE", "6"}, + }; + String[][] expectedResultSortSecondByC= new String[][] { + {"3", "AB", "2"}, + {"2", "AB", "2"}, + {"1", "AB", "1"}, + {"4", "AB", "1"}, + {"5", "DS", "8"}, + {"6", "E", "4"}, + {"7", "EFYU", "7"}, + {"8", "FLK", "5"}, + {"9", "GE", "6"}, + }; + String[][] expectedResultSortThirdByA= new String[][] { + {"3", "AB", "2"}, + {"2", "AB", "2"}, + {"4", "AB", "1"}, + {"1", "AB", "1"}, + {"5", "DS", "8"}, + {"6", "E", "4"}, + {"7", "EFYU", "7"}, + {"8", "FLK", "5"}, + {"9", "GE", "6"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("386192754"); + CalcUtil.selectRange("B1"); + typeKeys("ABFLKEABGEABEFYUDSAB"); + CalcUtil.selectRange("C1"); + typeKeys("254162781"); + sleep(0.5); + + // "Data->Sort...", choose "Ascending", sort first by Column B + calc.menuItem("Data->Sort...").select(); + SortPage_By1.select("Column B"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:C9")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9")); + calc.menuItem("Edit->Undo: Sort").select(); + + // Save and close document + String saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending" + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + calc.menuItem("Data->Sort...").select(); + SortPage_By1.select("Column B"); + SortPage_Ascending1.check(); + SortPage_By2.select("Column C"); + SortPage_Descending2.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9")); + + // "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending", sort third by Column A "Descending" + calc.menuItem("Data->Sort...").select(); + SortPage_By1.select("Column B"); + SortPage_Ascending1.check(); + SortPage_By2.select("Column C"); + SortPage_Descending2.check(); + SortPage_By3.select("Column A"); + SortPage_Descending3.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9")); + + // Save and close document + saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy1.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify data sort is not lost + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Saved sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9")); + } + + /** + * Test sort options: custom sort order, predefined in preferences from copy list + * @throws Exception + */ + @Test + public void testSortOptionsCustomSortOrderPredefineFromCopyList() throws Exception{ + + // Dependencies start + CalcUtil.selectRange("A1"); + typeKeys("redyellowbluegreenwhiteblack"); + CalcUtil.selectRange("A1:A6"); + app.dispatch(".uno:ChangeCaseToLower"); // In case SC capitalize first letter automatically + + // Select the cell range, "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists" + CalcUtil.selectRange("A1:A6"); + app.dispatch(".uno:OptionsTreeDialog"); + // Select "Sort Lists": start. Shrink the tree list and select + OptionsDlgList.select(0); + typeKeys(""); + for (int i=0; i<6; i++) { + typeKeys(""); + } + OptionsDlgList.select(3); + typeKeys(""); + OptionsDlgList.select(7); + // Select "Sort Lists": end + + // Click "Copy" button, "OK", close the document + OptionsDlg_SortListsTabCopy.click(); + OptionsDlg.ok(); + calc.menuItem("File->Close").select(); + MsgBox_AdditionalRowsNotSaved.no(); + // Dependencies end + + // Create a new spreadsheet document + startcenter.menuItem("File->New->Spreadsheet").select(); + + // Input some data + String[][] data = new String[][] { + {"Color"}, + {"black"}, + {"yellow"}, + {"blue"}, + {"black"}, + {"white"}, + {"red"}, + }; + String[][] expectedResultNoCustomSortOrder = new String[][] { + {"Color"}, + {"black"}, + {"black"}, + {"blue"}, + {"red"}, + {"white"}, + {"yellow"}, + }; + String[][] expectedResultCustomSortOrder = new String[][] { + {"Color"}, + {"red"}, + {"yellow"}, + {"blue"}, + {"white"}, + {"black"}, + {"black"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("Colorblackyellowblueblackwhitered"); + CalcUtil.selectRange("A2:A7"); + app.dispatch(".uno:ChangeCaseToLower"); // In case SC capitalize first letter automatically + + // "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color + CalcUtil.selectRange("A1:A7"); + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_CustomSortOrder.uncheck(); + SortPage.select(); + SortPage_By1.select("Color"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Undo: Sort").select(); + + // Copy original data to sheet2 + CalcUtil.selectRange("A1:A7"); + calc.menuItem("Edit->Copy").select(); + CalcUtil.selectRange("Sheet2.A1"); + calc.menuItem("Edit->Paste").select(); + + // "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_CustomSortOrder.check(); + SortOptionsPage_CustomSortOrderList.select("red,yellow,blue,green,white,black"); + SortPage.select(); + SortPage_By1.select("Color"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + + // Save and close document + String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromCopyList.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7")); + assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7")); + } + + /** + * Test sort options: custom sort order, predefined in preferences from new list + * @throws Exception + */ + @Test + public void testSortOptionsCustomSortOrderPredefineFromNewList() throws Exception{ + + // Dependencies start + // "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists" + app.dispatch(".uno:OptionsTreeDialog"); + // Select "Sort Lists": start. Shrink the tree list and select + OptionsDlgList.select(0); + typeKeys(""); + for (int i=0; i<6; i++) { + typeKeys(""); + } + OptionsDlgList.select(3); + typeKeys(""); + OptionsDlgList.select(7); + // Select "Sort Lists": end + + // Click "New" button, input "white,red,yellow,blue,green,black", press "Add" and "OK", close the document + OptionsDlg_SortListsTabNew.click(); + typeKeys("white,red,yellow,blue,green,black"); + OptionsDlg_SortListsTabAdd.click(); + sleep(0.5); + OptionsDlg.ok(); + calc.menuItem("File->Close").select(); + // Dependencies end + + // Create a new spreadsheet document + startcenter.menuItem("File->New->Spreadsheet").select(); + sleep(3); + + // Input some data + String[][] data = new String[][] { + {"Color"}, + {"black"}, + {"yellow"}, + {"blue"}, + {"black"}, + {"white"}, + {"red"}, + }; + String[][] expectedResultNoCustomSortOrder = new String[][] { + {"Color"}, + {"black"}, + {"black"}, + {"blue"}, + {"red"}, + {"white"}, + {"yellow"}, + }; + String[][] expectedResultCustomSortOrder = new String[][] { + {"Color"}, + {"white"}, + {"red"}, + {"yellow"}, + {"blue"}, + {"black"}, + {"black"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("Colorblackyellowblueblackwhitered"); + CalcUtil.selectRange("A2:A7"); + app.dispatch(".uno:ChangeCaseToLower"); // In case SC capitalize first letter automatically + + // "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color + CalcUtil.selectRange("A1:A7"); + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_CustomSortOrder.uncheck(); + SortPage.select(); + SortPage_By1.select("Color"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Undo: Sort").select(); + + // Copy original data to sheet2 + CalcUtil.selectRange("A1:A7"); + calc.menuItem("Edit->Copy").select(); + CalcUtil.selectRange("Sheet2.A1"); + calc.menuItem("Edit->Paste").select(); + + // "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_CustomSortOrder.check(); + SortOptionsPage_CustomSortOrderList.select("white,red,yellow,blue,green,black"); + SortPage.select(); + SortPage_By1.select("Color"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); + + // Save and close document + String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromNewList.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7")); + assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7")); + } + + /** + * Test sort options: sort columns, direction "Left to right" + * @throws Exception + */ + @Test + public void testSortOptionsDirectionSortColumns() throws Exception{ + + // Input some data + String[][] data = new String[][] { + {"Units", "7", "27", "4", "12", "3", "6"}, + }; + String[][] expectedSortedResult = new String[][] { + {"Units", "3", "4", "6", "7", "12", "27"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("Units72741236"); + + // "Data->Sort...", check "Range contains column labels", "Left to right", sort first by"Units", "Ascending" + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_LeftToRight.check(); + SortPage.select(); + SortPage_By1.select("Units"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:G1")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1")); + + // Save and close document + String saveTo = fullPath("temp/" + "SortOptionsDirectionSortColumns.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1")); + } + + /** + * Test sort options: "Include formats" + * @throws Exception + */ + @Test + public void testSortOptionsIncludeFormats() throws Exception{ + + // Create a new spreadsheet document + + String[][] dataWithCurrencyFormats = new String[][] { + {"Units"}, + {"$32.00"}, + {"57.00 \u20ac"}, + {"\u20a4 74"}, + {"R$ 50.00"}, + {"\u062c.\u0645. 27"}, + {"7.00 \u0440\u0443\u0431"}, + }; + String[][] expectedSortedResultIncludeFormat = new String[][] { + {"Units"}, + {"7.00 \u0440\u0443\u0431"}, + {"\u062c.\u0645. 27"}, + {"$32.00"}, + {"R$ 50.00"}, + {"57.00 \u20ac"}, + {"\u20a4 74"}, + }; + String[][] expectedSortedResultExcludeFormat = new String[][] { + {"Units"}, + {"$7.00"}, + {"27.00 \u20ac"}, + {"\u20a4 32"}, + {"R$ 50.00"}, + {"\u062c.\u0645. 57"}, + {"74.00 \u0440\u0443\u0431"}, + }; + + // Input source data + String file = testFile("sc/SortOptionsIncludeFormats.ods"); + // String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls"); + app.dispatch(".uno:Open", 3); + submitOpenDlg(file); + calc.waitForExistence(10, 2); + + assertArrayEquals("source", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7")); + + // CalcUtil.selectRange("A1"); + // typeKeys("Units$32.0057.00 \u20ac\u20a4 74R$ 50.00\u062c.\u0645. 27.007.00 \u0440\u0443\u0431."); + + // // Set Currency formats + // CalcUtil.selectRange("A2"); + // typeKeys(""); + //// calc.menuItem("Fortmat->Cells...").select(); error: can not find item "Format" + // FormatCellsDlg_NumbersPage.select(); + // FormatCellsDlg_NumbersPageCategory.select("Currency"); + // FormatCellsDlg_NumbersPageCurrencyFormat.select("$ English (USA)"); + // FormatCellsDlg_NumbersPage.ok(); + // CalcUtil.selectRange("A3"); + // typeKeys(""); + // FormatCellsDlg_NumbersPage.select(); + // FormatCellsDlg_NumbersPageCategory.select("Currency"); + // FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20ac Spanish (Spain)"); + // FormatCellsDlg_NumbersPage.ok(); + // CalcUtil.selectRange("A4"); + // typeKeys(""); + // FormatCellsDlg_NumbersPage.select(); + // FormatCellsDlg_NumbersPageCategory.select("Currency"); + // FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20a4 Latin"); + // FormatCellsDlg_NumbersPage.ok(); + // CalcUtil.selectRange("A5"); + // typeKeys(""); + // FormatCellsDlg_NumbersPage.select(); + // FormatCellsDlg_NumbersPageCategory.select("Currency"); + // FormatCellsDlg_NumbersPageCurrencyFormat.select("R$ Portuguese (Brazil)"); + // FormatCellsDlg_NumbersPage.ok(); + // CalcUtil.selectRange("A6"); + // typeKeys(""); + // FormatCellsDlg_NumbersPage.select(); + // FormatCellsDlg_NumbersPageCategory.select("Currency"); + // FormatCellsDlg_NumbersPageCurrencyFormat.select("\u062c.\u0645. Arabic (Egypt)"); + // FormatCellsDlg_NumbersPage.ok(); + // CalcUtil.selectRange("A7"); + // typeKeys(""); + // FormatCellsDlg_NumbersPage.select(); + // FormatCellsDlg_NumbersPageCategory.select("Currency"); + // FormatCellsDlg_NumbersPageCurrencyFormat.select("\u0440\u0443\u0431. Russian"); + // FormatCellsDlg_NumbersPage.ok(); + + // "Data->Sort...", check "Range contains column labels", check "Include formats", sort first by "Units", "Ascending" + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_IncludeFormats.check(); + SortPage.select(); + SortPage_By1.select("Units"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result include formats", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Undo: Sort").select(); + + // Copy the original data to sheet2 + CalcUtil.selectRange("A1:A7"); + calc.menuItem("Edit->Copy").select(); + CalcUtil.selectRange("Sheet2.A1"); + calc.menuItem("Edit->Paste").select(); + + // "Data->Sort...", check "Range contains column labels", uncheck "Include formats", sort first by "Units", "Ascending" + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_IncludeFormats.uncheck(); + SortPage.select(); + SortPage_By1.select("Units"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result exclude formats", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7")); + + // Save and close document + String saveTo = fullPath("temp/" + "SortOptionsIncludeFormats.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Original data", dataWithCurrencyFormats, CalcUtil.getCellTexts("$Sheet1.$A1:$A7")); + assertArrayEquals("Saved sorted result exclude format", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("$Sheet2.$A1:$A7")); + } + + /** + * Test sort options: multiple sort, data overlap + * @throws Exception + */ + @Test + public void testSortOptionsMultipleSortDataOverlap() throws Exception{ + + // Input some data + String[][] data1 = new String[][] { + {"D"}, + {"C"}, + {"B"}, + {"A"}, + {"E"}, + }; + String[][] expectedSortedResult1 = new String[][] { + {"A"}, + {"B"}, + {"C"}, + {"D"}, + {"E"}, + }; + String[][] data2 = new String[][] { + {"4"}, + {"2"}, + {"5"}, + {"1"}, + {"3"}, + }; + String[][] expectedSortedResultDataOverlap = new String[][] { + {"A"}, + {"B"}, + {"C"}, + {"1"}, + {"2"}, + {"3"}, + {"4"}, + {"5"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("DCBAE"); + + // "Data->Sort...", uncheck "Range contains column labels", sort first by "Column A", "Ascending" + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.uncheck(); + SortPage.select(); + SortPage_By1.select("Column A"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); + + // Input data2 into same sheet, data1 and data2 are not overlapped + CalcUtil.selectRange("G10"); + typeKeys("42513"); + + // Focus on data2, "Data->Sort...", "Copy result to" partially overlap with data1, sort first by "Column G", "Ascending" + CalcUtil.selectRange("G10"); + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.uncheck(); + SortOptionsPage_CopyResultTo.check(); + SortOptionsPage_CopyResultToEdit.setText("A4"); + SortPage.select(); + SortPage_By1.select("Column G"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result data overlap", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8")); + + // Save and close document + String saveTo = fullPath("temp/" + "SortOptionsMultipleSortDataOverlap.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Saved sorted result", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8")); + assertArrayEquals("Original data2", data2, CalcUtil.getCellTexts("G10:G14")); + } + + /** + * Test sort options: multiple sort, no data overlap, sort parameter saved correctly + * @throws Exception + */ + @Test + public void testSortOptionsMultipleSortSortParameterSaved() throws Exception{ + + // Input some data + String[][] data1 = new String[][] { + {"D"}, + {"C"}, + {"B"}, + {"A"}, + {"E"}, + }; + String[][] expectedSortedResult1 = new String[][] { + {"A"}, + {"B"}, + {"C"}, + {"D"}, + {"E"}, + }; + String[][] data2 = new String[][] { + {"Numbers"}, + {"4"}, + {"2"}, + {"5"}, + {"1"}, + {"3"}, + }; + String[][] expectedSortedResult2 = new String[][] { + {"Numbers"}, + {"1"}, + {"2"}, + {"3"}, + {"4"}, + {"5"}, + }; + CalcUtil.selectRange("A1"); + typeKeys("DCBAE"); + + // "Data->Sort...", uncheck "Range contains column labels", check "Case sensitive" and "Include formats", sort first by "Column A", "Ascending" + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.uncheck(); + SortOptionsPage_CaseSensitive.check(); + SortOptionsPage_IncludeFormats.check(); + SortPage.select(); + SortPage_By1.select("Column A"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); + + // Input data2 into same sheet, data1 and data2 are not overlapped + CalcUtil.selectRange("G10"); + typeKeys("Numbers42513"); + + // Focus on data2, "Data->Sort...", check "Range contains column labels", uncheck "Case sensitive" and "Include formats", sort first by "Numbers", "Ascending" + CalcUtil.selectRange("G10"); + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + SortOptionsPage_RangeContainsColumnLabels.check(); + SortOptionsPage_CaseSensitive.uncheck(); + SortOptionsPage_IncludeFormats.uncheck(); + SortPage.select(); + SortPage_By1.select("Numbers"); + SortPage_Ascending1.check(); + SortPage.ok(); + + // Verify sorted result + assertArrayEquals("Sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15")); + + // Uodo/redo + calc.menuItem("Edit->Undo: Sort").select(); + assertArrayEquals("Undo sorted result", data2, CalcUtil.getCellTexts("G10:G15")); + calc.menuItem("Edit->Redo: Sort").select(); + assertArrayEquals("Redo sorted result", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15")); + + // Open sort dialog, check its setting + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked()); + assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked()); + assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked()); + SortOptionsPage.ok(); + + // Save and close document + String saveTo = fullPath("temp/" + "SortOptionsMultipleSortParameterSaved.ods"); + calc.menuItem("File->Save As...").select(); + FileUtil.deleteFile(saveTo); + submitSaveDlg(saveTo); + calc.menuItem("File->Close").select(); + openStartcenter(); + + // Reopen and verify sorted result and sort parameters + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(saveTo); + calc.waitForExistence(10, 2); + assertArrayEquals("Saved sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); + assertArrayEquals("Saved sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15")); + calc.menuItem("Data->Sort...").select(); + SortOptionsPage.select(); + assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked()); + assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked()); + assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked()); + SortOptionsPage.ok(); + } + } --- src/testcase/sc/datapilot/RenameFieldAutoUpdate.java (revision 1362802) +++ src/testcase/sc/datapilot/RenameFieldAutoUpdate.java (working copy) @@ -1,186 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class RenameFieldAutoUpdate { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while rename fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - DataPilotPanePageArea.click(1,1); - DataPilotPanePageArea.openContextMenu(); - menuItem("Field Option").select(); - DataPilotFieldDisplayNameEditBox.setText("New Locale"); - DataPilotFieldOptionFieldTabPageDialog.ok(); - assertEquals("New Locale",CalcUtil.getCellText("A1")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("New Locale",CalcUtil.getCellText("A1")); - sleep(1); - - CalcUtil.selectRange("B3"); - SpreadSheetCells.openContextMenu(); - menuItem("Field Option...").select(); - DataPilotFieldDisplayNameEditBox.setText("New Name"); - DataPilotFieldOptionFieldTabPageDialog.ok(); - assertEquals("New Name",CalcUtil.getCellText("B3")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Name",CalcUtil.getCellText("B3")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("New Name",CalcUtil.getCellText("B3")); - sleep(1); - - CalcUtil.selectRange("A4"); - SpreadSheetCells.openContextMenu(); - menuItem("Field Option...").select(); - DataPilotFieldDisplayNameEditBox.setText("New Date"); - DataPilotFieldOptionFieldTabPageDialog.ok(); - assertEquals("New Date",CalcUtil.getCellText("A4")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("New Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPiloPaneDataArea.openContextMenu(); - menuItem("Field Option").select(); - DataPilotFieldDisplayNameEditBox.setText("New Sum - Order Number"); - DataPilotFieldOptionFieldTabPageDialog.ok(); - assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3")); - sleep(1); - - } - -} --- src/testcase/sc/validity/ValidityUIErrorAlert.java (revision 1362802) +++ src/testcase/sc/validity/ValidityUIErrorAlert.java (working copy) @@ -1,86 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class ValidityUIErrorAlert { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Data -> Validity - UI(Error Alert: Default status) - */ - @Test - public void testValidityUIErrorAlert() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityErrorAlertTabPage.select(); - assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled()); - assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText()); - assertEquals(true,SC_ValidityErrorMessageTitle.isEnabled()); - assertEquals("",SC_ValidityErrorMessageTitle.getText()); - assertEquals(true,SC_ValidityErrorMessage.isEnabled()); - assertEquals("",SC_ValidityErrorMessage.getText()); - SC_ValidityErrorAlertActionList.select("Macro"); - assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled()); - - } - -} - --- src/testcase/sc/sort/SortOptionsDirectionSortColumns.java (revision 1362802) +++ src/testcase/sc/sort/SortOptionsDirectionSortColumns.java (working copy) @@ -1,125 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortOptionsDirectionSortColumns { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort options: sort columns, direction "Left to right" - * @throws Exception - */ - @Test - public void testSortOptionsDirectionSortColumns() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"Units", "7", "27", "4", "12", "3", "6"}, - }; - String[][] expectedSortedResult = new String[][] { - {"Units", "3", "4", "6", "7", "12", "27"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("Units72741236"); - - // "Data->Sort...", check "Range contains column labels", "Left to right", sort first by"Units", "Ascending" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_LeftToRight.check(); - SortPage.select(); - SortPage_By1.select("Units"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:G1")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1")); - - // Save and close document - String saveTo = fullPath("temp/" + "SortOptionsDirectionSortColumns.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A1:G1")); - } -} --- src/testcase/sc/validity/ValiditySampleFile.java (revision 1362802) +++ src/testcase/sc/validity/ValiditySampleFile.java (working copy) @@ -23,75 +23,94 @@ package testcase.sc.validity; -import static testlib.AppUtil.fullPath; -import static testlib.AppUtil.initApp; -import static testlib.AppUtil.openStartcenter; -import static testlib.AppUtil.submitSaveDlg; import static testlib.AppUtil.submitOpenDlg; import static testlib.AppUtil.testFile; -import static testlib.UIMap.startcenter; +import static testlib.AppUtil.typeKeys; import static testlib.UIMap.*; - -import java.io.File; - import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; import static org.openoffice.test.vcl.Tester.typeKeys; - +import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - import testlib.CalcUtil; import testlib.Log; -import testlib.UIMap; -public class FFCIgnoreBlank { - /** - * TestCapture helps us to doCalcUtil - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ +public class ValiditySampleFile { + @Rule public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ + @Before public void setUp() throws Exception { - initApp(); + app.start(); } - + + @After + public void tearDown() throws Exception { + app.close(); + } + /** * Test open MS 2003 spreadsheet with ignore blank validity. * * @throws Exception */ @Test - public void testFFCNotIgnoreBlank() throws Exception{ - //open sample file + public void testFFCIgnoreBlank() throws Exception{ + // Open sample file String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls"); - startcenter.menuItem("File->Open").select(); + app.dispatch(".uno:Open", 3); submitOpenDlg(file); - + calc.waitForExistence(10, 2); + CalcUtil.selectRange("D5"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); for(int i=1;i<=10;i++) - typeKeys(""); + typeKeys(""); typeKeys(""); - + assertEquals("",CalcUtil.getCellText("D5")); } - - + /** + * Test open MS 2003 spreadsheet with ignore blank validity. + * + * @throws Exception + */ + @Test + public void testFFCNotIgnoreBlank() throws Exception{ + //open sample file + String file = testFile("sc/FFC252FFCSC_XML_Datarange0205.xls"); + app.dispatch(".uno:Open", 3); + submitOpenDlg(file); + calc.waitForExistence(10, 2); + + CalcUtil.selectRange("F5"); + SC_InputBar_Input.activate(); + typeKeys(""); + + assertEquals("Invalid value.",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("8",CalcUtil.getCellText("F5")); + } + + /** + * test Cell is not locked after switch from validity cell to source cells + */ + @Test + public void testNotLockCellFromValidityCell() { + //open sample file on data path + String file = testFile("sc/sampledata.ods"); + app.dispatch(".uno:Open", 3); + submitOpenDlg(file); + calc.waitForExistence(10, 2); + + CalcUtil.selectRange("Sheet1.F19"); + typeKeys("d"); + CalcUtil.selectRange("Sheet1.F17"); + typeKeys("Test"); + + assertEquals("Test",CalcUtil.getCellText("F17")); + } } --- src/testcase/sc/validity/ValidityDialogSetting.java (revision 1362802) +++ src/testcase/sc/validity/ValidityDialogSetting.java (working copy) @@ -34,51 +34,42 @@ import org.junit.Before; import org.junit.Rule; +import org.junit.Ignore; import org.junit.Test; import org.openoffice.test.vcl.IDList; import org.openoffice.test.vcl.widgets.VclMessageBox; - import testlib.CalcUtil; import testlib.Log; -public class AllowDateNotBetween { +public class ValidityDialogSetting { private static IDList idList = new IDList(new File("./ids")); public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ + @Rule public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ + @Before public void setUp() throws Exception { - initApp(); + app.start(); + + // New a spreadsheet, select cell range, open Validity dialog + startcenter.menuItem("File->New->Spreadsheet").select(); + CalcUtil.selectRange("Sheet1.A1:C5"); + calc.menuItem("Data->Validity...").select(); } - + + @After + public void tearDown() throws Exception { + app.close(); + } + /** * test Allow not between Date type in Validity. */ @Test public void testAllowDateNotBetween() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); SC_ValidityCriteriaTabpage.select(); SC_ValidityCriteriaAllowList.select("Date"); SC_ValidityDecimalCompareOperator.select("not between"); @@ -88,24 +79,22 @@ SC_ValidityShowErrorMessage.check(); SC_ValidityErrorMessageTitle.setText("Stop to enter"); SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - + SC_ValidityErrorAlertTabPage.ok(); + CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("12/31/07"); typeKeys(""); assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1")); - + CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("03/02/08"); typeKeys(""); assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2")); - + CalcUtil.selectRange("Sheet1.A3"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("01/01/08"); typeKeys(""); assertEquals("Invalid value",ActiveMsgBox.getMessage()); @@ -113,7 +102,7 @@ assertEquals("",CalcUtil.getCellText("Sheet1.A3")); CalcUtil.selectRange("Sheet1.A4"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("03/01/08"); typeKeys(""); assertEquals("Invalid value",ActiveMsgBox.getMessage()); @@ -121,38 +110,530 @@ assertEquals("",CalcUtil.getCellText("Sheet1.A4")); CalcUtil.selectRange("Sheet1.A5"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("01/02/08"); typeKeys(""); assertEquals("Invalid value",ActiveMsgBox.getMessage()); ActiveMsgBox.ok(); assertEquals("",CalcUtil.getCellText("Sheet1.A5")); - + CalcUtil.selectRange("Sheet1.B1"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("02/29/08"); typeKeys(""); assertEquals("Invalid value",ActiveMsgBox.getMessage()); ActiveMsgBox.ok(); assertEquals("",CalcUtil.getCellText("Sheet1.B1")); - + CalcUtil.selectRange("Sheet1.B2"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("test"); typeKeys(""); assertEquals("Invalid value",ActiveMsgBox.getMessage()); ActiveMsgBox.ok(); assertEquals("",CalcUtil.getCellText("Sheet1.B2")); - + CalcUtil.selectRange("Sheet1.B3"); - SC_CellInput.activate(); + SC_InputBar_Input.activate(); typeKeys("39448"); typeKeys(""); assertEquals("Invalid value",ActiveMsgBox.getMessage()); ActiveMsgBox.ok(); assertEquals("",CalcUtil.getCellText("Sheet1.B3")); - - } + } + /** + * test Allow Decimal equal in Validity. + */ + @Test + public void testAllowDecimalEqual() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Decimal"); + SC_ValidityDecimalCompareOperator.select("equal"); + SC_ValiditySourceInput.setText("0.33333333"); + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorMessageTitle.setText("Stop to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("0.33333333"); + typeKeys(""); + assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("=1/3"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A3"); + SC_InputBar_Input.activate(); + typeKeys("0.3"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A3")); + + CalcUtil.selectRange("Sheet1.A4"); + SC_InputBar_Input.activate(); + typeKeys("0.333333333"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A4")); + + CalcUtil.selectRange("Sheet1.B2"); + SC_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B2")); + } + + /** + * test Allow Text length, greater than or equal to in Validity. + */ + @Test + public void testAllowGreaterTextLength() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Text length"); + SC_ValidityDecimalCompareOperator.select("greater than or equal to"); + SC_ValiditySourceInput.setText("10"); + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorMessageTitle.setText("Stop to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("testtesttesttest"); + typeKeys(""); + assertEquals("testtesttesttest",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("test test "); + typeKeys(""); + assertEquals("test test ",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A4"); + SC_InputBar_Input.activate(); + typeKeys(" "); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A4")); + + CalcUtil.selectRange("Sheet1.A3"); + SC_InputBar_Input.activate(); + typeKeys("Testatest"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A3")); + } + + /** + * test Allow Text length, less than in Validity. + */ + @Ignore("Bug 93128") + public void testAllowLessThanTextLength() { + + calc.menuItem("Data->Validity...").select(); + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Text length"); + SC_ValidityDecimalCompareOperator.select("less than"); + SC_ValiditySourceInput.setText("10"); + + SC_ValidityInputHelpTabPage.select(); + SC_ValidityInputHelpCheckbox.check(); + SC_ValidityInputHelpTitle.setText("Help Info Title"); + SC_ValidityHelpMessage.setText("help info"); + + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorAlertActionList.select("Information"); + SC_ValidityErrorMessageTitle.setText("Notes to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("testtesttesttest"); + ActiveMsgBox.ok(); + assertEquals("testtesttesttest",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("sfsafsddddddd"); + ActiveMsgBox.cancel(); + assertEquals("",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("10"); + assertEquals("10",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A3"); + SC_InputBar_Input.activate(); + typeKeys("ok"); + assertEquals("ok",CalcUtil.getCellText("Sheet1.A3")); + } + + /** + * test Allow list. + */ + @Test + public void testAllowListSpecialChar() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("List"); + SC_ValidityEntries.focus(); + typeKeys("a"); + typeKeys(""); + typeKeys("b"); + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorMessageTitle.setText("Stop to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaTabpage.ok(); + + calc.rightClick(1, 1); + typeKeys(""); + typeKeys(""); // Choose a + assertEquals("a",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.B2"); + SC_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B2")); + } + + /** + * test Allow time between in Validity. + */ + @Test + public void testAllowTimeBetween() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Time"); + SC_ValidityDecimalCompareOperator.select("between"); + SC_ValiditySourceInput.setText("27:00"); + SC_ValidityMaxValueInput.setText("21:00"); + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorMessageTitle.setText("Stop to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("21:00"); + typeKeys(""); + assertEquals("09:00:00 PM",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("27:00"); + typeKeys(""); + assertEquals("27:00:00",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A3"); + SC_InputBar_Input.activate(); + typeKeys("1.125"); + typeKeys(""); + assertEquals("1.125",CalcUtil.getCellText("Sheet1.A3")); + + CalcUtil.selectRange("Sheet1.A4"); + SC_InputBar_Input.activate(); + typeKeys("0.875"); + typeKeys(""); + assertEquals("0.875",CalcUtil.getCellText("Sheet1.A4")); + + CalcUtil.selectRange("Sheet1.B1"); + SC_InputBar_Input.activate(); + typeKeys("03:00:01"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B1")); + + CalcUtil.selectRange("Sheet1.B2"); + SC_InputBar_Input.activate(); + typeKeys("20:59:59"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B2")); + + CalcUtil.selectRange("Sheet1.B3"); + SC_InputBar_Input.activate(); + typeKeys("1.126"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B3")); + + CalcUtil.selectRange("Sheet1.B4"); + SC_InputBar_Input.activate(); + typeKeys("0.874"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B4")); + + CalcUtil.selectRange("Sheet1.C1"); + SC_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.C1")); + + CalcUtil.selectRange("Sheet1.C2"); + SC_InputBar_Input.activate(); + typeKeys("24:00"); + typeKeys(""); + assertEquals("24:00:00",CalcUtil.getCellText("Sheet1.C2")); + + CalcUtil.selectRange("Sheet1.C3"); + SC_InputBar_Input.activate(); + typeKeys("12:00"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.C3")); + } + + /** + * test Allow time Greater than and equal to in Validity. + */ + @Test + public void testAllowTimeGreaterThan() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Time"); + SC_ValidityDecimalCompareOperator.select("greater than or equal to"); + SC_ValiditySourceInput.setText("8:00"); + + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorAlertActionList.select("Warning"); + + SC_ValidityErrorMessageTitle.setText("warning to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("7:30"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("07:30:00 AM",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("6:00"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.cancel(); + assertEquals("",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A3"); + SC_InputBar_Input.activate(); + typeKeys("8:00"); + typeKeys(""); + assertEquals("08:00:00 AM",CalcUtil.getCellText("Sheet1.A3")); + } + + /** + * test Allow whole number, less than or equal to in Validity. + */ + @Test + public void testAllowWholeNumLessThan() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Whole Numbers"); + SC_ValidityDecimalCompareOperator.select("less than or equal"); + SC_ValiditySourceInput.setText("100"); + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorMessageTitle.setText("Stop to enter"); + SC_ValidityErrorMessage.setText("Invalid value"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("99"); + typeKeys(""); + assertEquals("99",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("100"); + typeKeys(""); + assertEquals("100",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.B1"); + SC_InputBar_Input.activate(); + typeKeys("101"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B1")); + + CalcUtil.selectRange("Sheet1.B2"); + SC_InputBar_Input.activate(); + typeKeys("45.5"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B2")); + + CalcUtil.selectRange("Sheet1.C1"); + SC_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.C1")); + } + + /** + * test default message of Error Alert in Validity. + */ + @Test + public void testDefaultErrorAlertMessage() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Decimal"); + SC_ValidityDecimalCompareOperator.select("equal"); + SC_ValiditySourceInput.setText("1"); + + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorAlertActionList.select("Stop"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("13"); + typeKeys(""); + assertEquals("OpenOffice.org Calc",ActiveMsgBox.getCaption()); + assertEquals("Invalid value.",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A1")); + } + + /** + * test uncheck Error Alert in Validity. + */ + @Test + public void testUncheckErrorAlert() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Decimal"); + SC_ValidityDecimalCompareOperator.select("equal"); + SC_ValiditySourceInput.setText("1"); + + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.uncheck(); + SC_ValidityErrorAlertActionList.select("Stop"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("13"); + typeKeys(""); + assertEquals("13",CalcUtil.getCellText("Sheet1.A1")); + } + + /** + * test Cell range source picker in Validity. Input from Edit Box. + */ + @Test + public void testValidityCellRangeSourcePicker() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Cell range"); + SC_ValiditySourcePicker.click(); + assertEquals(false,SC_ValidityCriteriaAllowList.exists()); + SC_ValiditySourceInput.setText("$Sheet1.$E$2:$G$5"); + SC_ValiditySourcePicker.click(); + assertEquals(true,SC_ValidityCriteriaAllowList.exists()); + + SC_ValidityErrorAlertTabPage.select(); + SC_ValidityShowErrorMessage.check(); + SC_ValidityErrorAlertActionList.select("Stop"); + SC_ValidityErrorAlertTabPage.ok(); + + // calc.focus(); + CalcUtil.selectRange("Sheet1.E2"); + SC_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("test32"); + typeKeys(""); + assertEquals("Invalid value.",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.B1"); + SC_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + assertEquals("test",CalcUtil.getCellText("Sheet1.B1")); + } + + /** + * test Allow Blank cell Checkbox in Validity. + */ + @Test + public void testAllowBlankCells() { + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Cell range"); + SC_ValiditySourceInput.setText("$E$1:$E$5"); + SC_ValidityAllowBlankCells.check(); + SC_ValidityCriteriaTabpage.ok(); + + CalcUtil.selectRange("Sheet1.E1"); + typeKeys("AAAAA"); + + CalcUtil.selectRange("Sheet1.A1"); + typeKeys("A"); + CalcUtil.selectRange("Sheet1.D1"); + SC_InputBar_Input.activate(); + typeKeys(""); + assertEquals("",CalcUtil.getCellText("Sheet1.D1")); + + CalcUtil.selectRange("Sheet1.B1"); + calc.menuItem("Data->Validity...").select(); + SC_ValidityCriteriaTabpage.select(); + SC_ValidityAllowBlankCells.uncheck(); + typeKeys(""); + + CalcUtil.selectRange("Sheet1.B1"); + SC_InputBar_Input.activate(); + typeKeys(""); + typeKeys(""); + } } --- src/testcase/sc/validity/ValidityUIAllowDecimal.java (revision 1362802) +++ src/testcase/sc/validity/ValidityUIAllowDecimal.java (working copy) @@ -1,120 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class ValidityUIAllowDecimal { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow type Decimal in validity - */ - @Test - public void testValidityUIAllowDecimal() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:C2"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Decimal"); - SC_ValidityDecimalCompareOperator.select("equal"); - SC_ValiditySourceInput.setText("1.55555"); - typeKeys(""); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("1.5"); - typeKeys(""); - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - ActiveMsgBox.focus(); - typeKeys(""); - - - CalcUtil.selectRange("Sheet1.A1:C2"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityDecimalCompareOperator.select("between"); - SC_ValiditySourceInput.setText("5"); - SC_ValidityMaxValueInput.setText("1"); - typeKeys(""); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("10"); - typeKeys(""); - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - - - - - - - } - -} - - --- src/testcase/sc/datapilot/MoveFieldToOtherAreaDiscardChange.java (revision 1362802) +++ src/testcase/sc/datapilot/MoveFieldToOtherAreaDiscardChange.java (working copy) @@ -1,158 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.MenuItem; -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - - -/** - * - * - */ -public class MoveFieldToOtherAreaDiscardChange { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while move fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - sleep(1); - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("B1")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Order Number",CalcUtil.getCellText("B3")); - sleep(1); - - DataPilotFieldSelect.click(1,90); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - DataPilotAutomaticallyUpdateCheckBox.uncheck(); - - DataPilotPaneRowArea.drag(1,1, 1, -50); - assertEquals("Date",CalcUtil.getCellText("A3")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - CalcUtil.selectRange("B33"); - ActiveMsgBox.yes(); - assertEquals("Date",CalcUtil.getCellText("D1")); - assertEquals("32779.17",CalcUtil.getCellInput("AB31")); - sleep(1); - - DataPilotColumnArea.click(1,50); - DataPilotColumnArea.openContextMenu(); - menuItem("Move to Row").select(); - assertEquals("Date",CalcUtil.getCellText("D1")); - assertEquals("32779.17",CalcUtil.getCellInput("AB31")); - - CalcUtil.selectRange("B33"); - ActiveMsgBox.yes(); - assertEquals("Date",CalcUtil.getCellText("B3")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - DataPilotAutomaticallyUpdateCheckBox.check(); - } - -} --- src/testcase/sc/datapilot/DataPilotAddFieldsAutoUpdate.java (revision 1362802) +++ src/testcase/sc/datapilot/DataPilotAddFieldsAutoUpdate.java (working copy) @@ -1,140 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; -/** - * - * - */ -public class DataPilotAddFieldsAutoUpdate { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - //open the sample file Create DataPilotTable and verify the content - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - sleep(1); - - //Add field into every area - DataPilotFieldSelect.click(1, 30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A2")); - sleep(1); - - DataPilotFieldSelect.drag(1, 1, 184, 80); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("",CalcUtil.getCellText("A1")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("",CalcUtil.getCellText("A3")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - } - -} --- src/testcase/sc/datapilot/MoveFieldToOtherAreaAutoUpdate.java (revision 1362802) +++ src/testcase/sc/datapilot/MoveFieldToOtherAreaAutoUpdate.java (working copy) @@ -1,153 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.MenuItem; -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - - -/** - * - * - */ -public class MoveFieldToOtherAreaAutoUpdate { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while move fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - sleep(1); - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("B1")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Order Number",CalcUtil.getCellText("B3")); - sleep(1); - - DataPilotFieldSelect.click(1,90); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - DataPilotPaneRowArea.drag(1,1, 1, -50); - assertEquals("Date",CalcUtil.getCellText("D1")); - assertEquals("32779.17",CalcUtil.getCellInput("AB31")); - sleep(1); - - DataPilotColumnArea.click(1,50); - DataPilotColumnArea.openContextMenu(); - menuItem("Move to Row").select(); - assertEquals("Date",CalcUtil.getCellText("B3")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Date",CalcUtil.getCellText("D1")); - assertEquals("32779.17",CalcUtil.getCellInput("AB31")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Date",CalcUtil.getCellText("B3")); - assertEquals("32779.17",CalcUtil.getCellInput("K30")); - - } - -} --- src/testcase/sc/datapilot/DataPivotTable.java (revision 1362802) +++ src/testcase/sc/datapilot/DataPivotTable.java (working copy) @@ -28,57 +28,50 @@ import static testlib.AppUtil.*; import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - import org.junit.After; import static org.junit.Assert.*; import static org.openoffice.test.vcl.Tester.*; - import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - +import org.openoffice.test.common.SystemUtil; import testlib.CalcUtil; import testlib.Log; + /** - * - * + * Test Data->Pivot Table + * Test cases in this class are unavailable. Because these test cases are based on symphony. + * DataPilot of symphony is totally different from PivotTable of AOO. + * Keep this class to track the test point. + * TODO: Add test cases about Pivot Table. */ -public class CopyPasteDataPilotTable { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ +public class DataPivotTable { + @Rule public Log LOG = new Log(); - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ @Before public void setUp() throws Exception { - initApp(); + app.start(); } + + @After + public void tearDown() throws Exception { + app.close(); + } + /** * * Verify copy and paste Data Pilot Table */ - @Test - public void test() { + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testCopyPasteDataPilotTable() { //Open the sample file String file = testFile("source_data01.ods"); startcenter.menuItem("File->Open...").select(); submitOpenDlg(file); sleep(2); - + //Create DataPilotTable and verify the content CalcUtil.selectRange("A1:E27"); calc.menuItem("Data->DataPilot->Start...").select(); @@ -90,41 +83,41 @@ assertEquals("Row Area",CalcUtil.getCellText("B10")); assertEquals("Column Area",CalcUtil.getCellText("D9")); assertEquals("Data Area",CalcUtil.getCellText("D11")); - + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ DataPilotAutomaticallyUpdateCheckBox.check(); } - + //Add field into every area DataPilotFieldSelect.click(1, 1); DataPilotFieldSelect.openContextMenu(); menuItem("Add to Page").select(); assertEquals("Locale",CalcUtil.getCellText("A1")); sleep(1); - + DataPilotFieldSelect.click(1,30); DataPilotFieldSelect.openContextMenu(); menuItem("Add to Column").select(); assertEquals("Name",CalcUtil.getCellText("A3")); sleep(1); - + DataPilotFieldSelect.click(1,50); DataPilotFieldSelect.openContextMenu(); menuItem("Add to Row").select(); assertEquals("Date",CalcUtil.getCellText("A4")); sleep(1); - + DataPilotFieldSelect.click(1,70); DataPilotFieldSelect.openContextMenu(); menuItem("Add to Data by->Sum").select(); assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); assertEquals("266773",CalcUtil.getCellText("J23")); sleep(1); - + //Copy and paste the data pilot table and verify the content CalcUtil.selectRange("A1:J24"); typeKeys("<$copy>"); - + CalcUtil.selectRange("A26"); typeKeys("<$paste>"); assertEquals("Locale",CalcUtil.getCellText("A26")); @@ -135,7 +128,7 @@ assertEquals("Total Result",CalcUtil.getCellText("J29")); assertEquals("266773",CalcUtil.getCellText("J48")); sleep(1); - + CalcUtil.selectRange("A1:J24"); typeKeys("<$copy>"); CalcUtil.selectRange("$A.$A29"); @@ -147,7 +140,1522 @@ assertEquals("Total Result",CalcUtil.getCellText("A51")); assertEquals("Total Result",CalcUtil.getCellText("J32")); assertEquals("266773",CalcUtil.getCellText("J51")); - } + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testDataPilotAddFieldsAutoUpdate() { + //open the sample file Create DataPilotTable and verify the content + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + sleep(1); + + //Add field into every area + DataPilotFieldSelect.click(1, 30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A2")); + sleep(1); + + DataPilotFieldSelect.drag(1, 1, 184, 80); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("",CalcUtil.getCellText("A1")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("",CalcUtil.getCellText("A3")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + } + + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testDataPilotAddFieldsManualUpdate() { + //open the sample file Create DataPilotTable and verify the content + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + + DataPilotAutomaticallyUpdateCheckBox.uncheck(); + + sleep(1); + DataPilotFieldSelect.click(1, 30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + sleep(1); + + CalcUtil.selectRange("B20"); + ActiveMsgBox.yes(); + sleep(1); + assertEquals("Name",CalcUtil.getCellText("B1")); + assertEquals("Date",CalcUtil.getCellText("A2")); + + DataPilotFieldSelect.drag(1, 1, 184, 80); + assertEquals("Name",CalcUtil.getCellText("B1")); + assertEquals("Date",CalcUtil.getCellText("A2")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Name",CalcUtil.getCellText("B1")); + assertEquals("Date",CalcUtil.getCellText("A2")); + sleep(1); + + DataPilotTableUpdateButton.click(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + + typeKeys("<$undo>"); + assertEquals("Name",CalcUtil.getCellText("B1")); + assertEquals("Date",CalcUtil.getCellText("A2")); + sleep(1); + + + typeKeys("<$redo>"); + assertEquals("Locale",CalcUtil.getCellText("A1")); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + DataPilotAutomaticallyUpdateCheckBox.check(); + assertTrue(DataPilotAutomaticallyUpdateCheckBox.isChecked()); + } + + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testDataPilotChangeDataFieldOptionAutoUpdate() { + //open the sample file Create DataPilotTable and verify the content + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + sleep(1); + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("B1")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Order Number",CalcUtil.getCellText("B3")); + sleep(1); + + DataPilotFieldSelect.click(1,90); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + //Change Locale option settings, and verify it + String target = "New Locale"; + DataPilotColumnArea.click(1,1); + DataPilotColumnArea.openContextMenu(); + menuItem("Field Option").select(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldDisplayNameEditBox.setText(target); + sleep(1); + + DataPilotFieldOptionFiledSubtotalsPage.select(); + sleep(1); + DataPilotFieldOptionSubTotalsManuallyRadioButton.check(); + sleep(1); + SC_DataPilotOptionSubtotalFunctionList.click(9,24); + sleep(1); + + DataPilotFieldOptionSortTabPageDialog.select(); + + + DataPilotFieldOptionSortDescendingRadioButton.check(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldOptionFieldTabPageDialog.ok(); + sleep(1); + + assertEquals("New Locale",CalcUtil.getCellText("C1")); + assertEquals("USA",CalcUtil.getCellText("C2")); + assertEquals("USA Count - Amount",CalcUtil.getCellInput("H2")); + assertEquals("17",CalcUtil.getCellInput("H30")); + assertEquals("China Count - Amount",CalcUtil.getCellInput("L2")); + assertEquals("9",CalcUtil.getCellInput("L30")); + assertEquals("32779.17",CalcUtil.getCellInput("M30")); + + DataPilotColumnArea.click(1,30); + DataPilotColumnArea.openContextMenu(); + menuItem("Field Option").select(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldShowItemWithoutDataCheckBox.check(); + DataPilotFieldOptionFieldTabPageDialog.ok(); + assertEquals("Emmy Ma",CalcUtil.getCellText("F3")); + assertEquals("32779.17",CalcUtil.getCellInput("U30")); + + CalcUtil.selectRange("C1"); + SpreadSheetCells.openContextMenu(); + menuItem("Field Option...").select(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldDisplayNameEditBox.setText("Locale"); + DataPilotFieldOptionFiledSubtotalsPage.select(); + DataPilotFieldOptionSubTotalsNeverRadioButton.check(); + sleep(1); + DataPilotFieldOptionSortTabPageDialog.select(); + DataPilotFieldOptionSortAscendingRadioButton.check(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldOptionFieldTabPageDialog.ok(); + + assertEquals("Locale",CalcUtil.getCellText("C1")); + assertEquals("China",CalcUtil.getCellText("C2")); + assertEquals("USA",CalcUtil.getCellText("K2")); + assertEquals("32779.17",CalcUtil.getCellInput("S30")); + + + CalcUtil.selectRange("D1"); + SpreadSheetCells.openContextMenu(); + menuItem("Field Option...").select(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldShowItemWithoutDataCheckBox.uncheck(); + DataPilotFieldOptionFieldTabPageDialog.ok(); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + } + + /** + * + * Verify that Verify the Drag/Move function of Grouped field + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testDragMoveFunctionOfGroupedField() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + CalcUtil.selectRange("B4:C4"); + SpreadSheetCells.openContextMenu(); + menuItem("Group->Group Selected Items").select(); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellText("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + DataPilotColumnArea.click(1,1); + DataPilotColumnArea.openContextMenu(); + menuItem("Move to Row").select(); + assertEquals("Name2",CalcUtil.getCellText("B4")); + assertEquals("Group1",CalcUtil.getCellText("B6")); + assertEquals("266773",CalcUtil.getCellText("K31")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellText("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Name2",CalcUtil.getCellText("B4")); + assertEquals("Group1",CalcUtil.getCellText("B6")); + assertEquals("266773",CalcUtil.getCellText("K31")); + } + + /** + * + * Verify that DP panel while switch focus among tables with same/different source range. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testHideShowPanel() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + CalcUtil.selectRange("A1:J24"); + typeKeys("<$copy>"); + + CalcUtil.selectRange("A26"); + typeKeys("<$paste>"); + assertEquals("Locale",CalcUtil.getCellText("A26")); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A28")); + assertEquals("Name",CalcUtil.getCellText("B28")); + assertEquals("Date",CalcUtil.getCellText("A29")); + assertEquals("Total Result",CalcUtil.getCellText("A48")); + assertEquals("Total Result",CalcUtil.getCellText("J29")); + assertEquals("266773",CalcUtil.getCellText("J48")); + sleep(1); + + CalcUtil.selectRange("A1"); + SpreadSheetCells.openContextMenu(); + menuItem("Show DataPilot Panel").select(); + assertFalse(DataPilotPanel.exists()); + sleep(1); + + CalcUtil.selectRange("A1"); + SpreadSheetCells.openContextMenu(); + menuItem("Show DataPilot Panel").select(); + assertTrue(DataPilotPanel.exists()); + sleep(1); + + DataPilotPanel.close(); + assertFalse(DataPilotPanel.exists()); + sleep(1); + + CalcUtil.selectRange("A26"); + DataPilotButton.click(); + sleep(1); + assertTrue(DataPilotPanel.exists()); + assertEquals("Locale",CalcUtil.getCellText("A26")); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A28")); + assertEquals("Name",CalcUtil.getCellText("B28")); + assertEquals("Date",CalcUtil.getCellText("A29")); + assertEquals("Total Result",CalcUtil.getCellText("A48")); + assertEquals("Total Result",CalcUtil.getCellText("J29")); + assertEquals("266773",CalcUtil.getCellText("J48")); + } + + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testMoveFieldInSameAreaManualUpdate() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + sleep(1); + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("B1")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Order Number",CalcUtil.getCellText("B3")); + sleep(1); + + DataPilotFieldSelect.click(1,90); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + DataPilotAutomaticallyUpdateCheckBox.uncheck(); + DataPilotColumnArea.drag(1, 1, 1, 60); + assertEquals("Name",CalcUtil.getCellText("D1")); + assertEquals("Locale",CalcUtil.getCellText("C1")); + sleep(1); + + DataPilotPaneRowArea.drag(1,1, 1, 60); + assertEquals("Order Number",CalcUtil.getCellText("B3")); + assertEquals("Date",CalcUtil.getCellText("A3")); + sleep(1); + + CalcUtil.selectRange("A33"); + ActiveMsgBox.yes(); + assertEquals("Name",CalcUtil.getCellText("C1")); + assertEquals("Locale",CalcUtil.getCellText("D1")); + assertEquals("Order Number",CalcUtil.getCellText("A3")); + assertEquals("Date",CalcUtil.getCellText("B3")); + sleep(1); + + DataPilotColumnArea.click(1,1); + DataPilotColumnArea.openContextMenu(); + menuItem("Move Down").select(); + assertEquals("Name",CalcUtil.getCellText("C1")); + assertEquals("Locale",CalcUtil.getCellText("D1")); + sleep(1); + + DataPilotPaneRowArea.click(1,30); + DataPilotPaneRowArea.openContextMenu(); + menuItem("Move Up").select(); + assertEquals("Order Number",CalcUtil.getCellText("A3")); + assertEquals("Date",CalcUtil.getCellText("B3")); + sleep(1); + + CalcUtil.selectRange("A33"); + ActiveMsgBox.yes(); + assertEquals("Name",CalcUtil.getCellText("D1")); + assertEquals("Locale",CalcUtil.getCellText("C1")); + assertEquals("Order Number",CalcUtil.getCellText("B3")); + assertEquals("Date",CalcUtil.getCellText("A3")); + assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + DataPilotAutomaticallyUpdateCheckBox.check(); + sleep(1); + } + + /** + * + * Verify that DP panel will be synchronized with table while move fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testMoveFieldToOtherAreaAutoUpdate() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + sleep(1); + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("B1")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Order Number",CalcUtil.getCellText("B3")); + sleep(1); + + DataPilotFieldSelect.click(1,90); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + DataPilotPaneRowArea.drag(1,1, 1, -50); + assertEquals("Date",CalcUtil.getCellText("D1")); + assertEquals("32779.17",CalcUtil.getCellInput("AB31")); + sleep(1); + + DataPilotColumnArea.click(1,50); + DataPilotColumnArea.openContextMenu(); + menuItem("Move to Row").select(); + assertEquals("Date",CalcUtil.getCellText("B3")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Date",CalcUtil.getCellText("D1")); + assertEquals("32779.17",CalcUtil.getCellInput("AB31")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Date",CalcUtil.getCellText("B3")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + } + + /** + * + * Verify that DP panel will be synchronized with table while move fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testMoveFieldToOtherAreaDiscardChange() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + sleep(1); + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("B1")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Order Number",CalcUtil.getCellText("B3")); + sleep(1); + + DataPilotFieldSelect.click(1,90); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Amount",CalcUtil.getCellText("A1")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + DataPilotAutomaticallyUpdateCheckBox.uncheck(); + + DataPilotPaneRowArea.drag(1,1, 1, -50); + assertEquals("Date",CalcUtil.getCellText("A3")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + CalcUtil.selectRange("B33"); + ActiveMsgBox.yes(); + assertEquals("Date",CalcUtil.getCellText("D1")); + assertEquals("32779.17",CalcUtil.getCellInput("AB31")); + sleep(1); + + DataPilotColumnArea.click(1,50); + DataPilotColumnArea.openContextMenu(); + menuItem("Move to Row").select(); + assertEquals("Date",CalcUtil.getCellText("D1")); + assertEquals("32779.17",CalcUtil.getCellInput("AB31")); + + CalcUtil.selectRange("B33"); + ActiveMsgBox.yes(); + assertEquals("Date",CalcUtil.getCellText("B3")); + assertEquals("32779.17",CalcUtil.getCellInput("K30")); + sleep(1); + + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + /** + * + * Verify that DP panel will be synchronized with table while move table. + * After the field name get changed, when you refresh the data, the DataPilot table will change to empty table + * if you create table small than the empty table, the table size will get larger + * if there is another DataPilot table exist in the larger range, there will pop a warning. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testMoveTableNarrowSpaceToShowTheTable() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + CalcUtil.selectRange("A1:B4"); + typeKeys("<$copy>"); + CalcUtil.selectRange("C1"); + typeKeys("<$paste>"); + sleep(1); + + CalcUtil.selectRange("$A.A1"); + typeKeys("New Locale" + ""); + + CalcUtil.selectRange("$DataPilot_A_1.A1"); + SpreadSheetCells.openContextMenu(); + menuItem("Refresh Data").select(); + ActiveMsgBox.ok(); + + CalcUtil.selectRange("A1:B4"); + SpreadSheetCells.drag(80, 45, 80, 350); + + assertEquals("New DataPilot Table",CalcUtil.getCellText("B20")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B22")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B23")); + assertEquals("Page Area",CalcUtil.getCellText("B25")); + assertEquals("Row Area",CalcUtil.getCellText("B28")); + assertEquals("Column Area",CalcUtil.getCellText("D27")); + assertEquals("Data Area",CalcUtil.getCellText("D29")); + DataPilotPanel.close(); + sleep(1); + + CalcUtil.selectRange("C1:D4"); + SpreadSheetCells.drag(210, 50, 10, 50); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + } + + /** + * + * Verify the data pilot result table refresh after source data changed + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testOneMRowDataPilotRefresh() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + calc.maximize(); + CalcUtil.selectRange("A1:E27"); + typeKeys("<$copy>"); + CalcUtil.selectRange("A1048540"); + typeKeys("<$paste>"); + calc.menuItem("Data->DataPilot->Start...").select(); + DataPilotTableToExistPlaceRadioButton.check(); + assertTrue(DataPilotTableToExistPlaceRadioButton.isChecked()); + DataPilotTableToExistPlaceEditBox.setText("$A.$F$1048540"); + CreateDataPilotTableDialog.ok(); + sleep(1); + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + + } + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("F1048540")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("F1048542")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("F1048543")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("F1048542")); + assertEquals("266773",CalcUtil.getCellText("O1048562")); + sleep(1); + + CalcUtil.selectRange("D1048541"); + typeKeys("10000"); + sleep(1); + + CalcUtil.selectRange("O1048562"); + calc.menuItem("Data->DataPilot->Refresh").select(); + assertEquals("266525",CalcUtil.getCellText("O1048562")); + } + + /** + * + * Verify that DP panel will be synchronized with table while remove fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testRemoveFieldsDiscardChange() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + DataPilotAutomaticallyUpdateCheckBox.uncheck(); + + DataPilotColumnArea.drag(1, 1, -30, 1); + assertEquals("Name",CalcUtil.getCellText("B3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + DataPilotPaneRowArea.click(1,1); + DataPilotPaneRowArea.openContextMenu(); + menuItem("Remove").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + DataPilotPanePageArea.drag(1, 1, -30, 1); + assertEquals("Locale",CalcUtil.getCellText("A1")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + DataPiloPaneDataArea.openContextMenu(); + menuItem("Remove").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + + CalcUtil.selectRange("B25"); + ActiveMsgBox.yes(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + /** + * + * Verify the Remove function of Grouped field + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testRemoveFunctionOfGroupedField() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + CalcUtil.selectRange("B4:C4"); + SpreadSheetCells.openContextMenu(); + menuItem("Group->Group Selected Items").select(); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellText("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + CalcUtil.selectRange("D4"); + SpreadSheetCells.openContextMenu(); + menuItem("Group->Ungroup").select(); + assertEquals("Name",CalcUtil.getCellText("B3")); + assertEquals("",CalcUtil.getCellText("C3")); + assertEquals("Bill Zhang",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J23")); + } + + /** + * + * Verify that DP panel will be synchronized with table while rename fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testRenameFieldAutoUpdate() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + DataPilotPanePageArea.click(1,1); + DataPilotPanePageArea.openContextMenu(); + menuItem("Field Option").select(); + DataPilotFieldDisplayNameEditBox.setText("New Locale"); + DataPilotFieldOptionFieldTabPageDialog.ok(); + assertEquals("New Locale",CalcUtil.getCellText("A1")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("New Locale",CalcUtil.getCellText("A1")); + sleep(1); + + CalcUtil.selectRange("B3"); + SpreadSheetCells.openContextMenu(); + menuItem("Field Option...").select(); + DataPilotFieldDisplayNameEditBox.setText("New Name"); + DataPilotFieldOptionFieldTabPageDialog.ok(); + assertEquals("New Name",CalcUtil.getCellText("B3")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Name",CalcUtil.getCellText("B3")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("New Name",CalcUtil.getCellText("B3")); + sleep(1); + + CalcUtil.selectRange("A4"); + SpreadSheetCells.openContextMenu(); + menuItem("Field Option...").select(); + DataPilotFieldDisplayNameEditBox.setText("New Date"); + DataPilotFieldOptionFieldTabPageDialog.ok(); + assertEquals("New Date",CalcUtil.getCellText("A4")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("New Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPiloPaneDataArea.openContextMenu(); + menuItem("Field Option").select(); + DataPilotFieldDisplayNameEditBox.setText("New Sum - Order Number"); + DataPilotFieldOptionFieldTabPageDialog.ok(); + assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("New Sum - Order Number",CalcUtil.getCellText("A3")); + sleep(1); + } + + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testSortFunctionInGroupedField() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + CalcUtil.selectRange("B4:C4"); + SpreadSheetCells.openContextMenu(); + menuItem("Group->Group Selected Items").select(); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellInput("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + CalcUtil.selectRange("B3"); + SpreadSheetCells.openContextMenu(); + menuItem("Field Option...").select(); + DataPilotFieldOptionSortTabPageDialog.select(); + + DataPilotFieldOptionSortDescendingRadioButton.check(); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldOptionFieldTabPageDialog.ok(); + sleep(1); + + assertEquals("Kevin Wang",CalcUtil.getCellText("B4")); + assertEquals("Group1",CalcUtil.getCellText("F4")); + assertEquals("Bill Zhang",CalcUtil.getCellText("I4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + + typeKeys("<$undo>"); + assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("Kevin Wang",CalcUtil.getCellText("I4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Kevin Wang",CalcUtil.getCellText("B4")); + assertEquals("Group1",CalcUtil.getCellText("F4")); + assertEquals("Bill Zhang",CalcUtil.getCellText("I4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + } + + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testSubtotalsFunctionInGroupedField() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + CalcUtil.selectRange("B4:C4"); + SpreadSheetCells.openContextMenu(); + menuItem("Group->Group Selected Items").select(); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellText("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + CalcUtil.selectRange("B3"); + SpreadSheetCells.openContextMenu(); + menuItem("Field Option...").select(); + DataPilotFieldOptionFiledSubtotalsPage.select(); + sleep(1); + + DataPilotFieldOptionSubTotalsManuallyRadioButton.check(); + + SC_DataPilotOptionSubtotalFunctionList.click(9,24); + sleep(1); + DataPilotFieldOptionFieldTabPageDialog.select(); + DataPilotFieldOptionFieldTabPageDialog.ok(); + + assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4")); + assertEquals("5",CalcUtil.getCellText("C24")); + + assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4")); + assertEquals("2",CalcUtil.getCellText("E24")); + + assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4")); + assertEquals("9",CalcUtil.getCellText("H24")); + + assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4")); + assertEquals("1",CalcUtil.getCellText("J24")); + + assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4")); + assertEquals("2",CalcUtil.getCellText("L24")); + + assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4")); + assertEquals("4",CalcUtil.getCellText("N24")); + + assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4")); + assertEquals("3",CalcUtil.getCellText("P24")); + assertEquals("266773",CalcUtil.getCellText("Q24")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Emmy Ma",CalcUtil.getCellText("C4")); + assertEquals("20518",CalcUtil.getCellText("C24")); + + assertEquals("",CalcUtil.getCellText("E4")); + assertEquals("20528",CalcUtil.getCellText("E24")); + + assertEquals("Joe Liu",CalcUtil.getCellText("H4")); + assertEquals("41056",CalcUtil.getCellText("H24")); + + assertEquals("Total Result",CalcUtil.getCellText("J4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + + assertEquals("",CalcUtil.getCellText("L4")); + assertEquals("",CalcUtil.getCellText("L24")); + + assertEquals("",CalcUtil.getCellText("N4")); + assertEquals("",CalcUtil.getCellText("N24")); + + assertEquals("",CalcUtil.getCellText("P4")); + assertEquals("",CalcUtil.getCellText("P24")); + assertEquals("",CalcUtil.getCellText("Q24")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Bill Zhang Count - Order Number",CalcUtil.getCellText("C4")); + assertEquals("5",CalcUtil.getCellText("C24")); + + assertEquals("Emmy Ma Count - Order Number",CalcUtil.getCellText("E4")); + assertEquals("2",CalcUtil.getCellText("E24")); + + assertEquals("Group1 Count - Order Number",CalcUtil.getCellText("H4")); + assertEquals("9",CalcUtil.getCellText("H24")); + + assertEquals("Harry Wu Count - Order Number",CalcUtil.getCellText("J4")); + assertEquals("1",CalcUtil.getCellText("J24")); + + assertEquals("Jerry Lu Count - Order Number",CalcUtil.getCellText("L4")); + assertEquals("2",CalcUtil.getCellText("L24")); + + assertEquals("Joe Liu Count - Order Number",CalcUtil.getCellText("N4")); + assertEquals("4",CalcUtil.getCellText("N24")); + + assertEquals("Kevin Wang Count - Order Number",CalcUtil.getCellText("P4")); + assertEquals("3",CalcUtil.getCellText("P24")); + assertEquals("266773",CalcUtil.getCellText("Q24")); + } + + /** + * + * Verify that DP panel will be synchronized with table while add fields on panel. + */ + @Ignore("DataPilot in symphony is totally not the same in AOO") + public void testTopNFunctionInGroupedField() { + String file = testFile("source_data01.ods"); + startcenter.menuItem("File->Open...").select(); + submitOpenDlg(file); + sleep(2); + CalcUtil.selectRange("A1:E27"); + calc.menuItem("Data->DataPilot->Start...").select(); + CreateDataPilotTableDialog.ok(); + assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); + assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); + assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); + assertEquals("Page Area",CalcUtil.getCellText("B7")); + assertEquals("Row Area",CalcUtil.getCellText("B10")); + assertEquals("Column Area",CalcUtil.getCellText("D9")); + assertEquals("Data Area",CalcUtil.getCellText("D11")); + + if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ + DataPilotAutomaticallyUpdateCheckBox.check(); + } + + DataPilotFieldSelect.click(1, 1); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Page").select(); + assertEquals("Locale",CalcUtil.getCellText("A1")); + sleep(1); + + DataPilotFieldSelect.click(1,30); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Column").select(); + assertEquals("Name",CalcUtil.getCellText("A3")); + sleep(1); + + DataPilotFieldSelect.click(1,50); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Row").select(); + assertEquals("Date",CalcUtil.getCellText("A4")); + sleep(1); + + DataPilotFieldSelect.click(1,70); + DataPilotFieldSelect.openContextMenu(); + menuItem("Add to Data by->Sum").select(); + assertEquals("Sum - Order Number",CalcUtil.getCellInput("A3")); + assertEquals("266773",CalcUtil.getCellText("J23")); + sleep(1); + + CalcUtil.selectRange("B4:C4"); + SpreadSheetCells.openContextMenu(); + menuItem("Group->Group Selected Items").select(); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellText("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + CalcUtil.selectRange("A1"); + sleep(1); + + // the Display resolution is 1280 * 1050 on windows and Linux and 1920 * 1080 on Mac + if(SystemUtil.isWindows()){ + SpreadSheetCells.click(238, 43); + } + else if(SystemUtil.isLinux()){ + SpreadSheetCells.click(267, 43); + } + else if(SystemUtil.isMac()){ + SpreadSheetCells.click(238, 43); + } + + typeKeys(""); + typeKeys(""); + typeKeys(""); + typeKeys(""); + typeKeys(""); + typeKeys(""); + typeKeys(""); + OnlyDisplayTopNItemCheckBox.check(); + NumberOfItemShowInTopNEditBox.setText("4"); + FieldTopNSettingDialog.ok(); + sleep(1); + + assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); + assertEquals("51299",CalcUtil.getCellText("B24")); + + assertEquals("Group1",CalcUtil.getCellText("C4")); + assertEquals("71806",CalcUtil.getCellText("C24")); + assertEquals("",CalcUtil.getCellText("D4")); + assertEquals("Amy Zhao",CalcUtil.getCellText("C5")); + assertEquals("Anne Lee",CalcUtil.getCellText("D5")); + assertEquals("20528",CalcUtil.getCellText("D24")); + + assertEquals("Joe Liu",CalcUtil.getCellText("E4")); + assertEquals("41056",CalcUtil.getCellText("E24")); + + assertEquals("Kevin Wang",CalcUtil.getCellText("F4")); + assertEquals("30771",CalcUtil.getCellText("F24")); + + assertEquals("Total Result",CalcUtil.getCellText("G4")); + assertEquals("215460",CalcUtil.getCellText("G24")); + sleep(1); + + typeKeys("<$undo>"); + assertEquals("Name2",CalcUtil.getCellText("B3")); + assertEquals("Name",CalcUtil.getCellText("C3")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + + assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); + assertEquals("51299",CalcUtil.getCellText("B24")); + + assertEquals("Emmy Ma",CalcUtil.getCellText("C4")); + assertEquals("20518",CalcUtil.getCellText("C24")); + assertEquals("Group1",CalcUtil.getCellText("D4")); + assertEquals("Emmy Ma",CalcUtil.getCellText("C5")); + assertEquals("Amy Zhao",CalcUtil.getCellText("D5")); + assertEquals("71806",CalcUtil.getCellText("D24")); + + assertEquals("",CalcUtil.getCellText("E4")); + assertEquals("20528",CalcUtil.getCellText("E24")); + + assertEquals("Harry Wu",CalcUtil.getCellText("F4")); + assertEquals("10265",CalcUtil.getCellText("F24")); + + assertEquals("Jerry Lu",CalcUtil.getCellText("G4")); + assertEquals("20530",CalcUtil.getCellText("G24")); + + assertEquals("Total Result",CalcUtil.getCellText("J4")); + assertEquals("266773",CalcUtil.getCellText("J24")); + sleep(1); + + typeKeys("<$redo>"); + assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); + assertEquals("51299",CalcUtil.getCellText("B24")); + + assertEquals("Group1",CalcUtil.getCellText("C4")); + assertEquals("71806",CalcUtil.getCellText("C24")); + assertEquals("",CalcUtil.getCellText("D4")); + assertEquals("Amy Zhao",CalcUtil.getCellText("C5")); + assertEquals("Anne Lee",CalcUtil.getCellText("D5")); + assertEquals("20528",CalcUtil.getCellText("D24")); + + assertEquals("Joe Liu",CalcUtil.getCellText("E4")); + assertEquals("41056",CalcUtil.getCellText("E24")); + + assertEquals("Kevin Wang",CalcUtil.getCellText("F4")); + assertEquals("30771",CalcUtil.getCellText("F24")); + + assertEquals("Total Result",CalcUtil.getCellText("G4")); + assertEquals("215460",CalcUtil.getCellText("G24")); + } } --- src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java (revision 1362802) +++ src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java (working copy) @@ -24,7 +24,7 @@ /** * */ -package testcase.presentation.headerandfooter; +package testcase.sd.headerandfooter; import static testlib.AppUtil.fullPath; import static testlib.AppUtil.openStartcenter; --- src/testcase/sc/datapilot/DataPilotAddFieldsManualUpdate.java (revision 1362802) +++ src/testcase/sc/datapilot/DataPilotAddFieldsManualUpdate.java (working copy) @@ -1,166 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; -/** - * - * - */ -public class DataPilotAddFieldsManualUpdate { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - //open the sample file Create DataPilotTable and verify the content - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - - DataPilotAutomaticallyUpdateCheckBox.uncheck(); - - sleep(1); - DataPilotFieldSelect.click(1, 30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - sleep(1); - - CalcUtil.selectRange("B20"); - ActiveMsgBox.yes(); - sleep(1); - assertEquals("Name",CalcUtil.getCellText("B1")); - assertEquals("Date",CalcUtil.getCellText("A2")); - - DataPilotFieldSelect.drag(1, 1, 184, 80); - assertEquals("Name",CalcUtil.getCellText("B1")); - assertEquals("Date",CalcUtil.getCellText("A2")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Name",CalcUtil.getCellText("B1")); - assertEquals("Date",CalcUtil.getCellText("A2")); - sleep(1); - - DataPilotTableUpdateButton.click(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - - typeKeys("<$undo>"); - assertEquals("Name",CalcUtil.getCellText("B1")); - assertEquals("Date",CalcUtil.getCellText("A2")); - sleep(1); - - - typeKeys("<$redo>"); - assertEquals("Locale",CalcUtil.getCellText("A1")); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - DataPilotAutomaticallyUpdateCheckBox.check(); - assertTrue(DataPilotAutomaticallyUpdateCheckBox.isChecked()); - } - -} - --- src/testcase/sc/chart/ChartDialogSetting.java (revision 1362802) +++ src/testcase/sc/chart/ChartDialogSetting.java (working copy) @@ -26,72 +26,58 @@ */ package testcase.sc.chart; -import static testlib.AppUtil.*; import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - import org.junit.After; import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; import testlib.Log; /** - * - * + * Test the setting about chart dialog in spreadsheet */ -public class ChartDialogCancelBack { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ +public class ChartDialogSetting { + @Rule public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ + @Before public void setUp() throws Exception { - initApp(); + app.start(); + + // Create a new spreadsheet document + startcenter.menuItem("File->New->Spreadsheet").select(); } + + @After + public void tearDown() throws Exception { + app.close(); + } + /** * Test cancel and back button in chart wizard dialog * * @throws java.lang.Exception */ @Test - public void test() { - //Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); + public void testChartDialogCancelBack() { calc.menuItem("Insert->Chart...").select(); - sleep(1); WizardNextButton.click(); - sleep(1); assertTrue(ChartRangeChooseTabPage.isEnabled()); WizardBackButton.click(); - sleep(1); assertTrue(ChartTypeChooseTabPage.isEnabled()); Chart_Wizard.cancel(); - sleep(1); assertFalse(Chart_Wizard.exists()); } + /** + * Verify Chart Wizard dialog title words + */ + @Test + public void testChartWizardTitle() { + calc.menuItem("Insert->Chart...").select(); + assertEquals("Chart Wizard",Chart_Wizard.getText()); + Chart_Wizard.cancel(); + } } --- src/testcase/sc/validity/AllowBlankCells.java (revision 1362802) +++ src/testcase/sc/validity/AllowBlankCells.java (working copy) @@ -1,130 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowBlankCells { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow Blank cell Checkbox in Validity. - */ - @Test - public void testAllowBlankCells() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - String a ="A"; - for(int j=1;j<=6;j++){ - CalcUtil.selectRange("Sheet1.A"+j); - typeKeys(a); - typeKeys(""); - } - CalcUtil.selectRange("Sheet1.A1:A6"); - typeKeys("<$copy>"); - CalcUtil.selectRange("Sheet1.B1"); - typeKeys("<$paste>"); - CalcUtil.selectRange("Sheet1.C1"); - typeKeys("<$paste>"); - - CalcUtil.selectRange("Sheet1.D1"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Cell range"); - SC_ValiditySourceInput.setText("$A$1:$C$6"); - SC_ValidityAllowBlankCells.check(); - typeKeys(""); - - - CalcUtil.selectRange("Sheet1.D1"); - sleep(1); - typeKeys(a); - typeKeys(""); - CalcUtil.selectRange("Sheet1.D1"); - SC_CellInput.activate(); - typeKeys(""); - sleep(1); - typeKeys(""); - assertEquals("",CalcUtil.getCellText("Sheet1.D1")); - - typeKeys(a); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityCriteriaTabpage.select(); - SC_ValidityAllowBlankCells.uncheck(); - - typeKeys(""); - - CalcUtil.selectRange("Sheet1.D1"); - SC_CellInput.activate(); - typeKeys(""); - typeKeys(""); - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - - } - -} - --- src/testcase/sc/filter/Fitler.java (revision 1362802) +++ src/testcase/sc/filter/Fitler.java (working copy) @@ -28,60 +28,45 @@ import static testlib.AppUtil.*; import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - import org.junit.After; import static org.junit.Assert.*; import static org.openoffice.test.vcl.Tester.*; - import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - import testlib.CalcUtil; import testlib.Log; /** - * - * + * Test cases about Data->Filter in spreadsheet */ -public class AutoFitlerWithPlusSign { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ +public class Fitler { + @Rule public Log LOG = new Log(); - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ @Before public void setUp() throws Exception { - initApp(); + app.start(); + + // Create a new spreadsheet document + startcenter.menuItem("File->New->Spreadsheet").select(); } + + @After + public void tearDown() throws Exception { + app.close(); + } + /** * * Verify Chart Wizard dialog title words */ - @Test - public void test() { - // Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); + @Ignore("Bug 120076") + public void testAutoFilterWithPlusSign() { String expect ="2+"; CalcUtil.selectRange("A1"); typeKeys(expect + ""); assertEquals(expect,CalcUtil.getCellText("A1")); } - } --- src/testcase/sc/sort/SortOptionsCustomSortOrderPredefineFromNewList.java (revision 1362802) +++ src/testcase/sc/sort/SortOptionsCustomSortOrderPredefineFromNewList.java (working copy) @@ -1,202 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortOptionsCustomSortOrderPredefineFromNewList { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort options: custom sort order, predefined in preferences from new list - * @throws Exception - */ - @Test - public void testSortOptionsCustomSortOrderPredefineFromNewList() throws Exception{ - - // Dependencies start - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists" - typeKeys(""); - OptionsDlgList.select(15); // Select "OpenOffice.org Spreadsheets" - typeKeys(""); // Expand "OpenOffice.org Spreadsheets" - OptionsDlgList.select(19); // Select "Sort Lists" - - // Click "New" button, input "white,red,yellow,blue,green,black", press "Add" and "OK", close the document - OptionsDlg_New.click(); - typeKeys("white,red,yellow,blue,green,black"); - OptionsDlg_Add.click(); - sleep(0.5); - OptionsDlg.ok(); - calc.menuItem("File->Close").select(); - // Dependencies end - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"Color"}, - {"black"}, - {"yellow"}, - {"blue"}, - {"black"}, - {"white"}, - {"red"}, - }; - String[][] expectedResultNoCustomSortOrder = new String[][] { - {"Color"}, - {"black"}, - {"black"}, - {"blue"}, - {"red"}, - {"white"}, - {"yellow"}, - }; - String[][] expectedResultCustomSortOrder = new String[][] { - {"Color"}, - {"white"}, - {"red"}, - {"yellow"}, - {"blue"}, - {"black"}, - {"black"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("Colorblackyellowblueblackwhitered"); - CalcUtil.selectRange("A2:A7"); - calc.menuItem("Format->Change Case->Lowercase").select(); // In case SC capitalize first letter automatically - - // "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color - CalcUtil.selectRange("A1:A7"); - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_CustomSortOrder.uncheck(); - SortPage.select(); - SortPage_By1.select("Color"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Undo: Sort").select(); - - // Copy original data to sheet2 - CalcUtil.selectRange("A1:A7"); - calc.menuItem("Edit->Copy").select(); - CalcUtil.selectRange("Sheet2.A1"); - calc.menuItem("Edit->Paste").select(); - sleep(1); - - // "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_CustomSortOrder.check(); - SortOptionsPage_CustomSortOrderList.select("white,red,yellow,blue,green,black"); - SortPage.select(); - SortPage_By1.select("Color"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - - // Save and close document - String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromNewList.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7")); - assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7")); - } -} --- src/testcase/sc/validity/AllowDecimalEqual.java (revision 1362802) +++ src/testcase/sc/validity/AllowDecimalEqual.java (working copy) @@ -1,134 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowDecimalEqual { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow Decimal equal in Validity. - */ - @Test - public void testAllowDecimalEqual() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Decimal"); - SC_ValidityDecimalCompareOperator.select("equal"); - SC_ValiditySourceInput.setText("0.33333333"); - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorMessageTitle.setText("Stop to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("0.33333333"); - typeKeys(""); - assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("=1/3"); - typeKeys(""); - assertEquals("0.33333333",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.A3"); - SC_CellInput.activate(); - typeKeys("0.3"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A3")); - - CalcUtil.selectRange("Sheet1.A4"); - SC_CellInput.activate(); - typeKeys("0.333333333"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A4")); - - CalcUtil.selectRange("Sheet1.B2"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B2")); - - } - -} - --- src/testcase/sc/datapilot/TopNFunctionInGroupedField.java (revision 1362802) +++ src/testcase/sc/datapilot/TopNFunctionInGroupedField.java (working copy) @@ -1,228 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; -import org.openoffice.test.common.SystemUtil; - -import testlib.CalcUtil; -import testlib.Log; - - -/** - * - * - */ -public class TopNFunctionInGroupedField { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellInput("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - CalcUtil.selectRange("B4:C4"); - SpreadSheetCells.openContextMenu(); - menuItem("Group->Group Selected Items").select(); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellText("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - CalcUtil.selectRange("A1"); - sleep(1); - - // the Display resolution is 1280 * 1050 on windows and Linux and 1920 * 1080 on Mac - if(SystemUtil.isWindows()){ - SpreadSheetCells.click(238, 43); - } - else if(SystemUtil.isLinux()){ - SpreadSheetCells.click(267, 43); - } - else if(SystemUtil.isMac()){ - SpreadSheetCells.click(238, 43); - } - - typeKeys(""); - typeKeys(""); - typeKeys(""); - typeKeys(""); - typeKeys(""); - typeKeys(""); - typeKeys(""); - OnlyDisplayTopNItemCheckBox.check(); - NumberOfItemShowInTopNEditBox.setText("4"); - FieldTopNSettingDialog.ok(); - sleep(1); - - assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); - assertEquals("51299",CalcUtil.getCellText("B24")); - - assertEquals("Group1",CalcUtil.getCellText("C4")); - assertEquals("71806",CalcUtil.getCellText("C24")); - assertEquals("",CalcUtil.getCellText("D4")); - assertEquals("Amy Zhao",CalcUtil.getCellText("C5")); - assertEquals("Anne Lee",CalcUtil.getCellText("D5")); - assertEquals("20528",CalcUtil.getCellText("D24")); - - assertEquals("Joe Liu",CalcUtil.getCellText("E4")); - assertEquals("41056",CalcUtil.getCellText("E24")); - - assertEquals("Kevin Wang",CalcUtil.getCellText("F4")); - assertEquals("30771",CalcUtil.getCellText("F24")); - - assertEquals("Total Result",CalcUtil.getCellText("G4")); - assertEquals("215460",CalcUtil.getCellText("G24")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellText("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - - assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); - assertEquals("51299",CalcUtil.getCellText("B24")); - - assertEquals("Emmy Ma",CalcUtil.getCellText("C4")); - assertEquals("20518",CalcUtil.getCellText("C24")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("Emmy Ma",CalcUtil.getCellText("C5")); - assertEquals("Amy Zhao",CalcUtil.getCellText("D5")); - assertEquals("71806",CalcUtil.getCellText("D24")); - - assertEquals("",CalcUtil.getCellText("E4")); - assertEquals("20528",CalcUtil.getCellText("E24")); - - assertEquals("Harry Wu",CalcUtil.getCellText("F4")); - assertEquals("10265",CalcUtil.getCellText("F24")); - - assertEquals("Jerry Lu",CalcUtil.getCellText("G4")); - assertEquals("20530",CalcUtil.getCellText("G24")); - - assertEquals("Total Result",CalcUtil.getCellText("J4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); - assertEquals("51299",CalcUtil.getCellText("B24")); - - assertEquals("Group1",CalcUtil.getCellText("C4")); - assertEquals("71806",CalcUtil.getCellText("C24")); - assertEquals("",CalcUtil.getCellText("D4")); - assertEquals("Amy Zhao",CalcUtil.getCellText("C5")); - assertEquals("Anne Lee",CalcUtil.getCellText("D5")); - assertEquals("20528",CalcUtil.getCellText("D24")); - - assertEquals("Joe Liu",CalcUtil.getCellText("E4")); - assertEquals("41056",CalcUtil.getCellText("E24")); - - assertEquals("Kevin Wang",CalcUtil.getCellText("F4")); - assertEquals("30771",CalcUtil.getCellText("F24")); - - assertEquals("Total Result",CalcUtil.getCellText("G4")); - assertEquals("215460",CalcUtil.getCellText("G24")); - } - -} --- src/testcase/sc/validity/DefaultErrorAlertMessage.java (revision 1362802) +++ src/testcase/sc/validity/DefaultErrorAlertMessage.java (working copy) @@ -1,107 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class DefaultErrorAlertMessage { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test default message of Error Alert in Validity. - */ - @Test - public void testDefaultErrorAlertMessage() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Decimal"); - SC_ValidityDecimalCompareOperator.select("equal"); - SC_ValiditySourceInput.setText("1"); - - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorAlertActionList.select("Stop"); - typeKeys(""); - sleep(1); - - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("13"); - typeKeys(""); - assertEquals("OpenOffice.org Spreadsheets",ActiveMsgBox.getCaption()); - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.A1")); - - } - -} - --- src/testcase/sc/sort/RowsSortWithOptionsCaseSensitive.java (revision 1362802) +++ src/testcase/sc/sort/RowsSortWithOptionsCaseSensitive.java (working copy) @@ -1,129 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class RowsSortWithOptionsCaseSensitive { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test rows sort with options setting: case sensitive - * @throws Exception - */ - @Test - public void testRowsSortWithOptionsCaseSensitive() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data: A1~A6: 1ColumnName,D,C,B,A,a - String[][] data = new String[][] { - {"D"}, - {"C"}, - {"B"}, - {"A"}, - {"a"}, - }; - String[][] expectedSortedResult = new String[][] { - {"a"}, - {"A"}, - {"B"}, - {"C"}, - {"D"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("1ColumnNameDCBAa"); - CalcUtil.selectRange("A6"); - calc.menuItem("Format->Change Case->Lowercase").select(); // In case SC capitalize first letter automatically - - // "Data->Sort...", choose "Ascending", check "Case sensitive" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_CaseSensitive.check(); - SortOptionsPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A2:A6")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6")); - - // Save and close document - String saveTo = fullPath("temp/" + "RowsSortWithOptionsCaseSensitive.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Saved sorted result", expectedSortedResult, CalcUtil.getCellTexts("A2:A6")); - } -} --- src/testcase/sc/chart/ChartDialogCancelBack.java (revision 1362802) +++ src/testcase/sc/chart/ChartDialogCancelBack.java (working copy) @@ -1,97 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.chart; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class ChartDialogCancelBack { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * Test cancel and back button in chart wizard dialog - * - * @throws java.lang.Exception - */ - @Test - public void test() { - //Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - calc.menuItem("Insert->Chart...").select(); - sleep(1); - WizardNextButton.click(); - sleep(1); - assertTrue(ChartRangeChooseTabPage.isEnabled()); - WizardBackButton.click(); - sleep(1); - assertTrue(ChartTypeChooseTabPage.isEnabled()); - Chart_Wizard.cancel(); - sleep(1); - assertFalse(Chart_Wizard.exists()); - } - -} --- src/testcase/sc/validity/ValidityDateSupport1024Columns.java (revision 1362802) +++ src/testcase/sc/validity/ValidityDateSupport1024Columns.java (working copy) @@ -46,42 +46,29 @@ public class ValidityDateSupport1024Columns { private static IDList idList = new IDList(new File("./ids")); public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ + @Rule public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ + @Before public void setUp() throws Exception { - initApp(); + app.start(); } - + + @After + public void tearDown() throws Exception { + app.close(); + } + /** * test Allow Greater than or equal to Date type in Validity, support 1024 columns. */ @Test public void testValidityDateSupport1024Columns() { startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.ALM1000"); CalcUtil.selectRange("Sheet1.ALM1000:Sheet1.ALO1005"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - + SC_ValidityCriteriaTabpage.select(); SC_ValidityCriteriaAllowList.select("Date"); SC_ValidityDecimalCompareOperator.select("greater than"); @@ -90,39 +77,31 @@ SC_ValidityShowErrorMessage.check(); SC_ValidityErrorMessageTitle.setText("Stop to enter"); SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - + SC_ValidityErrorAlertTabPage.ok(); + CalcUtil.selectRange("Sheet1.ALM1001"); - SC_CellInput.activate(); - typeKeys("02/01/08"); - typeKeys(""); + SC_InputBar_Input.activate(); + typeKeys("02/01/08"); assertEquals("02/01/08",CalcUtil.getCellText("Sheet1.ALM1001")); - + CalcUtil.selectRange("Sheet1.ALM1002"); - SC_CellInput.activate(); - typeKeys("01/02/08"); - typeKeys(""); + SC_InputBar_Input.activate(); + typeKeys("01/02/08"); assertEquals("01/02/08",CalcUtil.getCellText("Sheet1.ALM1002")); - + CalcUtil.selectRange("Sheet1.ALM1003"); - SC_CellInput.activate(); - typeKeys("01/01/08"); - typeKeys(""); + SC_InputBar_Input.activate(); + typeKeys("01/01/08"); assertEquals("Invalid value",ActiveMsgBox.getMessage()); ActiveMsgBox.ok(); assertEquals("",CalcUtil.getCellText("Sheet1.ALM1003")); CalcUtil.selectRange("Sheet1.AML1003"); - SC_CellInput.activate(); - typeKeys("12/31/07"); - typeKeys(""); + SC_InputBar_Input.activate(); + typeKeys("12/31/07"); assertEquals("Invalid value",ActiveMsgBox.getMessage()); ActiveMsgBox.ok(); assertEquals("",CalcUtil.getCellText("Sheet1.AML1003")); - - } - + } } --- src/testcase/sc/validity/AllowTimeBetween.java (revision 1362802) +++ src/testcase/sc/validity/AllowTimeBetween.java (working copy) @@ -1,180 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowTimeBetween { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow time between in Validity. - */ - @Test - public void testAllowTimeBetween() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:C5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Time"); - SC_ValidityDecimalCompareOperator.select("between"); - SC_ValiditySourceInput.setText("27:00"); - SC_ValidityMaxValueInput.setText("21:00"); - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorMessageTitle.setText("Stop to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("21:00"); - typeKeys(""); - assertEquals("09:00:00 PM",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("27:00"); - typeKeys(""); - assertEquals("27:00:00",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.A3"); - SC_CellInput.activate(); - typeKeys("1.125"); - typeKeys(""); - assertEquals("1.125",CalcUtil.getCellText("Sheet1.A3")); - - CalcUtil.selectRange("Sheet1.A4"); - SC_CellInput.activate(); - typeKeys("0.875"); - typeKeys(""); - assertEquals("0.875",CalcUtil.getCellText("Sheet1.A4")); - - CalcUtil.selectRange("Sheet1.B1"); - SC_CellInput.activate(); - typeKeys("03:00:01"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B1")); - - CalcUtil.selectRange("Sheet1.B2"); - SC_CellInput.activate(); - typeKeys("20:59:59"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B2")); - - CalcUtil.selectRange("Sheet1.B3"); - SC_CellInput.activate(); - typeKeys("1.126"); - typeKeys(""); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B3")); - - CalcUtil.selectRange("Sheet1.B4"); - SC_CellInput.activate(); - typeKeys("0.874"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B4")); - - CalcUtil.selectRange("Sheet1.C1"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.C1")); - - CalcUtil.selectRange("Sheet1.C2"); - SC_CellInput.activate(); - typeKeys("24:00"); - typeKeys(""); - assertEquals("24:00:00",CalcUtil.getCellText("Sheet1.C2")); - - CalcUtil.selectRange("Sheet1.C3"); - SC_CellInput.activate(); - typeKeys("12:00"); - typeKeys(""); - sleep(1); - assertEquals("Invalid value",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.C3")); - } - -} - --- src/testcase/sc/celltext/InsertColumnsFromMainMenu.java (revision 1362802) +++ src/testcase/sc/celltext/InsertColumnsFromMainMenu.java (working copy) @@ -1,115 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.celltext; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -public class InsertColumnsFromMainMenu { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Insert columns from main menu. - * - * @throws Exception - */ - @Test - public void insertColumnsFromMainMenu(){ - //Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - //input Test123 into cell A1 - String expect="Test123"; - CalcUtil.selectRange("A1"); - typeKeys(expect+""); - CalcUtil.selectRange("A1"); - //Insert 1 columns before column A form main menu,so Cell A1 move B1, check it - calc.menuItem("Insert->Columns...").select(); - assertEquals("1",SC_NumberOfColumnsRowsToInsert.getText()); - SC_InsertColumnsRowsdialog.ok(); - sleep(1); - assertEquals(expect,CalcUtil.getCellText("B1")); - - //Check the default insert column number is same as columns you select - CalcUtil.selectRange("E1"); - typeKeys(expect + ""); - CalcUtil.selectRange("A1:D4"); - calc.menuItem("Insert->Columns...").select(); - assertEquals("4",SC_NumberOfColumnsRowsToInsert.getText()); - - //insert 4 column number after select column, then E1 move to I1, check it - SC_InsertColumnsRowsAfterSelectColumn.check(); - assertTrue(SC_InsertColumnsRowsAfterSelectColumn.isEnabled()); - SC_InsertColumnsRowsdialog.ok(); - sleep(1); - assertEquals(expect,CalcUtil.getCellText("I1")); - - //input 1024 in insert columns number, then the warning dialog pop up check it - CalcUtil.selectRange("A1"); - calc.menuItem("Insert->Columns...").select(); - SC_NumberOfColumnsRowsToInsert.setText("1024"); - SC_InsertColumnsRowsdialog.ok(); - assertEquals("Filled cells cannot be shifted" + "\n" - + "beyond the sheet.", - ActiveMsgBox.getMessage()); - typeKeys(""); - } - -} --- src/testcase/sc/validity/FFCNotIgnoreBlank.java (revision 1362802) +++ src/testcase/sc/validity/FFCNotIgnoreBlank.java (working copy) @@ -1,98 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.fullPath; -import static testlib.AppUtil.initApp; -import static testlib.AppUtil.openStartcenter; -import static testlib.AppUtil.submitSaveDlg; -import static testlib.AppUtil.submitOpenDlg; -import static testlib.AppUtil.testFile; -import static testlib.UIMap.startcenter; -import static testlib.UIMap.*; - -import java.io.File; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - -import testlib.CalcUtil; -import testlib.Log; -import testlib.UIMap; - -public class FFCNotIgnoreBlank { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - /** - * TestCapture helps us to doCalcUtil - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test open MS 2003 spreadsheet with ignore blank validity. - * - * @throws Exception - */ - @Test - public void testFFCNotIgnoreBlank() throws Exception{ - //open sample file - String file = testFile("sc/FFC252FFCSC_XML_Datarange0205.xls"); - startcenter.menuItem("File->Open").select(); - submitOpenDlg(file); - - CalcUtil.selectRange("F5"); - SC_CellInput.activate(); - typeKeys(""); - typeKeys(""); - - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - } - - - -} --- src/testcase/sc/sort/SortOptionsMultipleSortDataOverlap.java (revision 1362802) +++ src/testcase/sc/sort/SortOptionsMultipleSortDataOverlap.java (working copy) @@ -1,169 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortOptionsMultipleSortDataOverlap { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort options: multiple sort, data overlap - * @throws Exception - */ - @Test - public void testSortOptionsMultipleSortDataOverlap() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data1 = new String[][] { - {"D"}, - {"C"}, - {"B"}, - {"A"}, - {"E"}, - }; - String[][] expectedSortedResult1 = new String[][] { - {"A"}, - {"B"}, - {"C"}, - {"D"}, - {"E"}, - }; - String[][] data2 = new String[][] { - {"4"}, - {"2"}, - {"5"}, - {"1"}, - {"3"}, - }; - String[][] expectedSortedResultDataOverlap = new String[][] { - {"A"}, - {"B"}, - {"C"}, - {"1"}, - {"2"}, - {"3"}, - {"4"}, - {"5"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("DCBAE"); - - // "Data->Sort...", uncheck "Range contains column labels", sort first by "Column A", "Ascending" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.uncheck(); - SortPage.select(); - SortPage_By1.select("Column A"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); - - // Input data2 into same sheet, data1 and data2 are not overlapped - CalcUtil.selectRange("G10"); - typeKeys("42513"); - - // Focus on data2, "Data->Sort...", "Copy result to" partially overlap with data1, sort first by "Column G", "Ascending" - CalcUtil.selectRange("G10"); - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.uncheck(); - SortOptionsPage_CopyResultTo.check(); - SortOptionsPage_CopyResultToEdit.setText("A4"); - SortPage.select(); - SortPage_By1.select("Column G"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result data overlap", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8")); - - // Save and close document - String saveTo = fullPath("temp/" + "SortOptionsMultipleSortDataOverlap.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Saved sorted result", expectedSortedResultDataOverlap, CalcUtil.getCellTexts("A1:A8")); - assertArrayEquals("Original data2", data2, CalcUtil.getCellTexts("G10:G14")); - } -} --- src/testcase/sc/datapilot/SortFunctionInGroupedField.java (revision 1362802) +++ src/testcase/sc/datapilot/SortFunctionInGroupedField.java (working copy) @@ -1,159 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class SortFunctionInGroupedField { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while add fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - CalcUtil.selectRange("B4:C4"); - SpreadSheetCells.openContextMenu(); - menuItem("Group->Group Selected Items").select(); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellInput("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - CalcUtil.selectRange("B3"); - SpreadSheetCells.openContextMenu(); - menuItem("Field Option...").select(); - DataPilotFieldOptionSortTabPageDialog.select(); - - DataPilotFieldOptionSortDescendingRadioButton.check(); - DataPilotFieldOptionFieldTabPageDialog.select(); - DataPilotFieldOptionFieldTabPageDialog.ok(); - sleep(1); - - assertEquals("Kevin Wang",CalcUtil.getCellText("B4")); - assertEquals("Group1",CalcUtil.getCellText("F4")); - assertEquals("Bill Zhang",CalcUtil.getCellText("I4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - - typeKeys("<$undo>"); - assertEquals("Bill Zhang",CalcUtil.getCellText("B4")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("Kevin Wang",CalcUtil.getCellText("I4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Kevin Wang",CalcUtil.getCellText("B4")); - assertEquals("Group1",CalcUtil.getCellText("F4")); - assertEquals("Bill Zhang",CalcUtil.getCellText("I4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - } - -} --- src/testcase/sc/sort/SortCriteriaSortFirstBy.java (revision 1362802) +++ src/testcase/sc/sort/SortCriteriaSortFirstBy.java (working copy) @@ -1,150 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortCriteriaSortFirstBy { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort criteria: sort first by - * @throws Exception - */ - @Test - public void testSortCriteriaSortFirstBy() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"3", "D"}, - {"5", "FLK"}, - {"4", "E"}, - {"2", "BC"}, - {"6", "GE"}, - {"1", "AB"}, - }; - String[][] expectedResultSortByColumnBAscending = new String[][] { - {"1", "AB"}, - {"2", "BC"}, - {"3", "D"}, - {"4", "E"}, - {"5", "FLK"}, - {"6", "GE"}, - }; - String[][] expectedResultSortByColumnADescending = new String[][] { - {"6", "GE"}, - {"5", "FLK"}, - {"4", "E"}, - {"3", "D"}, - {"2", "BC"}, - {"1", "AB"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("354261"); - CalcUtil.selectRange("B1"); - typeKeys("DFLKEBCGEAB"); - - // "Data->Sort...", choose "Ascending", sort first by Column B - calc.menuItem("Data->Sort...").select(); - SortPage_Ascending1.check(); - SortPage_By1.select("Column B"); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:B6")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultSortByColumnBAscending, CalcUtil.getCellTexts("A1:B6")); - calc.menuItem("Edit->Undo: Sort").select(); - - // Save and close document - String saveTo = fullPath("temp/" + "SortCriteriaSortFirstBy.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen, "Data->Sort...", choose "Descending", sort first by Column A - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - calc.menuItem("Data->Sort...").select(); - SortPage_Descending1.check(); - SortPage_By1.select("Column A"); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Saved sorted result", expectedResultSortByColumnADescending, CalcUtil.getCellTexts("A1:B6")); - } -} --- src/testcase/sc/validity/AllowLessThanTextLength.java (revision 1362802) +++ src/testcase/sc/validity/AllowLessThanTextLength.java (working copy) @@ -1,140 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowLessThanTextLength { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow Text length, less than in Validity. - */ - @Test - public void testAllowLessThanTextLength() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:B5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Text length"); - SC_ValidityDecimalCompareOperator.select("less than"); - SC_ValiditySourceInput.setText("10"); - - SC_ValidityInputHelpTabPage.select(); - SC_ValidityInputHelpCheckbox.check(); - SC_ValidityInputHelpTitle.setText("Help Info Title"); - SC_ValidityHelpMessage.setText("help info"); - - SC_ValidityErrorAlertTabPage.select(); - SC_ValidityShowErrorMessage.check(); - SC_ValidityErrorAlertActionList.select("Information"); - SC_ValidityErrorMessageTitle.setText("Notes to enter"); - SC_ValidityErrorMessage.setText("Invalid value"); - typeKeys(""); - typeKeys(""); - sleep(1); - - - CalcUtil.selectRange("Sheet1.A1"); - SC_CellInput.activate(); - typeKeys("testtesttesttest"); - typeKeys(""); - ActiveMsgBox.ok(); - assertEquals("Testtesttesttest",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("sfsafsddddddd"); - typeKeys(""); - sleep(1); - ActiveMsgBox.focus(); - typeKeys(""); - typeKeys(""); - assertEquals("",CalcUtil.getCellText("Sheet1.A2")); - - CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys("10"); - typeKeys(""); - sleep(1); - assertEquals("10",CalcUtil.getCellText("Sheet1.A2")); - - -// CalcUtil.selectRange("Sheet1.A2"); - SC_CellInput.activate(); - typeKeys(""); - typeKeys(""); - typeKeys("ok"); - typeKeys(""); - assertEquals("Ok",CalcUtil.getCellText("Sheet1.A2")); - - - } - -} - --- src/testcase/sc/validity/ValidityUICellRange.java (revision 1362802) +++ src/testcase/sc/validity/ValidityUICellRange.java (working copy) @@ -1,87 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class ValidityUICellRange { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Data -> Validity - UI(Criteria: Cell range). - */ - @Test - public void testValidityUICellRange() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - calc.menuItem("Data->Validity...").select(); - sleep(1); - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("Cell range"); - - assertEquals(true,SC_ValidityAllowBlankCells.isChecked()); - assertEquals(true,SC_ValidityShowSelectionList.isChecked()); - assertEquals(false,SC_ValiditySortEntriesAscending.isChecked()); - assertEquals(true,SC_ValidityAllowBlankCells.isEnabled()); - assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled()); - assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled()); - assertEquals(true,SC_ValiditySourcePicker.isEnabled()); - - } - -} - --- src/testcase/sc/validity/AllowList.java (revision 1362802) +++ src/testcase/sc/validity/AllowList.java (working copy) @@ -1,118 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.vcl.IDList; -import org.openoffice.test.vcl.widgets.VclMessageBox; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class AllowList { - private static IDList idList = new IDList(new File("./ids")); - public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box."); - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Allow list. - */ - @Test - public void testAllowListSpecialChar() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - - CalcUtil.selectRange("Sheet1.A1:C5"); - calc.menuItem("Data->Validity...").select(); - sleep(1); - - SC_ValidityCriteriaTabpage.select(); - SC_ValidityCriteriaAllowList.select("List"); - SC_ValidityEntries.focus(); - typeKeys("a"); - typeKeys(""); - typeKeys("b"); - typeKeys(""); - typeKeys(""); - int[] A1loc=CalcUtil.parseLocation("A1"); - calc.rightClick(A1loc[1], A1loc[0]); - typeKeys(""); - typeKeys(""); - typeKeys(""); - sleep(1); - typeKeys(""); - typeKeys(""); - assertEquals("b",CalcUtil.getCellText("Sheet1.A1")); - - calc.rightClick(A1loc[1], A1loc[0]); - typeKeys(""); - typeKeys(""); - typeKeys(""); - sleep(1); - typeKeys(""); - assertEquals("a",CalcUtil.getCellText("Sheet1.A1")); - - CalcUtil.selectRange("Sheet1.B2"); - SC_CellInput.activate(); - typeKeys("test"); - typeKeys(""); - assertEquals("Invalid value.",ActiveMsgBox.getMessage()); - ActiveMsgBox.ok(); - assertEquals("",CalcUtil.getCellText("Sheet1.B2")); - - } -} --- src/testcase/sc/datapilot/DragMoveFunctionOfGroupedField.java (revision 1362802) +++ src/testcase/sc/datapilot/DragMoveFunctionOfGroupedField.java (working copy) @@ -1,151 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class DragMoveFunctionOfGroupedField { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that Verify the Drag/Move function of Grouped field - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - CalcUtil.selectRange("B4:C4"); - SpreadSheetCells.openContextMenu(); - menuItem("Group->Group Selected Items").select(); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellText("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - DataPilotColumnArea.click(1,1); - DataPilotColumnArea.openContextMenu(); - menuItem("Move to Row").select(); - assertEquals("Name2",CalcUtil.getCellText("B4")); - assertEquals("Group1",CalcUtil.getCellText("B6")); - assertEquals("266773",CalcUtil.getCellText("K31")); - sleep(1); - - typeKeys("<$undo>"); - assertEquals("Name2",CalcUtil.getCellText("B3")); - assertEquals("Name",CalcUtil.getCellText("C3")); - assertEquals("Group1",CalcUtil.getCellText("D4")); - assertEquals("266773",CalcUtil.getCellText("J24")); - sleep(1); - - typeKeys("<$redo>"); - assertEquals("Name2",CalcUtil.getCellText("B4")); - assertEquals("Group1",CalcUtil.getCellText("B6")); - assertEquals("266773",CalcUtil.getCellText("K31")); - } - -} --- src/testcase/sc/datapilot/RemoveFieldsDiscardChange.java (revision 1362802) +++ src/testcase/sc/datapilot/RemoveFieldsDiscardChange.java (working copy) @@ -1,158 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class RemoveFieldsDiscardChange { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while remove fields on panel. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - DataPilotFieldSelect.click(1,30); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Column").select(); - assertEquals("Name",CalcUtil.getCellText("A3")); - sleep(1); - - DataPilotFieldSelect.click(1,50); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Row").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - sleep(1); - - DataPilotFieldSelect.click(1,70); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Data by->Sum").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - DataPilotAutomaticallyUpdateCheckBox.uncheck(); - - DataPilotColumnArea.drag(1, 1, -30, 1); - assertEquals("Name",CalcUtil.getCellText("B3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - DataPilotPaneRowArea.click(1,1); - DataPilotPaneRowArea.openContextMenu(); - menuItem("Remove").select(); - assertEquals("Date",CalcUtil.getCellText("A4")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - DataPilotPanePageArea.drag(1, 1, -30, 1); - assertEquals("Locale",CalcUtil.getCellText("A1")); - assertEquals("266773",CalcUtil.getCellText("J23")); - sleep(1); - - DataPiloPaneDataArea.openContextMenu(); - menuItem("Remove").select(); - assertEquals("Sum - Order Number",CalcUtil.getCellText("A3")); - assertEquals("266773",CalcUtil.getCellText("J23")); - - CalcUtil.selectRange("B25"); - ActiveMsgBox.yes(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - DataPilotAutomaticallyUpdateCheckBox.check(); - } - -} --- src/testcase/sc/sort/SortOptionsCustomSortOrderPredefineFromCopyList.java (revision 1362802) +++ src/testcase/sc/sort/SortOptionsCustomSortOrderPredefineFromCopyList.java (working copy) @@ -1,215 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortOptionsCustomSortOrderPredefineFromCopyList { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort options: custom sort order, predefined in preferences from copy list - * @throws Exception - */ - @Test - public void testSortOptionsCustomSortOrderPredefineFromCopyList() throws Exception{ - - // Dependencies start - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data -// String[][] copiedSortList = new String[][] { -// {"red"}, -// {"yellow"}, -// {"blue"}, -// {"green"}, -// {"white"}, -// {"black"}, -// }; - CalcUtil.selectRange("A1"); - typeKeys("redyellowbluegreenwhiteblack"); - CalcUtil.selectRange("A1:A6"); - calc.menuItem("Format->Change Case->Lowercase").select(); // In case SC capitalize first letter automatically - - // Select the cell range, "Tools->Options...->OpenOffice.org Spreadsheets->Sort Lists" - CalcUtil.selectRange("A1:A6"); - typeKeys(""); - OptionsDlgList.select(15); // Select "OpenOffice.org Spreadsheets" - typeKeys(""); // Expand "OpenOffice.org Spreadsheets" - OptionsDlgList.select(19); // Select "Sort Lists" - - // Click "Copy" button, "OK", close the document - OptionsDlg_Copy.click(); - OptionsDlg.ok(); - calc.menuItem("File->Close").select(); - MsgBox_AdditionalRowsNotSaved.no(); - // Dependencies end - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"Color"}, - {"black"}, - {"yellow"}, - {"blue"}, - {"black"}, - {"white"}, - {"red"}, - }; - String[][] expectedResultNoCustomSortOrder = new String[][] { - {"Color"}, - {"black"}, - {"black"}, - {"blue"}, - {"red"}, - {"white"}, - {"yellow"}, - }; - String[][] expectedResultCustomSortOrder = new String[][] { - {"Color"}, - {"red"}, - {"yellow"}, - {"blue"}, - {"white"}, - {"black"}, - {"black"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("Colorblackyellowblueblackwhitered"); - CalcUtil.selectRange("A2:A7"); - calc.menuItem("Format->Change Case->Lowercase").select(); // In case SC capitalize first letter automatically - - // "Data->Sort...", "Options" tab, check "Range contains column labels", no custom sort order, "Ascending", sort first by Color - CalcUtil.selectRange("A1:A7"); - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_CustomSortOrder.uncheck(); - SortPage.select(); - SortPage_By1.select("Color"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result without custom sort order", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultNoCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Undo: Sort").select(); - - // Copy original data to sheet2 - CalcUtil.selectRange("A1:A7"); - calc.menuItem("Edit->Copy").select(); - CalcUtil.selectRange("Sheet2.A1"); - calc.menuItem("Edit->Paste").select(); - sleep(1); - - // "Data->Sort...", "Options" tab, check "Range contains column labels", choose custom sort order, "Ascending", sort first by Color - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_CustomSortOrder.check(); - SortOptionsPage_CustomSortOrderList.select("red,yellow,blue,green,white,black"); - SortPage.select(); - SortPage_By1.select("Color"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result with custom sort order", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("A1:A7")); - - // Save and close document - String saveTo = fullPath("temp/" + "SortOptionsCustomSortOrderPredefineFromCopyList.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Original data", data, CalcUtil.getCellTexts("$Sheet1.$A1:$A7")); - assertArrayEquals("Saved sorted result", expectedResultCustomSortOrder, CalcUtil.getCellTexts("$Sheet2.$A1:$A7")); - } -} --- src/testcase/sc/sort/SortOptionsMultipleSortParameterSaved.java (revision 1362802) +++ src/testcase/sc/sort/SortOptionsMultipleSortParameterSaved.java (working copy) @@ -1,190 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortOptionsMultipleSortParameterSaved{ - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort options: multiple sort, no data overlap, sort parameter saved correctly - * @throws Exception - */ - @Test - public void testSortOptionsMultipleSortSortParameterSaved() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data1 = new String[][] { - {"D"}, - {"C"}, - {"B"}, - {"A"}, - {"E"}, - }; - String[][] expectedSortedResult1 = new String[][] { - {"A"}, - {"B"}, - {"C"}, - {"D"}, - {"E"}, - }; - String[][] data2 = new String[][] { - {"Numbers"}, - {"4"}, - {"2"}, - {"5"}, - {"1"}, - {"3"}, - }; - String[][] expectedSortedResult2 = new String[][] { - {"Numbers"}, - {"1"}, - {"2"}, - {"3"}, - {"4"}, - {"5"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("DCBAE"); - - // "Data->Sort...", uncheck "Range contains column labels", check "Case sensitive" and "Include formats", sort first by "Column A", "Ascending" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.uncheck(); - SortOptionsPage_CaseSensitive.check(); - SortOptionsPage_IncludeFormats.check(); - SortPage.select(); - SortPage_By1.select("Column A"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", data1, CalcUtil.getCellTexts("A1:A5")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); - - // Input data2 into same sheet, data1 and data2 are not overlapped - CalcUtil.selectRange("G10"); - typeKeys("Numbers42513"); - - // Focus on data2, "Data->Sort...", check "Range contains column labels", uncheck "Case sensitive" and "Include formats", sort first by "Numbers", "Ascending" - CalcUtil.selectRange("G10"); - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_CaseSensitive.uncheck(); - SortOptionsPage_IncludeFormats.uncheck(); - SortPage.select(); - SortPage_By1.select("Numbers"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", data2, CalcUtil.getCellTexts("G10:G15")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15")); - - // Open sort dialog, check its setting - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked()); - assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked()); - assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked()); - SortOptionsPage.ok(); - - // Save and close document - String saveTo = fullPath("temp/" + "SortOptionsMultipleSortParameterSaved.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result and sort parameters - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Saved sorted result1", expectedSortedResult1, CalcUtil.getCellTexts("A1:A5")); - assertArrayEquals("Saved sorted result2", expectedSortedResult2, CalcUtil.getCellTexts("G10:G15")); - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - assertTrue("Range contains column labels should be checked", SortOptionsPage_RangeContainsColumnLabels.isChecked()); - assertFalse("Case sensitive should not be checked", SortOptionsPage_CaseSensitive.isChecked()); - assertFalse("Include formats should not be checked", SortOptionsPage_IncludeFormats.isChecked()); - SortOptionsPage.ok(); - } -} --- src/testcase/sc/sheet/InsertSheet.java (revision 1362802) +++ src/testcase/sc/sheet/InsertSheet.java (working copy) @@ -21,14 +21,11 @@ package testcase.sc.sheet; import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; import static testlib.UIMap.*; - import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; - import testlib.Log; /** @@ -41,7 +38,7 @@ @Rule public Log LOG = new Log(); - + @Before public void setUp() throws Exception { app.start(); @@ -53,7 +50,7 @@ public void tearDown() throws Exception { app.close(); } - + /** * Insert one sheet in different place * @throws Exception @@ -71,7 +68,7 @@ assertArrayEquals(new String[] { "Sheet4", "Sheet5", "Sheet6", "Sheet1", "Sheet2", "Sheet3" }, SCSheetsList.getItemsText()); SCSelectSheetsDlg.ok(); } - + /** * Insert one sheet in different place * @throws Exception --- src/testcase/sc/chart/ChartWizardTitle.java (revision 1362802) +++ src/testcase/sc/chart/ChartWizardTitle.java (working copy) @@ -1,86 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.chart; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class ChartWizardTitle { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify Chart Wizard dialog title words - */ - @Test - public void test() { - // Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - calc.menuItem("Insert->Chart...").select(); - assertEquals("Chart Wizard",Chart_Wizard.getText()); - Chart_Wizard.cancel(); - } - -} --- src/testcase/sc/validity/NotLockCellFromValidityCell.java (revision 1362802) +++ src/testcase/sc/validity/NotLockCellFromValidityCell.java (working copy) @@ -1,82 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.validity; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - - -import testlib.CalcUtil; -import testlib.Log; - - -public class NotLockCellFromValidityCell { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * test Cell is not locked after switch from validity cell to source cells - */ - @Test - public void testNotLockCellFromValidityCell() { - //open sample file on data path - String file = testFile("sc/sampledata.ods"); - startcenter.menuItem("File->Open").select(); - submitOpenDlg(file); - - CalcUtil.selectRange("Sheet1.F19"); - typeKeys("d"+""); - CalcUtil.selectRange("Sheet1.F17"); - typeKeys("Test"+""); - - assertEquals("Test",CalcUtil.getCellText("F17")); - } - -} --- src/testcase/sc/sort/SortOptionsIncludeFormats.java (revision 1362802) +++ src/testcase/sc/sort/SortOptionsIncludeFormats.java (working copy) @@ -1,222 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortOptionsIncludeFormats { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort options: "Include formats" - * @throws Exception - */ - @Test - public void testSortOptionsIncludeFormats() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data -// String[][] data = new String[][] { -// {"Units"}, -// {"32"}, -// {"57"}, -// {"74"}, -// {"50"}, -// {"27"}, -// {"7"}, -// }; - String[][] dataWithCurrencyFormats = new String[][] { - {"Units"}, - {"$32.00"}, - {"57.00 \u20ac"}, - {"\u20a4 74"}, - {"R$ 50.00"}, - {"\u062c.\u0645. 27.00"}, - {"7.00 \u0440\u0443\u0431."}, - }; - String[][] expectedSortedResultIncludeFormat = new String[][] { - {"Units"}, - {"7.00 \u0440\u0443\u0431."}, - {"\u062c.\u0645. 27.00"}, - {"$32.00"}, - {"R$ 50.00"}, - {"57.00 \u20ac"}, - {"\u20a4 74"}, - }; - String[][] expectedSortedResultExcludeFormat = new String[][] { - {"Units"}, - {"$7.00"}, - {"27.00 \u20ac"}, - {"\u20a4 32"}, - {"R$ 50.00"}, - {"\u062c.\u0645. 57.00"}, - {"74.00 \u0440\u0443\u0431."}, - }; - CalcUtil.selectRange("A1"); - typeKeys("Units32577450277"); - - // Set Currency formats - CalcUtil.selectRange("A2"); - typeKeys(""); -// calc.menuItem("Fortmat->Cells...").select(); error: can not find item "Format" - FormatCellsDlg_NumbersPage.select(); - FormatCellsDlg_NumbersPageCategory.select("Currency"); - FormatCellsDlg_NumbersPageCurrencyFormat.select("$ English (USA)"); - FormatCellsDlg_NumbersPage.ok(); - CalcUtil.selectRange("A3"); - typeKeys(""); - FormatCellsDlg_NumbersPage.select(); - FormatCellsDlg_NumbersPageCategory.select("Currency"); - FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20ac Spanish (Spain)"); - FormatCellsDlg_NumbersPage.ok(); - CalcUtil.selectRange("A4"); - typeKeys(""); - FormatCellsDlg_NumbersPage.select(); - FormatCellsDlg_NumbersPageCategory.select("Currency"); - FormatCellsDlg_NumbersPageCurrencyFormat.select("\u20a4 Latin"); - FormatCellsDlg_NumbersPage.ok(); - CalcUtil.selectRange("A5"); - typeKeys(""); - FormatCellsDlg_NumbersPage.select(); - FormatCellsDlg_NumbersPageCategory.select("Currency"); - FormatCellsDlg_NumbersPageCurrencyFormat.select("R$ Portuguese (Brazil)"); - FormatCellsDlg_NumbersPage.ok(); - CalcUtil.selectRange("A6"); - typeKeys(""); - FormatCellsDlg_NumbersPage.select(); - FormatCellsDlg_NumbersPageCategory.select("Currency"); - FormatCellsDlg_NumbersPageCurrencyFormat.select("\u062c.\u0645. Arabic (Egypt)"); - FormatCellsDlg_NumbersPage.ok(); - CalcUtil.selectRange("A7"); - typeKeys(""); - FormatCellsDlg_NumbersPage.select(); - FormatCellsDlg_NumbersPageCategory.select("Currency"); - FormatCellsDlg_NumbersPageCurrencyFormat.select("\u0440\u0443\u0431. Russian"); - FormatCellsDlg_NumbersPage.ok(); - - // "Data->Sort...", check "Range contains column labels", check "Include formats", sort first by "Units", "Ascending" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_IncludeFormats.check(); - SortPage.select(); - SortPage_By1.select("Units"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result include formats", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResultIncludeFormat, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Undo: Sort").select(); - - // Copy the original data to sheet2 - CalcUtil.selectRange("A1:A7"); - calc.menuItem("Edit->Copy").select(); - CalcUtil.selectRange("Sheet2.A1"); - calc.menuItem("Edit->Paste").select(); - sleep(1); - - // "Data->Sort...", check "Range contains column labels", uncheck "Include formats", sort first by "Units", "Ascending" - calc.menuItem("Data->Sort...").select(); - SortOptionsPage.select(); - SortOptionsPage_RangeContainsColumnLabels.check(); - SortOptionsPage_IncludeFormats.uncheck(); - SortPage.select(); - SortPage_By1.select("Units"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result exclude formats", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - assertArrayEquals("Undo sorted result", dataWithCurrencyFormats, CalcUtil.getCellTexts("A1:A7")); - calc.menuItem("Edit->Redo: Sort").select(); - assertArrayEquals("Redo sorted result", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("A1:A7")); - - // Save and close document - String saveTo = fullPath("temp/" + "SortOptionsIncludeFormats.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify sorted result - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Original data", dataWithCurrencyFormats, CalcUtil.getCellTexts("$Sheet1.$A1:$A7")); - assertArrayEquals("Saved sorted result exclude format", expectedSortedResultExcludeFormat, CalcUtil.getCellTexts("$Sheet2.$A1:$A7")); - } -} --- src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java (revision 1362802) +++ src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java (working copy) @@ -24,7 +24,7 @@ /** * */ -package testcase.presentation.headerandfooter; +package testcase.sd.headerandfooter; import static testlib.AppUtil.fullPath; import static testlib.AppUtil.openStartcenter; --- src/testcase/sc/sort/SortCriteriaSortThirdBy.java (revision 1362802) +++ src/testcase/sc/sort/SortCriteriaSortThirdBy.java (working copy) @@ -1,211 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.sort; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.sleep; -import static org.openoffice.test.vcl.Tester.typeKeys; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - */ -public class SortCriteriaSortThirdBy { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - - /** - * Test sort criteria: sort third by - * @throws Exception - */ - @Test - public void testSortCriteriaSortThirdBy() throws Exception{ - - // Create a new spreadsheet document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - - // Input some data - String[][] data = new String[][] { - {"3", "AB", "2"}, - {"8", "FLK", "5"}, - {"6", "E", "4"}, - {"1", "AB", "1"}, - {"9", "GE", "6"}, - {"2", "AB", "2"}, - {"7", "EFYU", "7"}, - {"5", "DS", "8"}, - {"4", "AB", "1"}, - }; - String[][] expectedResultSortFirstByB = new String[][] { - {"3", "AB", "2"}, - {"1", "AB", "1"}, - {"2", "AB", "2"}, - {"4", "AB", "1"}, - {"5", "DS", "8"}, - {"6", "E", "4"}, - {"7", "EFYU", "7"}, - {"8", "FLK", "5"}, - {"9", "GE", "6"}, - }; - String[][] expectedResultSortSecondByC= new String[][] { - {"3", "AB", "2"}, - {"2", "AB", "2"}, - {"1", "AB", "1"}, - {"4", "AB", "1"}, - {"5", "DS", "8"}, - {"6", "E", "4"}, - {"7", "EFYU", "7"}, - {"8", "FLK", "5"}, - {"9", "GE", "6"}, - }; - String[][] expectedResultSortThirdByA= new String[][] { - {"3", "AB", "2"}, - {"2", "AB", "2"}, - {"4", "AB", "1"}, - {"1", "AB", "1"}, - {"5", "DS", "8"}, - {"6", "E", "4"}, - {"7", "EFYU", "7"}, - {"8", "FLK", "5"}, - {"9", "GE", "6"}, - }; - CalcUtil.selectRange("A1"); - typeKeys("386192754"); - CalcUtil.selectRange("B1"); - typeKeys("ABFLKEABGEABEFYUDSAB"); - CalcUtil.selectRange("C1"); - typeKeys("254162781"); - sleep(0.5); - - // "Data->Sort...", choose "Ascending", sort first by Column B - calc.menuItem("Data->Sort...").select(); - SortPage_By1.select("Column B"); - SortPage_Ascending1.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", data, CalcUtil.getCellTexts("A1:C9")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultSortFirstByB, CalcUtil.getCellTexts("A1:C9")); - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - - // Save and close document - String saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen, "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending" - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - calc.menuItem("Data->Sort...").select(); - SortPage_By1.select("Column B"); - SortPage_Ascending1.check(); - SortPage_By2.select("Column C"); - SortPage_Descending2.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9")); - - // "Data->Sort...", sort first by Column B "Ascending", sort second by Column C "Descending", sort third by Column A "Descending" - calc.menuItem("Data->Sort...").select(); - SortPage_By1.select("Column B"); - SortPage_Ascending1.check(); - SortPage_By2.select("Column C"); - SortPage_Descending2.check(); - SortPage_By3.select("Column A"); - SortPage_Descending3.check(); - SortPage.ok(); - - // Verify sorted result - assertArrayEquals("Sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9")); - - // Uodo/redo - calc.menuItem("Edit->Undo: Sort").select(); - sleep(1); - assertArrayEquals("Undo sorted result", expectedResultSortSecondByC, CalcUtil.getCellTexts("A1:C9")); - calc.menuItem("Edit->Redo: Sort").select(); - sleep(1); - assertArrayEquals("Redo sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9")); - - // Save and close document - saveTo = fullPath("temp/" + "SortCriteriaSortThirdBy1.ods"); - calc.menuItem("File->Save As...").select(); - FileUtil.deleteFile(saveTo); - submitSaveDlg(saveTo); - calc.menuItem("File->Close").select(); - openStartcenter(); - - // Reopen and verify data sort is not lost - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(saveTo); - calc.waitForExistence(10, 2); - assertArrayEquals("Saved sorted result", expectedResultSortThirdByA, CalcUtil.getCellTexts("A1:C9")); - } -} --- src/testcase/sc/celltext/InsertRowsFromMainMenu.java (revision 1362802) +++ src/testcase/sc/celltext/InsertRowsFromMainMenu.java (working copy) @@ -1,117 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package testcase.sc.celltext; -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -public class InsertRowsFromMainMenu { - - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * Insert rows from main menu. - * - * @throws Exception - */ - @Test - public void insertRowsFromMainMenu(){ - //Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - //input 1 into cell A1 - String expect = "Test123"; - CalcUtil.selectRange("A1"); - typeKeys(expect + ""); - CalcUtil.selectRange("A1"); - // Insert 1 columns before column A form main menu,so Cell A1 move A2, check it - calc.menuItem("Insert->Rows...").select(); - assertEquals("1",SC_NumberOfColumnsRowsToInsert.getText()); - SC_InsertColumnsRowsdialog.ok(); - sleep(1); - assertEquals(expect, CalcUtil.getCellText("A2")); - //input Test123 into A5, select first 4 rows, in insert dialog, the defaul row should be 4, check it - CalcUtil.selectRange("A5"); - typeKeys(expect + ""); - CalcUtil.selectRange("A1:A4"); - calc.menuItem("Insert->Rows...").select(); - assertEquals("4",SC_NumberOfColumnsRowsToInsert.getText()); - - //After insert 4 rows after the selected rows, the A5 move to A9, check it - SC_InsertColumnsRowsAfterSelectColumn.check(); - assertTrue(SC_InsertColumnsRowsAfterSelectColumn.isEnabled()); - SC_InsertColumnsRowsdialog.ok(); - sleep(1); - assertEquals(expect,CalcUtil.getCellText("A9")); - - //Input some value into 1048576 - CalcUtil.selectRange("A1048576"); - typeKeys("1048576"); - assertEquals("1048576",CalcUtil.getCellText("A1048576")); - // Select many rows input 65536 in insert Rows number, verify the warning message, check it - CalcUtil.selectRange("A1:A50000"); - sleep(1); - calc.menuItem("Insert->Rows...").select(); - SC_NumberOfColumnsRowsToInsert.setText("65536"); - SC_InsertColumnsRowsdialog.ok(); - assertEquals("Filled cells cannot be shifted" + "\n" - + "beyond the sheet.", - ActiveMsgBox.getMessage()); - typeKeys(""); - } -} --- src/testcase/sc/filter/AutoFilterSortAscendingMutiColumns.java (revision 1362802) +++ src/testcase/sc/filter/AutoFilterSortAscendingMutiColumns.java (working copy) @@ -1,214 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.filter; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class AutoFilterSortAscendingMutiColumns { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify Auto Filter sort ascending in muti-columns - */ - @Test - public void test() { - String file = testFile("sc/sample_topN3.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - - CalcUtil.selectRange("A1:E200"); - calc.menuItem("Data->Filter->AutoFilter").select(); - SpreadSheetCells.click(72, 8); - typeKeys(""); - typeKeys(""); - typeKeys(""); - assertEquals("A",CalcUtil.getCellText("A1")); - assertEquals("B",CalcUtil.getCellText("B1")); - assertEquals("C",CalcUtil.getCellText("C1")); - assertEquals("D",CalcUtil.getCellText("D1")); - assertEquals("E",CalcUtil.getCellText("E1")); - assertEquals("Item1",CalcUtil.getCellText("A2")); - assertEquals("5",CalcUtil.getCellText("B2")); - assertEquals("246",CalcUtil.getCellText("C2")); - assertEquals("0",CalcUtil.getCellText("D2")); - assertEquals("24",CalcUtil.getCellText("E2")); - assertEquals("Item52",CalcUtil.getCellText("A200")); - assertEquals("52",CalcUtil.getCellText("B200")); - assertEquals("199",CalcUtil.getCellText("C200")); - assertEquals("5",CalcUtil.getCellText("D200")); - assertEquals("19",CalcUtil.getCellText("E200")); - assertEquals("Item99",CalcUtil.getCellText("A251")); - assertEquals("99",CalcUtil.getCellText("B251")); - assertEquals("152",CalcUtil.getCellText("C251")); - assertEquals("9",CalcUtil.getCellText("D251")); - assertEquals("15",CalcUtil.getCellText("E251")); - - CalcUtil.selectRange("A1"); - SpreadSheetCells.click(152, 8); - typeKeys(""); - typeKeys(""); - typeKeys(""); - assertEquals("A",CalcUtil.getCellText("A1")); - assertEquals("B",CalcUtil.getCellText("B1")); - assertEquals("C",CalcUtil.getCellText("C1")); - assertEquals("D",CalcUtil.getCellText("D1")); - assertEquals("E",CalcUtil.getCellText("E1")); - assertEquals("Item1",CalcUtil.getCellText("A2")); - assertEquals("5",CalcUtil.getCellText("B2")); - assertEquals("246",CalcUtil.getCellText("C2")); - assertEquals("0",CalcUtil.getCellText("D2")); - assertEquals("24",CalcUtil.getCellText("E2")); - assertEquals("Item199",CalcUtil.getCellText("A200")); - assertEquals("199",CalcUtil.getCellText("B200")); - assertEquals("52",CalcUtil.getCellText("C200")); - assertEquals("19",CalcUtil.getCellText("D200")); - assertEquals("5",CalcUtil.getCellText("E200")); - assertEquals("Item250",CalcUtil.getCellText("A251")); - assertEquals("250",CalcUtil.getCellText("B251")); - assertEquals("1",CalcUtil.getCellText("C251")); - assertEquals("25",CalcUtil.getCellText("D251")); - assertEquals("0",CalcUtil.getCellText("E251")); - - - CalcUtil.selectRange("A1"); - SpreadSheetCells.click(72, 8); - typeKeys(""); - typeKeys(""); - assertEquals("A",CalcUtil.getCellText("A1")); - assertEquals("B",CalcUtil.getCellText("B1")); - assertEquals("C",CalcUtil.getCellText("C1")); - assertEquals("D",CalcUtil.getCellText("D1")); - assertEquals("E",CalcUtil.getCellText("E1")); - assertEquals("Item99",CalcUtil.getCellText("A2")); - assertEquals("99",CalcUtil.getCellText("B2")); - assertEquals("152",CalcUtil.getCellText("C2")); - assertEquals("9",CalcUtil.getCellText("D2")); - assertEquals("15",CalcUtil.getCellText("E2")); - assertEquals("Item145",CalcUtil.getCellText("A200")); - assertEquals("145",CalcUtil.getCellText("B200")); - assertEquals("106",CalcUtil.getCellText("C200")); - assertEquals("14",CalcUtil.getCellText("D200")); - assertEquals("10",CalcUtil.getCellText("E200")); - assertEquals("Item1",CalcUtil.getCellText("A251")); - assertEquals("5",CalcUtil.getCellText("B251")); - assertEquals("246",CalcUtil.getCellText("C251")); - assertEquals("0",CalcUtil.getCellText("D251")); - assertEquals("24",CalcUtil.getCellText("E251")); - - CalcUtil.selectRange("A1"); - SpreadSheetCells.click(232, 8); - typeKeys(""); - typeKeys(""); - assertEquals("A",CalcUtil.getCellText("A1")); - assertEquals("B",CalcUtil.getCellText("B1")); - assertEquals("C",CalcUtil.getCellText("C1")); - assertEquals("D",CalcUtil.getCellText("D1")); - assertEquals("E",CalcUtil.getCellText("E1")); - assertEquals("Item9",CalcUtil.getCellText("A2")); - assertEquals("5",CalcUtil.getCellText("B2")); - assertEquals("246",CalcUtil.getCellText("C2")); - assertEquals("0",CalcUtil.getCellText("D2")); - assertEquals("24",CalcUtil.getCellText("E2")); - assertEquals("Item199",CalcUtil.getCellText("A200")); - assertEquals("199",CalcUtil.getCellText("B200")); - assertEquals("52",CalcUtil.getCellText("C200")); - assertEquals("19",CalcUtil.getCellText("D200")); - assertEquals("5",CalcUtil.getCellText("E200")); - assertEquals("Item250",CalcUtil.getCellText("A251")); - assertEquals("250",CalcUtil.getCellText("B251")); - assertEquals("1",CalcUtil.getCellText("C251")); - assertEquals("25",CalcUtil.getCellText("D251")); - assertEquals("0",CalcUtil.getCellText("E251")); - - - CalcUtil.selectRange("A1"); - SpreadSheetCells.click(312, 8); - typeKeys(""); - typeKeys(""); - typeKeys(""); - assertEquals("A",CalcUtil.getCellText("A1")); - assertEquals("B",CalcUtil.getCellText("B1")); - assertEquals("C",CalcUtil.getCellText("C1")); - assertEquals("D",CalcUtil.getCellText("D1")); - assertEquals("E",CalcUtil.getCellText("E1")); - assertEquals("Item9",CalcUtil.getCellText("A2")); - assertEquals("5",CalcUtil.getCellText("B2")); - assertEquals("246",CalcUtil.getCellText("C2")); - assertEquals("0",CalcUtil.getCellText("D2")); - assertEquals("24",CalcUtil.getCellText("E2")); - assertEquals("Item199",CalcUtil.getCellText("A200")); - assertEquals("199",CalcUtil.getCellText("B200")); - assertEquals("52",CalcUtil.getCellText("C200")); - assertEquals("19",CalcUtil.getCellText("D200")); - assertEquals("5",CalcUtil.getCellText("E200")); - assertEquals("Item250",CalcUtil.getCellText("A251")); - assertEquals("250",CalcUtil.getCellText("B251")); - assertEquals("1",CalcUtil.getCellText("C251")); - assertEquals("25",CalcUtil.getCellText("D251")); - assertEquals("0",CalcUtil.getCellText("E251")); - } - -} --- src/testcase/sc/validity/ValidityDialogDefaultValue.java (revision 1362802) +++ src/testcase/sc/validity/ValidityDialogDefaultValue.java (working copy) @@ -23,53 +23,58 @@ package testcase.sc.validity; -import static testlib.AppUtil.*; import static testlib.UIMap.*; - import org.junit.After; import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import testlib.Log; -import testlib.CalcUtil; -import testlib.Log; +public class ValidityDialogDefaultValue { - -public class ValidityUIErrorAlert { - /** - * TestCapture helps us to do - * 1. Take a screenshot when failure occurs. - * 2. Collect extra data when OpenOffice crashes. - */ @Rule public Log LOG = new Log(); - - /** - * initApp helps us to do - * 1. Patch the OpenOffice to enable automation if necessary. - * 2. Start OpenOffice with automation enabled if necessary. - * 3. Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ + @Before public void setUp() throws Exception { - initApp(); + app.start(); + + // New a spreadsheet, open Validity dialog + startcenter.menuItem("File->New->Spreadsheet").select(); + calc.menuItem("Data->Validity...").select(); } - + + @After + public void tearDown() throws Exception { + app.close(); + } + /** + * test Data -> Validity - UI(Criteria: Cell range). + */ + @Test + public void testValidityUICellRange() { + + SC_ValidityCriteriaTabpage.select(); + SC_ValidityCriteriaAllowList.select("Cell range"); + + assertEquals(true,SC_ValidityAllowBlankCells.isChecked()); + assertEquals(true,SC_ValidityShowSelectionList.isChecked()); + assertEquals(false,SC_ValiditySortEntriesAscending.isChecked()); + assertEquals(true,SC_ValidityAllowBlankCells.isEnabled()); + assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled()); + assertEquals(true,SC_ValiditySortEntriesAscending.isEnabled()); + assertEquals(true,SC_ValiditySourcePicker.isEnabled()); + } + + /** * test Data -> Validity - UI(Error Alert: Default status) */ @Test public void testValidityUIErrorAlert() { - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(1); - calc.menuItem("Data->Validity...").select(); - sleep(1); + SC_ValidityErrorAlertTabPage.select(); assertEquals(true,SC_ValidityErrorAlertActionList.isEnabled()); assertEquals("Stop",SC_ValidityErrorAlertActionList.getSelText()); @@ -79,7 +84,6 @@ assertEquals("",SC_ValidityErrorMessage.getText()); SC_ValidityErrorAlertActionList.select("Macro"); assertEquals(true,SC_ValidityErrorBrowseButton.isEnabled()); - } } --- src/testcase/sc/datapilot/MoveTableNarrowSpaceToShowTheTable.java (revision 1362802) +++ src/testcase/sc/datapilot/MoveTableNarrowSpaceToShowTheTable.java (working copy) @@ -1,144 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.datapilot; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - - -/** - * - * - */ -public class MoveTableNarrowSpaceToShowTheTable { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify that DP panel will be synchronized with table while move table. - * After the field name get changed, when you refresh the data, the DataPilot table will change to empty table - * if you create table small than the empty table, the table size will get larger - * if there is another DataPilot table exist in the larger range, there will pop a warning. - */ - @Test - public void test() { - String file = testFile("source_data01.ods"); - startcenter.menuItem("File->Open...").select(); - submitOpenDlg(file); - sleep(2); - CalcUtil.selectRange("A1:E27"); - calc.menuItem("Data->DataPilot->Start...").select(); - CreateDataPilotTableDialog.ok(); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - - if(DataPilotAutomaticallyUpdateCheckBox.isChecked()==false){ - DataPilotAutomaticallyUpdateCheckBox.check(); - } - - DataPilotFieldSelect.click(1, 1); - DataPilotFieldSelect.openContextMenu(); - menuItem("Add to Page").select(); - assertEquals("Locale",CalcUtil.getCellText("A1")); - sleep(1); - - CalcUtil.selectRange("A1:B4"); - typeKeys("<$copy>"); - CalcUtil.selectRange("C1"); - typeKeys("<$paste>"); - sleep(1); - - CalcUtil.selectRange("$A.A1"); - typeKeys("New Locale" + ""); - - CalcUtil.selectRange("$DataPilot_A_1.A1"); - SpreadSheetCells.openContextMenu(); - menuItem("Refresh Data").select(); - ActiveMsgBox.ok(); - - CalcUtil.selectRange("A1:B4"); - SpreadSheetCells.drag(80, 45, 80, 350); - - assertEquals("New DataPilot Table",CalcUtil.getCellText("B20")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B22")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B23")); - assertEquals("Page Area",CalcUtil.getCellText("B25")); - assertEquals("Row Area",CalcUtil.getCellText("B28")); - assertEquals("Column Area",CalcUtil.getCellText("D27")); - assertEquals("Data Area",CalcUtil.getCellText("D29")); - DataPilotPanel.close(); - sleep(1); - - CalcUtil.selectRange("C1:D4"); - SpreadSheetCells.drag(210, 50, 10, 50); - assertEquals("New DataPilot Table",CalcUtil.getCellText("B2")); - assertEquals("Use the DataPilot panel to assign fields to areas in the DataPilot table.",CalcUtil.getCellText("B4")); - assertEquals("The DataPilot panel automatically displays when the DataPilot table has focus.",CalcUtil.getCellText("B5")); - assertEquals("Page Area",CalcUtil.getCellText("B7")); - assertEquals("Row Area",CalcUtil.getCellText("B10")); - assertEquals("Column Area",CalcUtil.getCellText("D9")); - assertEquals("Data Area",CalcUtil.getCellText("D11")); - } - -} --- src/testcase/sc/filter/AutoFitlerWithPlusSign.java (revision 1362802) +++ src/testcase/sc/filter/AutoFitlerWithPlusSign.java (working copy) @@ -1,87 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -/** - * - */ -package testcase.sc.filter; - -import static testlib.AppUtil.*; -import static testlib.UIMap.*; - -import java.awt.Rectangle; -import java.io.File; - -import org.junit.After; -import static org.junit.Assert.*; -import static org.openoffice.test.vcl.Tester.*; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openoffice.test.common.FileUtil; -import org.openoffice.test.common.GraphicsUtil; - -import testlib.CalcUtil; -import testlib.Log; - -/** - * - * - */ -public class AutoFitlerWithPlusSign { - /** - * TestCapture helps us to do 1. Take a screenshot when failure occurs. 2. - * Collect extra data when OpenOffice crashes. - */ - @Rule - public Log LOG = new Log(); - - /** - * initApp helps us to do 1. Patch the OpenOffice to enable automation if - * necessary. 2. Start OpenOffice with automation enabled if necessary. 3. - * Reset OpenOffice to startcenter. - * - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - initApp(); - } - /** - * - * Verify Chart Wizard dialog title words - */ - @Test - public void test() { - // Create a new text document - startcenter.menuItem("File->New->Spreadsheet").select(); - sleep(3); - String expect ="2+"; - CalcUtil.selectRange("A1"); - typeKeys(expect + ""); - assertEquals(expect,CalcUtil.getCellText("A1")); - } - -}