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 tdf138232(UITestCase
):
15 def test_tdf138232(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"}))
22 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
23 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
25 self
.xUITest
.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
27 xfind
= xWriterDoc
.getChild("find")
28 self
.ui_test
.wait_until_property_is_updated(xfind
, 'HasFocus', "true")
29 self
.assertEqual("true", get_state_as_dict(xfind
)['HasFocus'])
31 xfind
.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
32 self
.assertEqual("Hello", get_state_as_dict(xfind
)['Text'])
34 xfind_bar
= xWriterDoc
.getChild("FindBar")
37 xfind_bar
.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
39 self
.assertEqual("HelloHello", get_state_as_dict(xWriterEdit
)['SelectedText'])
41 xfind
.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
43 # Without the fix in place, this test would have failed with
44 # AssertionError: 'HelloWorld' != 'World'
45 self
.assertEqual("HelloWorld", get_state_as_dict(xfind
)['Text'])
47 xfind_bar
.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
49 self
.assertEqual("", get_state_as_dict(xWriterEdit
)['SelectedText'])
52 # vim: set shiftwidth=4 softtabstop=4 expandtab: