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 tdf88608(UITestCase
):
15 def test_tdf88608(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 # Search a word that doesn't exist
26 xfind
= xWriterDoc
.getChild("find")
27 xfind
.executeAction("TYPE", mkPropertyValues({"TEXT": "X"}))
28 self
.assertEqual("X", get_state_as_dict(xfind
)['Text'])
30 xfind_bar
= xWriterDoc
.getChild("FindBar")
31 self
.assertEqual('', get_state_as_dict(xfind_bar
.getChild('label'))['Text'])
34 xfind_bar
.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
36 self
.assertEqual('Search key not found', get_state_as_dict(xfind_bar
.getChild('label'))['Text'])
38 self
.assertEqual("", get_state_as_dict(xWriterEdit
)['SelectedText'])
40 xfind
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
41 xfind
.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
42 self
.assertEqual("World", get_state_as_dict(xfind
)['Text'])
44 # Without the fix in place, this test would have failed with
45 # AssertionError: '' != 'Search key not found'
46 self
.assertEqual('', get_state_as_dict(xfind_bar
.getChild('label'))['Text'])
49 xfind_bar
.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
51 self
.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar
.getChild('label'))['Text'])
53 self
.assertEqual("World", get_state_as_dict(xWriterEdit
)['SelectedText'])
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: