tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / qa / uitest / range_name / tdf86214.py
blob8cbed2f00da6e744e147ca2f17719da3c90731ae
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import type_text, get_state_as_dict
12 from uitest.uihelper.keyboard import select_all
15 class InvalidNames(UITestCase):
17 def test_invalid_names(self):
19 with self.ui_test.create_doc_in_start_center("calc"):
21 with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg:
24 invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \
25 "test+", "test-", "test*", "test!abc", "test#", \
26 "test^", "test°", "test$", "test§", "test%", \
27 "test&", "test/", "test(", "test)", "test[", "test]", \
28 "test\\", "test`", "test´", "test'", "test~", "test<", \
29 "tst>", "test|", "test:t", "test;z"]
31 xLabel = xAddNameDlg.getChild("label")
32 xAddBtn = xAddNameDlg.getChild("add")
33 xEdit = xAddNameDlg.getChild("edit")
35 success_text = get_state_as_dict(xLabel)["Text"]
37 for name in invalid_names:
38 with self.subTest(name = name):
39 select_all(xEdit)
40 type_text(xEdit, name)
42 # tdf#132869 - Without the fix in place, this test would have failed with
43 # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore."
44 # - Actual : ""
45 self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"])
46 self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false")
49 select_all(xEdit)
50 type_text(xEdit, "valid_name")
52 self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"])
53 self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"])
54 self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true")
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: