Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sc/qa/uitest/range_name/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 2 kB image not shown  

Quelle  tdf86214.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 type_text, get_state_as_dict
from uitest.uihelper.keyboard import select_all


class InvalidNames(UITestCase):

    def test_invalid_names(self):

        with self.ui_test.create_doc_in_start_center("calc"):

            with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add"as xAddNameDlg:


                invalid_names = ["A1""12""1.2""A1:B2""test.a", \
                        "test+""test-""test*""test!abc""test#", \
                        "test^""test°""test$""test§""test%", \
                        "test&""test/""test(""test)""test[""test]", \
                        "test\\""test`""test´""test'""test~""test<", \
                        "tst>""test|""test:t""test;z"]

                xLabel = xAddNameDlg.getChild("label")
                xAddBtn = xAddNameDlg.getChild("add")
                xEdit = xAddNameDlg.getChild("edit")

                success_text = get_state_as_dict(xLabel)["Text"]

                for name in invalid_names:
                    with self.subTest(name = name):
                        select_all(xEdit)
                        type_text(xEdit, name)

                        # tdf#132869 - Without the fix in place, this test would have failed with
                        # - Expected: "Invalid name. It must start with a letter (excluding c, C, r, or R followed by a number) or underscore.\nOnly letters, numbers, and underscores are permitted."
                        # - Actual  : ""
                        self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"])
                        self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false")


                select_all(xEdit)
                type_text(xEdit, "valid_name")

                self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"])
                self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"])
                self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true")



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

Messung V0.5
C=94 H=91 G=92

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© 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.