# -*- 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())
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())
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.