diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-10-29 13:21:28 +0100 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-10-29 19:13:20 +0100 |
commit | af70b2b888e6baeb0da75eb0beb0dc51325adfed (patch) | |
tree | b1f3fb7e665dbb953f3c40c81f8820958ee16bc5 /sc/qa | |
parent | ec9da7217906f92169edf708a4ec36bac8b88e31 (diff) |
Related tdf#162262 - Move "Summary below data" UI tests to
separate file.
Follow up commit: 26c08356d1b2a963efdca570979cb04388371400
(tdf#162262 sc add "Summary below data" option for Subtotal dialog)
Change-Id: I8e76fe2585993e79454f6079485f191e970e8f5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175786
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Tested-by: Jenkins
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/uitest/sort/subtotals.py | 109 | ||||
-rw-r--r-- | sc/qa/uitest/sort/tdf162262.py | 132 |
2 files changed, 132 insertions, 109 deletions
diff --git a/sc/qa/uitest/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py index 6eddd1bc03b4..b824dcab98c8 100644 --- a/sc/qa/uitest/sort/subtotals.py +++ b/sc/qa/uitest/sort/subtotals.py @@ -137,113 +137,4 @@ class Subtotals(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 1) self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) - def test_tdf162262(self): - with self.ui_test.load_file(get_url_for_data_file("tdf162262.ods")) as calc_doc: - XcalcDoc = self.xUITest.getTopFocusWindow() - gridwin = XcalcDoc.getChild("grid_window") - # One group level - # Select cell range - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C15"})) - # Select from the menu bar Data - # Select option subtotal - # Subtotal dialog displays - with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: - # Select group by: Day - xGroupBy = xDialog.getChild("group_by1") - select_by_text(xGroupBy, "Day") - # Select 'Calculate subtotals for' -> Value 1 and Value 2 - xCheckListMenu = xDialog.getChild("grid1") - xTreeList = xCheckListMenu.getChild("columns1") - xFirstEntry = xTreeList.getChild("1") - xFirstEntry.executeAction("CLICK", tuple()) - xFirstEntry = xTreeList.getChild("2") - xFirstEntry.executeAction("CLICK", tuple()) - - # Select tab options - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") - # Unselect option Summary below -> false - xSummarybelow = xDialog.getChild("summarybelow") - xSummarybelow.executeAction("CLICK", tuple()) - # apply with OK - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Grand Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 105) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 119) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Friday Result") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 19) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 21) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "Wednesday Result") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 20).getValue(), 11) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 20).getValue(), 13) - - def test_tdf162262_multi(self): - with self.ui_test.load_file(get_url_for_data_file("tdf162262.ods")) as calc_doc: - XcalcDoc = self.xUITest.getTopFocusWindow() - gridwin = XcalcDoc.getChild("grid_window") - # Multi group level - # Select cell range - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C15"})) - # Select from the menu bar Data - # Select option subtotal - # Subtotal dialog displays - with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: - # Select group by 1: Day - xGroupBy = xDialog.getChild("group_by1") - select_by_text(xGroupBy, "Day") - # Select 'Calculate subtotals for' -> Value 1 - xCheckListMenu = xDialog.getChild("grid1") - xTreeList = xCheckListMenu.getChild("columns1") - # Select 1 column - xFirstEntry = xTreeList.getChild("1") - xFirstEntry.executeAction("CLICK", tuple()) - - # Select tab Group by 2 - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - # Select group by 2: Day - xGroupBy = xDialog.getChild("group_by2") - select_by_text(xGroupBy, "Day") - # Select 'Calculate subtotals for' -> Value 2 - xCheckListMenu = xDialog.getChild("grid2") - xTreeList = xCheckListMenu.getChild("columns2") - # Select second column - xFirstEntry = xTreeList.getChild("2") - xFirstEntry.executeAction("CLICK", tuple()) - - # Select tab options - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") - # Unselect option Summary below -> false - xSummarybelow = xDialog.getChild("summarybelow") - xSummarybelow.executeAction("CLICK", tuple()) - # apply with OK - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Grand Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 0) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 119) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Grand Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 105) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 0) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getString(), "Friday Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 0) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 21) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getString(), "Friday Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 19) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 0) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 27).getString(), "Wednesday Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 27).getValue(), 0) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 27).getValue(), 13) - - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 28).getString(), "Wednesday Sum") - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 28).getValue(), 11) - self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 28).getValue(), 0) - # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf162262.py b/sc/qa/uitest/sort/tdf162262.py new file mode 100644 index 000000000000..1ecce9d25186 --- /dev/null +++ b/sc/qa/uitest/sort/tdf162262.py @@ -0,0 +1,132 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 uitest.uihelper.common import select_by_text, select_pos +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import get_state_as_dict + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class Subtotals(UITestCase): + + def test_tdf162262(self): + with self.ui_test.load_file(get_url_for_data_file("tdf162262.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + # One group level + # Select cell range + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C15"})) + # Select from the menu bar Data + # Select option subtotal + # Subtotal dialog displays + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # Select group by: Day + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Day") + # Select 'Calculate subtotals for' -> Value 1 and Value 2 + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + xFirstEntry = xTreeList.getChild("1") + xFirstEntry.executeAction("CLICK", tuple()) + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + + # Select tab options + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + # Unselect option Summary below -> false + xSummarybelow = xDialog.getChild("summarybelow") + xSummarybelow.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xSummarybelow)['Selected'], "false") + # apply with OK + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Grand Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 105) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 119) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Friday Result") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 19) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 21) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "Wednesday Result") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 20).getValue(), 11) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 20).getValue(), 13) + + def test_tdf162262_multi(self): + with self.ui_test.load_file(get_url_for_data_file("tdf162262.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + # Multi group level + # Select cell range + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C15"})) + # Select from the menu bar Data + # Select option subtotal + # Subtotal dialog displays + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # Select group by 1: Day + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Day") + # Select 'Calculate subtotals for' -> Value 1 + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + # Select 1 column + xFirstEntry = xTreeList.getChild("1") + xFirstEntry.executeAction("CLICK", tuple()) + + # Select tab Group by 2 + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + # Select group by 2: Day + xGroupBy = xDialog.getChild("group_by2") + select_by_text(xGroupBy, "Day") + # Select 'Calculate subtotals for' -> Value 2 + xCheckListMenu = xDialog.getChild("grid2") + xTreeList = xCheckListMenu.getChild("columns2") + # Select second column + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + + # Select tab options + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + # Unselect option Summary below -> false + xSummarybelow = xDialog.getChild("summarybelow") + xSummarybelow.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xSummarybelow)['Selected'], "false") + # apply with OK + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Grand Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 119) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Grand Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 105) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 0) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getString(), "Friday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 21) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getString(), "Friday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 19) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 0) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 27).getString(), "Wednesday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 27).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 27).getValue(), 13) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 28).getString(), "Wednesday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 28).getValue(), 11) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 28).getValue(), 0) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |