tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / qa / uitest / search_replace / tdf57523.py
blobf753a7a8a07d6eeebfea78e33038bef106c311fe
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.calc import enter_text_to_cell
11 from libreoffice.calc.document import get_cell_by_position
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 from uitest.uihelper.common import get_state_as_dict
15 class tdf57523(UITestCase):
17 def test_tdf57523(self):
18 with self.ui_test.create_doc_in_start_center("calc") as document:
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
22 enter_text_to_cell(gridwin, "A1", "AAA")
23 enter_text_to_cell(gridwin, "A4", "AAA")
25 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
27 with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
29 # More Options is expanded when there is a selection with data
30 xExpander = xDialog.getChild("OptionsExpander")
31 self.assertEqual("true", get_state_as_dict(xExpander)['Expanded'])
33 searchterm = xDialog.getChild("searchterm")
34 searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
35 searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
36 searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"}))
38 replaceterm = xDialog.getChild("replaceterm")
39 replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"}))
40 regexp = xDialog.getChild("regexp")
42 regexp.executeAction("CLICK", tuple())
43 self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
45 replaceall = xDialog.getChild("replaceall")
46 replaceall.executeAction("CLICK", tuple())
48 # Deselect regex button, otherwise it might affect other tests
49 regexp.executeAction("CLICK", tuple())
50 self.assertEqual("false", get_state_as_dict(regexp)['Selected'])
53 # Without the fix in place, this test would have failed with
54 # AssertionError: '' != 'BBB'
55 self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB")
56 self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB")
59 # vim: set shiftwidth=4 softtabstop=4 expandtab: