### Eclipse Workspace Patch 1.0 #P testoo Index: src/testcase/sc/validity/ValiditySampleFile.java =================================================================== --- src/testcase/sc/validity/ValiditySampleFile.java (revision 0) +++ src/testcase/sc/validity/ValiditySampleFile.java (revision 0) @@ -0,0 +1,116 @@ +/************************************************************** + * + * 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.submitOpenDlg; +import static testlib.AppUtil.testFile; +import static testlib.AppUtil.typeKeys; +import static testlib.UIMap.*; +import static org.junit.Assert.*; +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 testlib.CalcUtil; +import testlib.Log; + +public class ValiditySampleFile { + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + app.start(); + } + + @After + public void tearDown() throws Exception { + app.close(); + } + + /** + * Test open MS 2003 spreadsheet with ignore blank validity. + * + * @throws Exception + */ + @Test + public void testFFCIgnoreBlank() throws Exception{ + // Open sample file + String file = testFile("sc/FFC252FFCSC_XML_Datarange0235.xls"); + app.dispatch(".uno:Open", 3); + submitOpenDlg(file); + calc.waitForExistence(10, 2); + + CalcUtil.selectRange("D5"); + SC_InputBar_Input.activate(); + for(int i=1;i<=10;i++) + 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")); + } +} Index: src/testcase/sc/validity/ValidityDialogSetting.java =================================================================== --- src/testcase/sc/validity/ValidityDialogSetting.java (revision 0) +++ src/testcase/sc/validity/ValidityDialogSetting.java (revision 0) @@ -0,0 +1,639 @@ +/************************************************************** + * + * 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.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 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."); + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + 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() { + 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"); + SC_ValidityErrorAlertTabPage.ok(); + + CalcUtil.selectRange("Sheet1.A1"); + SC_InputBar_Input.activate(); + typeKeys("12/31/07"); + typeKeys(""); + assertEquals("12/31/07",CalcUtil.getCellText("Sheet1.A1")); + + CalcUtil.selectRange("Sheet1.A2"); + SC_InputBar_Input.activate(); + typeKeys("03/02/08"); + typeKeys(""); + assertEquals("03/02/08",CalcUtil.getCellText("Sheet1.A2")); + + CalcUtil.selectRange("Sheet1.A3"); + SC_InputBar_Input.activate(); + typeKeys("01/01/08"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A3")); + + CalcUtil.selectRange("Sheet1.A4"); + SC_InputBar_Input.activate(); + typeKeys("03/01/08"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.A4")); + + CalcUtil.selectRange("Sheet1.A5"); + 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_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_InputBar_Input.activate(); + typeKeys("test"); + typeKeys(""); + assertEquals("Invalid value",ActiveMsgBox.getMessage()); + ActiveMsgBox.ok(); + assertEquals("",CalcUtil.getCellText("Sheet1.B2")); + + CalcUtil.selectRange("Sheet1.B3"); + 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(""); + } +} + Index: src/testcase/sc/chart/ChartDialogSetting.java =================================================================== --- src/testcase/sc/chart/ChartDialogSetting.java (revision 0) +++ src/testcase/sc/chart/ChartDialogSetting.java (revision 0) @@ -0,0 +1,83 @@ +/************************************************************** + * + * 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.UIMap.*; +import org.junit.After; +import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import testlib.Log; + +/** + * Test the setting about chart dialog in spreadsheet + */ +public class ChartDialogSetting { + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + 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 testChartDialogCancelBack() { + calc.menuItem("Insert->Chart...").select(); + WizardNextButton.click(); + assertTrue(ChartRangeChooseTabPage.isEnabled()); + WizardBackButton.click(); + assertTrue(ChartTypeChooseTabPage.isEnabled()); + Chart_Wizard.cancel(); + 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(); + } +} Index: src/testcase/sw/table/Table.java =================================================================== --- src/testcase/sw/table/Table.java (revision 0) +++ src/testcase/sw/table/Table.java (revision 0) @@ -0,0 +1,90 @@ +/************************************************************** + * + * 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.sw.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()); + } +} Index: src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java =================================================================== --- src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java (revision 0) +++ src/testcase/sd/headerandfooter/OpenDocumentWithHeaderFooter.java (revision 0) @@ -0,0 +1,171 @@ +/************************************************************** + * + * 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.sd.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 + } +} Index: src/testcase/sc/sort/SortDialogSetting.java =================================================================== --- src/testcase/sc/sort/SortDialogSetting.java (revision 0) +++ src/testcase/sc/sort/SortDialogSetting.java (revision 0) @@ -0,0 +1,1160 @@ +/************************************************************** + * + * 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.*; +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 SortDialogSetting { + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + app.start(); + + // Create a new spreadsheet document + startcenter.menuItem("File->New->Spreadsheet").select(); + } + + @After + public void tearDown() throws Exception { + app.close(); + } + + /** + * Test sort with options setting: case sensitive + * @throws Exception + */ + @Test + public void testSortOptionsCaseSensitive() throws Exception{ + + // 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"); + 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(); + 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")); + } + + /** + * 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(); + } + +} Index: src/testcase/sc/filter/Fitler.java =================================================================== --- src/testcase/sc/filter/Fitler.java (revision 0) +++ src/testcase/sc/filter/Fitler.java (revision 0) @@ -0,0 +1,72 @@ +/************************************************************** + * + * 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 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 testlib.CalcUtil; +import testlib.Log; + +/** + * Test cases about Data->Filter in spreadsheet + */ +public class Fitler { + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + 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 + */ + @Ignore("Bug 120076") + public void testAutoFilterWithPlusSign() { + String expect ="2+"; + CalcUtil.selectRange("A1"); + typeKeys(expect + ""); + assertEquals(expect,CalcUtil.getCellText("A1")); + } +} Index: src/testcase/sc/datapilot/DataPivotTable.java =================================================================== --- src/testcase/sc/datapilot/DataPivotTable.java (revision 0) +++ src/testcase/sc/datapilot/DataPivotTable.java (revision 0) @@ -0,0 +1,1661 @@ +/************************************************************** + * + * 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 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.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 DataPivotTable { + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + app.start(); + } + + @After + public void tearDown() throws Exception { + app.close(); + } + + /** + * + * Verify copy and paste Data Pilot Table + */ + @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(); + 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")); + } + + /** + * + * 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")); + } +} Index: src/testcase/sc/validity/ValidityDialogDefaultValue.java =================================================================== --- src/testcase/sc/validity/ValidityDialogDefaultValue.java (revision 0) +++ src/testcase/sc/validity/ValidityDialogDefaultValue.java (revision 0) @@ -0,0 +1,90 @@ +/************************************************************** + * + * 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.UIMap.*; +import org.junit.After; +import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import testlib.Log; + + +public class ValidityDialogDefaultValue { + + @Rule + public Log LOG = new Log(); + + @Before + public void setUp() throws Exception { + 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() { + + 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()); + } + +} + Index: src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java =================================================================== --- src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java (revision 0) +++ src/testcase/sd/headerandfooter/HeaderAndFooterSetting.java (revision 0) @@ -0,0 +1,724 @@ +/************************************************************** + * + * 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.sd.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()); + } +}