Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / macro_tests / tdf64690.py
blob5e691117bb3d9d1eefc93ec99dd175f9b466169d
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 get_state_as_dict
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 class tdf64690(UITestCase):
16 def test_tdf64690(self):
18 with self.ui_test.create_doc_in_start_center("writer"):
20 with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="edit"):
21 pass
23 xMacroWin = self.xUITest.getTopFocusWindow()
24 xEditWin = xMacroWin.getChild('EditorWindow')
26 self.xUITest.executeCommand(".uno:SelectAll")
27 xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
29 self.assertEqual("\n", get_state_as_dict(xEditWin)['Text'])
31 xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'abc"}))
32 xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
33 xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'def"}))
35 self.assertEqual("'abc\n'def\n", get_state_as_dict(xEditWin)['Text'])
37 self.xUITest.executeCommand(".uno:SelectAll")
39 with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
41 searchterm = xDialog.getChild("searchterm")
42 searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
43 searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
44 searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
46 replaceterm = xDialog.getChild("replaceterm")
47 replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"}))
49 regexp = xDialog.getChild("regexp")
50 regexp.executeAction("CLICK", tuple())
51 self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
53 selection = xDialog.getChild("selection")
54 if get_state_as_dict(selection)['Selected'] == 'false':
55 selection.executeAction("CLICK", tuple())
56 self.assertEqual("true", get_state_as_dict(selection)['Selected'])
58 replaceall = xDialog.getChild("replaceall")
60 # Without the fix in place, this test would have hung here
61 with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())):
62 pass
64 # Deselect regex button, otherwise it might affect other tests
65 regexp.executeAction("CLICK", tuple())
66 self.assertEqual("false", get_state_as_dict(regexp)['Selected'])
69 self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text'])
73 # vim: set shiftwidth=4 softtabstop=4 expandtab: