Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/LibreOffice/uitest/uitest/uihelper/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 3 kB image not shown  

Quelle  testDialog.py   Sprache: Python

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

# opens the dialogs, closes it with the given close button
# and if there is an "OK" button open the dialog again and close it by using the OK button
# the test only checks if LibreOffice crashes by opening the dialog
def testAppDialog(UITestCase, app, dialog):
    with UITestCase.ui_test.create_doc_in_start_center(app):
        with UITestCase.ui_test.execute_dialog_through_command(
                dialog['command'], close_button=dialog['closeButton']) as xDialog:
            if 'skipTestOK' in dialog and dialog['skipTestOK']:
                xOKBtn = None
            else:
                try:
                    xOKBtn = xDialog.getChild("ok")
                    if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
                        xOKBtn = None
                except Exception:
                    xOKBtn = None

        if (xOKBtn is not None):
            print("check also OK button")
            with UITestCase.ui_test.execute_dialog_through_command(dialog['command']):
                pass

# opens the dialogs, closes it with the given close button
# and if there is an "OK" button open the dialog again and close it by using the OK button
# the test only checks if LibreOffice crashes by opening the dialog
def testChartDialog(UITestCase, dialog):
    with UITestCase.ui_test.load_file(get_url_for_data_file("chart.ods")):
        xCalcDoc = UITestCase.xUITest.getTopFocusWindow()
        xGridWin = xCalcDoc.getChild("grid_window")
        xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT""Object 1"}))
        xGridWin.executeAction("ACTIVATE", tuple())
        xChartMainTop = UITestCase.xUITest.getTopFocusWindow()
        xChartMain = xChartMainTop.getChild("chart_window")
        xObj = xChartMain.getChild("CID/D=0")
        with UITestCase.ui_test.execute_dialog_through_action(
                xObj, "COMMAND",
                mkPropertyValues({"COMMAND": dialog['command']}),
                close_button=dialog['closeButton']) as xDialog:
            if 'skipTestOK' in dialog and dialog['skipTestOK']:
                xOKBtn = None
            else:
                try:
                    xOKBtn = xDialog.getChild("ok")
                    if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
                        xOKBtn = None
                except Exception:
                    xOKBtn = None

        if (xOKBtn is not None):
            print("check also OK button")
            with UITestCase.ui_test.execute_dialog_through_action(
                    xObj, "COMMAND",
                    mkPropertyValues({"COMMAND": dialog['command']})):
                pass

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

Messung V0.5
C=94 H=94 G=93

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.