tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / qa / uitest / range_name / tdf138822.py
blobd8d72d3138832247dece1c1d4558e92a0f43ea84
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/.
9 from uitest.framework import UITestCase
10 from uitest.uihelper.common import get_state_as_dict
11 from uitest.uihelper.common import type_text
13 class tdf138822(UITestCase):
15 def test_tdf138822(self):
16 with self.ui_test.create_doc_in_start_center("calc"):
18 calcDoc = self.xUITest.getTopFocusWindow()
19 xPosWindow = calcDoc.getChild('pos_window')
20 self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text'])
22 with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName", close_button="add"):
23 pass
25 xDefineNamesDialog = self.xUITest.getTopFocusWindow()
27 xAddBtn = xDefineNamesDialog.getChild("add")
28 self.assertEqual("false", get_state_as_dict(xAddBtn)['Enabled'])
30 xEdit = xDefineNamesDialog.getChild("edit")
31 type_text(xEdit, "rangeName")
33 self.assertEqual("true", get_state_as_dict(xAddBtn)['Enabled'])
35 self.ui_test.close_dialog_through_button(xAddBtn)
37 xManageNamesDialog = self.xUITest.getTopFocusWindow()
39 xNamesList = xManageNamesDialog.getChild('names')
40 self.assertEqual(1, len(xNamesList.getChildren()))
41 self.assertEqual(get_state_as_dict(xNamesList.getChild('0'))["Text"], "rangeName\t$Sheet1.$A$1\tDocument (Global)")
43 xCancelBtn = xManageNamesDialog.getChild("cancel")
44 self.ui_test.close_dialog_through_button(xCancelBtn)
46 # Open the dialog again
47 with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") as xManageNamesDialog:
49 xNamesList = xManageNamesDialog.getChild('names')
51 # Without the fix in place, this test would have failed with
52 # AssertionError: 0 != 1
53 self.assertEqual(0, len(xNamesList.getChildren()))
55 # vim: set shiftwidth=4 softtabstop=4 expandtab: