From 02df8d4a7f9d35da1b8cb56dbb18e8e0effeec1e Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 7 Jan 2018 20:04:21 +0100 Subject: uitest: add demo showing how to select text in Edit Change-Id: I8abb09e7e7b22934648bf0f295155a85da151cf8 Reviewed-on: https://gerrit.libreoffice.org/47549 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- uitest/demo_ui/edit.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'uitest') 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: -- cgit