Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / uitest / writer_tests / goToPage.py
blob63a21f04d8402424903c737b6c655ee79ebd7a77
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 from uitest.framework import UITestCase
7 from libreoffice.uno.propertyvalue import mkPropertyValues
8 from uitest.uihelper.common import get_state_as_dict
9 import time
10 from uitest.path import get_srcdir_url
12 def get_url_for_data_file(file_name):
13 return get_srcdir_url() + "/uitest/writer_tests/data/" + file_name
15 class GoToPage_dialog(UITestCase):
17 def test_go_to_page(self):
18 writer_doc = self.ui_test.load_file(get_url_for_data_file("3pages.odt"))
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
22 self.ui_test.execute_dialog_through_command(".uno:GotoPage")
23 xDialog = self.xUITest.getTopFocusWindow()
24 xPageText = xDialog.getChild("page")
25 xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
26 xOkBtn = xDialog.getChild("ok")
27 xOkBtn.executeAction("CLICK", tuple())
29 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
31 self.ui_test.execute_dialog_through_command(".uno:GotoPage")
32 xDialog = self.xUITest.getTopFocusWindow()
33 xPageText = xDialog.getChild("page")
34 xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"}))
35 xOkBtn = xDialog.getChild("ok")
36 xOkBtn.executeAction("CLICK", tuple())
38 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
40 self.ui_test.close_doc()