Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / uitest / writer_tests / start.py
blobc8cbcbba4884ea170cfc67aa89d812ddf85a7c36
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from libreoffice.uno.propertyvalue import mkPropertyValues
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import get_state_as_dict, type_text
13 import time
15 class SimpleWriterTest(UITestCase):
17 def test_start_writer(self):
19 self.ui_test.create_doc_in_start_center("writer")
21 xWriterDoc = self.xUITest.getTopFocusWindow()
23 xWriterEdit = xWriterDoc.getChild("writer_edit")
25 xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"}))
27 self.ui_test.close_doc()
29 def test_type_text(self):
31 self.ui_test.create_doc_in_start_center("writer")
33 xWriterDoc = self.xUITest.getTopFocusWindow()
34 xWriterEdit = xWriterDoc.getChild("writer_edit")
36 type_text(xWriterEdit, "This is my first writer text written through the UI testing")
38 self.ui_test.close_doc()
40 def test_goto_first_page(self):
42 self.ui_test.create_doc_in_start_center("writer")
44 xWriterDoc = self.xUITest.getTopFocusWindow()
45 xWriterEdit = xWriterDoc.getChild("writer_edit")
47 state = get_state_as_dict(xWriterEdit)
48 while state["CurrentPage"] is "1":
49 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
50 state = get_state_as_dict(xWriterEdit)
52 xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
54 self.ui_test.close_doc()
57 def test_select_text(self):
59 self.ui_test.create_doc_in_start_center("writer")
61 xWriterDoc = self.xUITest.getTopFocusWindow()
62 xWriterEdit = xWriterDoc.getChild("writer_edit")
64 type_text(xWriterEdit, "This is my first writer text written through the UI testing")
66 xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"}))
68 self.ui_test.close_doc()
70 # vim: set shiftwidth=4 softtabstop=4 expandtab: