summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-01-07 20:04:21 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-01-08 00:32:57 +0100
commit02df8d4a7f9d35da1b8cb56dbb18e8e0effeec1e (patch)
tree8f9e02a11f2a623ea4162ae31928be1b04303bcc /uitest
parent2453c5a62cd2c4364d0258f7488ab23b83b5478b (diff)
uitest: add demo showing how to select text in Edit
Change-Id: I8abb09e7e7b22934648bf0f295155a85da151cf8 Reviewed-on: https://gerrit.libreoffice.org/47549 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/demo_ui/edit.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py
index 135a72447ea7..6da14333a4d5 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -8,7 +8,9 @@
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
-from uitest.uihelper.common import type_text
+from uitest.uihelper.common import type_text, get_state_as_dict
+
+import time
class EditTest(UITestCase):
@@ -28,4 +30,26 @@ class EditTest(UITestCase):
self.ui_test.close_doc()
+ def test_select_text(self):
+
+ self.ui_test.create_doc_in_start_center("calc")
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
+
+ xEdit = xAddNameDlg.getChild("edit")
+
+ type_text(xEdit, "simpleRangeName")
+ xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"}))
+ type_text(xEdit, "otherChars")
+ self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"])
+
+ xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "12"}))
+ self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
+
+ xAddBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xAddBtn)
+
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab: