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/.
9 from uitest
.framework
import UITestCase
10 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
11 from uitest
.uihelper
.common
import get_state_as_dict
12 #uitest sc / View-Zoom
14 class calcZoom(UITestCase
):
15 def test_zoom_calc(self
):
16 with self
.ui_test
.create_doc_in_start_center("calc"):
17 MainWindow
= self
.xUITest
.getTopFocusWindow()
18 gridwin
= MainWindow
.getChild("grid_window")
19 gridwin
.executeAction("SELECT", mkPropertyValues({"TABLE": "0"}))
20 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
22 #Set the Zoom to be 100%
23 gridwin
.executeAction("SET", mkPropertyValues({"ZOOM": "100"}))
24 self
.assertEqual(get_state_as_dict(gridwin
)["Zoom"], "100")
26 #dialog View-Zoom-Zoom
27 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
29 #select fit weight & height - OK - open and verify
30 fitwandh
= xDialog
.getChild("fitwandh")
31 fitwandh
.executeAction("CLICK",tuple())
33 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
34 #select fit weight - OK - open and verify
35 fitw
= xDialog
.getChild("fitw")
36 fitw
.executeAction("CLICK",tuple())
38 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
39 #select 100% & Automatic - OK - open and verify
40 x100pc
= xDialog
.getChild("100pc")
41 x100pc
.executeAction("CLICK", tuple())
42 self
.assertEqual(get_state_as_dict(gridwin
)["Zoom"], "100")
44 #Set the Zoom to be 103%
45 gridwin
.executeAction("SET", mkPropertyValues({"ZOOM": "103"}))
46 self
.assertEqual(get_state_as_dict(gridwin
)["Zoom"], "103")
48 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
49 #select variable option and make zoom 100% again - OK - open and verify
50 zoomsb
= xDialog
.getChild("zoomsb")
51 self
.assertEqual(get_state_as_dict(zoomsb
)["Text"], "103%")
52 zoomsb
.executeAction("DOWN",tuple())
53 zoomsb
.executeAction("DOWN",tuple())
54 zoomsb
.executeAction("DOWN",tuple())
55 self
.assertEqual(get_state_as_dict(gridwin
)["Zoom"], "100")
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: