[Libreoffice-commits] core.git: uitest/demo_ui
Markus Mohrhard
markus.mohrhard at googlemail.com
Sun Jan 7 23:33:25 UTC 2018
uitest/demo_ui/edit.py | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
New commits:
commit 02df8d4a7f9d35da1b8cb56dbb18e8e0effeec1e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jan 7 20:04:21 2018 +0100
uitest: add demo showing how to select text in Edit
Change-Id: I8abb09e7e7b22934648bf0f295155a85da151cf8
Reviewed-on: https://gerrit.libreoffice.org/47549
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
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:
More information about the Libreoffice-commits
mailing list