Debian Codegraph @

sw/qa/uitest/findReplace/tdf44837.py

raw symbols SCIP
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
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/.
8 #
9
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import type_text
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 #Bug 44837 - EDITING 'Replace All' clears current selection
14
15 class tdf44837(UITestCase):
16
17 def test_tdf448373_Replace_All_clears_current_selection(self):
18 with self.ui_test.create_doc_in_start_center("writer") as document:
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
21
22 type_text(xWriterEdit, "asd asd")
23 self.xUITest.executeCommand(".uno:SelectAll")
24
25 with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
26 searchterm = xDialog.getChild("searchterm")
27 searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
28 searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
29 searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
30 replaceterm = xDialog.getChild("replaceterm")
31 replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox
32
33 selectionOnly = xDialog.getChild("selection")
34 selectionOnly.executeAction("CLICK", tuple())
35 replaceall = xDialog.getChild("replaceall")
36 replaceall.executeAction("CLICK", tuple())
37
38 self.assertEqual(document.Text.String[0:8], "bsd bsd")
39 self.assertEqual(len(document.CurrentSelection[0].String) > 1, True)
40 #follow-up bug 125663
41
42 # vim: set shiftwidth=4 softtabstop=4 expandtab: