Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / findBar / tdf136941.py
blobf1d147b1a407c1bb209a342c52ad90494e904cce
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 libreoffice.uno.propertyvalue import mkPropertyValues
13 class tdf136941(UITestCase):
15 def test_tdf136941(self):
17 with self.ui_test.create_doc_in_start_center("writer"):
18 xWriterDoc = self.xUITest.getTopFocusWindow()
19 xWriterEdit = xWriterDoc.getChild("writer_edit")
21 xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"}))
23 self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
25 xfind = xWriterDoc.getChild("find")
26 xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
28 self.assertEqual("Hello", get_state_as_dict(xfind)['Text'])
30 xfind_bar = xWriterDoc.getChild("FindBar")
32 # Search Next
33 xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
35 # Close button
36 xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"}))
38 # Check the toolbar is closed
39 self.assertTrue("find" not in xWriterDoc.getChildren())
40 self.assertEqual("Hello", get_state_as_dict(xWriterEdit)['SelectedText'])
42 self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
44 xfind = xWriterDoc.getChild("find")
45 self.ui_test.wait_until_property_is_updated(xfind, 'SelectedText', "Hello")
46 self.assertEqual("Hello", get_state_as_dict(xfind)['SelectedText'])
48 xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
50 # Without the fix in place, this test would have failed with
51 # AssertionError: 'World' != 'WorldHello'
52 self.assertEqual("World", get_state_as_dict(xfind)['Text'])
54 xfind_bar = xWriterDoc.getChild("FindBar")
56 # Search Next
57 xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
59 # Close button
60 xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"}))
62 # Check the toolbar is closed
63 self.assertTrue("find" not in xWriterDoc.getChildren())
64 self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText'])
67 # vim: set shiftwidth=4 softtabstop=4 expandtab: