Bump version to 6.4-15
[LibreOffice.git] / uitest / demo_ui / spinfield.py
blob3f73006b10bd9215d5025239fbb2587101423927
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, select_pos
13 class SpinFieldTest(UITestCase):
15 def test_up(self):
17 self.ui_test.create_doc_in_start_center("calc")
19 self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
20 xCellsDlg = self.xUITest.getTopFocusWindow()
22 # select the numbers tab page
23 select_pos(xCellsDlg, "0")
25 xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
26 xDecimalPlaces.executeAction("UP", tuple())
28 decimal_places_state = get_state_as_dict(xDecimalPlaces)
29 assert(decimal_places_state["Text"] == "2")
31 okBtn = xCellsDlg.getChild("ok")
32 self.ui_test.close_dialog_through_button(okBtn)
34 self.ui_test.close_doc()
36 def test_down(self):
38 self.ui_test.create_doc_in_start_center("calc")
40 self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
41 xCellsDlg = self.xUITest.getTopFocusWindow()
43 # select the numbers tab page
44 select_pos(xCellsDlg, "0")
46 xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
47 xDecimalPlaces.executeAction("UP", tuple())
48 xDecimalPlaces.executeAction("UP", tuple())
50 decimal_places_state = get_state_as_dict(xDecimalPlaces)
51 assert(decimal_places_state["Text"] == "3")
53 xDecimalPlaces.executeAction("DOWN", tuple())
55 decimal_places_state = get_state_as_dict(xDecimalPlaces)
56 assert(decimal_places_state["Text"] == "2")
58 okBtn = xCellsDlg.getChild("ok")
59 self.ui_test.close_dialog_through_button(okBtn)
61 self.ui_test.close_doc()
63 def test_text(self):
65 self.ui_test.create_doc_in_start_center("calc")
67 self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
68 xCellsDlg = self.xUITest.getTopFocusWindow()
70 xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
71 type_text(xDecimalPlaces, "4")
73 decimal_places_state = get_state_as_dict(xDecimalPlaces)
74 assert(decimal_places_state["Text"] == "41")
76 okBtn = xCellsDlg.getChild("ok")
77 self.ui_test.close_dialog_through_button(okBtn)
79 self.ui_test.close_doc()
81 # vim: set shiftwidth=4 softtabstop=4 expandtab: