sc/qa/uitest/calc_tests9/pivotTable.py | 92 +++++++++++++++++++++++++++++++++ sc/qa/uitest/data/basicPivotTable.ods |binary 2 files changed, 92 insertions(+)
New commits: commit e89debccbbe7029ebf97b934cf0dee3c15c53b22 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Feb 4 11:40:26 2021 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Feb 4 15:48:31 2021 +0100 sc: uitest: Add test for cf93998eb5abc193d95ae5433bf4dfd11a9d62d8 Change-Id: I063b4999ad9d04ec658da923e088e16c5edd507e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110405 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/uitest/calc_tests9/pivotTable.py b/sc/qa/uitest/calc_tests9/pivotTable.py new file mode 100644 index 000000000000..d85894bf9af6 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/pivotTable.py @@ -0,0 +1,92 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class pivotTable(UITestCase): + + def test_cancelButton(self): + + # This is basically a test for cf93998eb5abc193d95ae5433bf4dfd11a9d62d8 + # Without the fix in place, this test would have crashed + + self.ui_test.load_file(get_url_for_data_file("basicPivotTable.ods")) + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "1"})) + + self.xUITest.executeCommand(".uno:GoUp") + + + self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun") + + xDialog = self.xUITest.getTopFocusWindow() + + xFields = xDialog.getChild("listbox-fields") + self.assertEqual(2, len(xFields.getChildren())) + self.assertEqual("qtX", get_state_as_dict(xFields.getChild('0'))['Text']) + self.assertEqual("qtY", get_state_as_dict(xFields.getChild('1'))['Text']) + + xColumns = xDialog.getChild("listbox-column") + self.assertEqual(1, len(xColumns.getChildren())) + self.assertEqual("Data", get_state_as_dict(xColumns.getChild('0'))['Text']) + + xPage = xDialog.getChild("listbox-page") + self.assertEqual(1, len(xPage.getChildren())) + xPageChild = xPage.getChild('0') + self.assertEqual("qtX", get_state_as_dict(xPageChild)['Text']) + + def handle_dataField_dialog(dialog): + optionBtn = dialog.getChild("options") + + def handle_options_dialog_first_time(dialog2): + xEmptyLine = dialog2.getChild("emptyline") + + xEmptyLine.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected']) + + xOKBtn = dialog2.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + def handle_options_dialog_second_time(dialog2): + xEmptyLine = dialog2.getChild("emptyline") + + xEmptyLine.executeAction("CLICK", tuple()) + self.assertEqual('false', get_state_as_dict(xEmptyLine)['Selected']) + + xCancelBtn = dialog2.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + def handle_options_dialog_third_time(dialog2): + xEmptyLine = dialog2.getChild("emptyline") + + self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected']) + + xOKBtn = dialog2.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_options_dialog_first_time) + + self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_options_dialog_second_time) + + self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_options_dialog_third_time) + + xOkBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_blocking_action(xPageChild.executeAction, args=('DOUBLECLICK', ()), + dialog_handler=handle_dataField_dialog) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/basicPivotTable.ods b/sc/qa/uitest/data/basicPivotTable.ods new file mode 100644 index 000000000000..27487fd05a11 Binary files /dev/null and b/sc/qa/uitest/data/basicPivotTable.ods differ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits