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 uitest
.uihelper
.common
import get_state_as_dict
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 #uitest sw / View-Zoom
14 class writerZoom(UITestCase
):
15 def test_zoom_writer(self
):
16 with self
.ui_test
.create_doc_in_start_center("writer"):
17 #dialog View-Zoom-Zoom
18 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
20 #select Optimal & Automatic - OK - open and verify
21 optimal
= xDialog
.getChild("optimal")
22 optimal
.executeAction("CLICK", tuple())
23 automatic
= xDialog
.getChild("automatic")
24 automatic
.executeAction("CLICK", tuple())
26 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
27 optimal
= xDialog
.getChild("optimal")
28 automatic
= xDialog
.getChild("automatic")
29 self
.assertEqual(get_state_as_dict(optimal
)["Checked"], "true")
30 self
.assertEqual(get_state_as_dict(automatic
)["Checked"], "true")
31 #select fit weight & Single page - OK - open and verify
32 fitwandh
= xDialog
.getChild("fitwandh")
33 singlepage
= xDialog
.getChild("singlepage")
34 fitwandh
.executeAction("CLICK", tuple())
35 singlepage
.executeAction("CLICK", tuple())
37 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
38 singlepage
= xDialog
.getChild("singlepage")
39 fitwandh
= xDialog
.getChild("fitwandh")
40 self
.assertEqual(get_state_as_dict(singlepage
)["Checked"], "true")
41 self
.assertEqual(get_state_as_dict(fitwandh
)["Checked"], "true")
42 #select fit width & columns - OK - open and verify
43 fitw
= xDialog
.getChild("fitw")
44 columnssb
= xDialog
.getChild("columnssb")
45 columns
= xDialog
.getChild("columns")
46 fitw
.executeAction("CLICK", tuple())
47 columns
.executeAction("CLICK", tuple())
48 columnssb
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
49 columnssb
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
50 columnssb
.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
52 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
53 fitw
= xDialog
.getChild("fitw")
54 columnssb
= xDialog
.getChild("columnssb")
55 columns
= xDialog
.getChild("columns")
56 self
.assertEqual(get_state_as_dict(fitw
)["Checked"], "true")
57 self
.assertEqual(get_state_as_dict(columns
)["Checked"], "true")
58 self
.assertEqual(get_state_as_dict(columnssb
)["Text"], "3")
59 #select 100% & Automatic - OK - open and verify
60 automatic
= xDialog
.getChild("automatic")
61 x100pc
= xDialog
.getChild("100pc")
62 x100pc
.executeAction("CLICK", tuple())
63 automatic
.executeAction("CLICK", tuple())
65 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
66 automatic
= xDialog
.getChild("automatic")
67 x100pc
= xDialog
.getChild("100pc")
68 self
.assertEqual(get_state_as_dict(automatic
)["Checked"], "true")
69 self
.assertEqual(get_state_as_dict(x100pc
)["Checked"], "true")
70 #select variable 103% & Automatic - OK - open and verify
71 variable
= xDialog
.getChild("variable")
72 zoomsb
= xDialog
.getChild("zoomsb")
73 variable
.executeAction("CLICK", tuple())
74 zoomsb
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
75 zoomsb
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
76 zoomsb
.executeAction("TYPE", mkPropertyValues({"TEXT":"101"}))
78 with self
.ui_test
.execute_dialog_through_command(".uno:Zoom") as xDialog
:
79 variable
= xDialog
.getChild("variable")
80 zoomsb
= xDialog
.getChild("zoomsb")
81 self
.assertEqual(get_state_as_dict(variable
)["Checked"], "true")
82 self
.assertEqual(get_state_as_dict(zoomsb
)["Text"], "101%")
85 # vim: set shiftwidth=4 softtabstop=4 expandtab: