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 libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.framework
import UITestCase
13 from uitest
.uihelper
.common
import type_text
, get_state_as_dict
, select_text
15 class EditTest(UITestCase
):
17 def test_type_text(self
):
19 with self
.ui_test
.create_doc_in_start_center("calc"):
21 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:AddName", close_button
="cancel") as xAddNameDlg
:
23 xEdit
= xAddNameDlg
.getChild("edit")
25 type_text(xEdit
, "simpleRangeName")
29 def test_select_text(self
):
31 with self
.ui_test
.create_doc_in_start_center("calc"):
33 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:AddName", close_button
="cancel") as xAddNameDlg
:
35 xEdit
= xAddNameDlg
.getChild("edit")
37 type_text(xEdit
, "simpleRangeName")
38 xEdit
.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"}))
39 type_text(xEdit
, "otherChars")
40 self
.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit
)["Text"])
42 select_text(xEdit
, from_pos
="2", to
="12")
43 self
.assertEqual("otherChars", get_state_as_dict(xEdit
)["SelectedText"])
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: