Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/Sumcheck_Protocol/   (Archive of formal Proofs Version 2026-5©)  Datei vom 31.4.2026 mit Größe 1 kB image not shown  

SSL consolidate.py

  Sprache: Python
 

# -*- 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 get_state_as_dict, get_url_for_data_file
from uitest.uihelper.common import select_by_text
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues

class consolidate(UITestCase):
    def test_consolidate(self):
        with self.ui_test.load_file(get_url_for_data_file("consolidate.ods")) as calc_doc:
            with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate"as xDialog:
                xfunc = xDialog.getChild("func")
                xlbdataarea = xDialog.getChild("lbdataarea")
                xadd = xDialog.getChild("add")
                xbyrow = xDialog.getChild("byrow")
                xbycol = xDialog.getChild("bycol")
                xeddestarea = xDialog.getChild("eddestarea")

                select_by_text(xfunc, "Sum")

                select_by_text(xlbdataarea, "range1")
                xadd.executeAction("CLICK", tuple())
                select_by_text(xlbdataarea, "range2")
                xadd.executeAction("CLICK", tuple())
                propsC = {"TEXT""range3"}
                actionPropsC = mkPropertyValues(propsC)
                xlbdataarea.executeAction("SELECT", actionPropsC)
                xadd.executeAction("CLICK", tuple())
                xbyrow.executeAction("CLICK", tuple())
                xbycol.executeAction("CLICK", tuple())
                xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
                xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
                xeddestarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Total.$A$2"}))

            #verify
            self.assertEqual(get_cell_by_position(calc_doc, 012).getValue(), 300)
            self.assertEqual(get_cell_by_position(calc_doc, 013).getValue(), 303)
            self.assertEqual(get_cell_by_position(calc_doc, 014).getValue(), 306)
            self.assertEqual(get_cell_by_position(calc_doc, 015).getValue(), 309)

            self.assertEqual(get_cell_by_position(calc_doc, 022).getValue(), 303)
            self.assertEqual(get_cell_by_position(calc_doc, 023).getValue(), 306)
            self.assertEqual(get_cell_by_position(calc_doc, 024).getValue(), 309)
            self.assertEqual(get_cell_by_position(calc_doc, 025).getValue(), 312)

            self.assertEqual(get_cell_by_position(calc_doc, 032).getValue(), 306)
            self.assertEqual(get_cell_by_position(calc_doc, 033).getValue(), 309)
            self.assertEqual(get_cell_by_position(calc_doc, 034).getValue(), 312)
            self.assertEqual(get_cell_by_position(calc_doc, 035).getValue(), 315)

            self.assertEqual(get_cell_by_position(calc_doc, 042).getValue(), 309)
            self.assertEqual(get_cell_by_position(calc_doc, 043).getValue(), 312)
            self.assertEqual(get_cell_by_position(calc_doc, 044).getValue(), 315)
            self.assertEqual(get_cell_by_position(calc_doc, 045).getValue(), 318)
            #verify dialog
            with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate"as xDialog:
                xfunc = xDialog.getChild("func")
                xlbdataarea = xDialog.getChild("lbdataarea")
                xdelete = xDialog.getChild("delete")
                xbyrow = xDialog.getChild("byrow")
                xbycol = xDialog.getChild("bycol")
                xeddestarea = xDialog.getChild("eddestarea")
                xconsareas = xDialog.getChild("consareas")
                self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum")
                self.assertEqual(get_state_as_dict(xconsareas)["Children"], "3")
                self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2")
                self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true")
                self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true")
                #delete first range
                xFirstEntry = xconsareas.getChild("0")
                xFirstEntry.executeAction("SELECT", tuple())
                xdelete.executeAction("CLICK", tuple())
                self.assertEqual(get_state_as_dict(xconsareas)["Children"], "2")

            self.assertEqual(get_cell_by_position(calc_doc, 012).getValue(), 200)
            self.assertEqual(get_cell_by_position(calc_doc, 013).getValue(), 202)
            self.assertEqual(get_cell_by_position(calc_doc, 014).getValue(), 204)
            self.assertEqual(get_cell_by_position(calc_doc, 015).getValue(), 206)

            self.assertEqual(get_cell_by_position(calc_doc, 022).getValue(), 202)
            self.assertEqual(get_cell_by_position(calc_doc, 023).getValue(), 204)
            self.assertEqual(get_cell_by_position(calc_doc, 024).getValue(), 206)
            self.assertEqual(get_cell_by_position(calc_doc, 025).getValue(), 208)

            self.assertEqual(get_cell_by_position(calc_doc, 032).getValue(), 204)
            self.assertEqual(get_cell_by_position(calc_doc, 033).getValue(), 206)
            self.assertEqual(get_cell_by_position(calc_doc, 034).getValue(), 208)
            self.assertEqual(get_cell_by_position(calc_doc, 035).getValue(), 210)

            self.assertEqual(get_cell_by_position(calc_doc, 042).getValue(), 206)
            self.assertEqual(get_cell_by_position(calc_doc, 043).getValue(), 208)
            self.assertEqual(get_cell_by_position(calc_doc, 044).getValue(), 210)
            self.assertEqual(get_cell_by_position(calc_doc, 045).getValue(), 212)

            # test cancel button
            with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate"close_button="cancel"):
                pass

# vim: set shiftwidth=4 softtabstop=4 expandtab:

Messung V0.5 in Prozent
C=77 H=100 G=89

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-06-11) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.