Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests3 / goToPage.py
blobec0b1d0f2ea13c7b62dd168e1bb1c30f4c14d519
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest.framework import UITestCase
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
14 class GoToPage_dialog(UITestCase):
16 def test_go_to_page(self):
17 with self.ui_test.load_file(get_url_for_data_file("3pages.odt")):
18 xWriterDoc = self.xUITest.getTopFocusWindow()
19 xWriterEdit = xWriterDoc.getChild("writer_edit")
21 with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog:
22 xPageText = xDialog.getChild("page")
23 xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
25 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
27 with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog:
28 xPageText = xDialog.getChild("page")
29 xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
31 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
33 # check cancel button
34 with self.ui_test.execute_dialog_through_command(".uno:GotoPage", close_button="cancel"):
35 pass
37 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
39 # vim: set shiftwidth=4 softtabstop=4 expandtab: