From 0a52f261c6969992bb0b7ed3d8618884e1f62272 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 21 May 2016 01:24:01 +0200 Subject: uitest: add demo showing how to use page number Change-Id: I718f4c6c8f01ceb556b9beadce5af88491c4efe0 --- uitest/writer_tests/start.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'uitest') diff --git a/uitest/writer_tests/start.py b/uitest/writer_tests/start.py index 83b5ad2643c6..a9b722adc4cb 100644 --- a/uitest/writer_tests/start.py +++ b/uitest/writer_tests/start.py @@ -5,7 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -from uitest_helper import UITest +from uitest_helper import UITest, get_state_as_dict from helper import mkPropertyValues @@ -58,4 +58,25 @@ def type_text(xContext): ui_test.close_doc() +def goto_first_page(xContext): + xUITest = xContext.ServiceManager.createInstanceWithContext( + "org.libreoffice.uitest.UITest", xContext) + + ui_test = UITest(xUITest, xContext) + + ui_test.create_doc_in_start_center("writer") + + xWriterDoc = xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + state = get_state_as_dict(xWriterEdit) + print(state) + while state["CurrentPage"] is "1": + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + state = get_state_as_dict(xWriterEdit) + + time.sleep(2) + + ui_test.close_doc() + # vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit