Debian Codegraph @

sd/qa/uitest/impress_tests/tdf134734.py

raw
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
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/.
8 #
9
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import get_state_as_dict, select_pos
12 from com.sun.star.drawing.FillStyle import SOLID
13
14
15 class TestClass(UITestCase):
16 def test_master_page_background(self):
17 with self.ui_test.create_doc_in_start_center("impress") as document:
18 TemplateDialog = self.xUITest.getTopFocusWindow()
19 close = TemplateDialog.getChild("close")
20 self.ui_test.close_dialog_through_button(close)
21
22 # set margins and fill color
23 with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
24 xTabs = DrawPageDialog.getChild("tabcontrol")
25 select_pos(xTabs, "0")
26 checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
27 self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
28 spinMargLeft = DrawPageDialog.getChild("spinMargLeft")
29 for _ in range(20):
30 spinMargLeft.executeAction("UP",tuple())
31 spinMargRight = DrawPageDialog.getChild("spinMargRight")
32 for _ in range(15):
33 spinMargRight.executeAction("UP",tuple())
34 spinMargTop = DrawPageDialog.getChild("spinMargTop")
35 for _ in range(10):
36 spinMargTop.executeAction("UP",tuple())
37 spinMargBot = DrawPageDialog.getChild("spinMargBot")
38 for _ in range(5):
39 spinMargBot.executeAction("UP",tuple())
40 xTabs = DrawPageDialog.getChild("tabcontrol")
41 select_pos(xTabs, "1")
42 btncolor = DrawPageDialog.getChild("btncolor")
43 btncolor.executeAction("CLICK",tuple())
44
45 self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID)
46 self.assertEqual(document.DrawPages[0].BorderLeft, 1016)
47 self.assertEqual(document.DrawPages[0].BorderRight, 762)
48 self.assertEqual(document.DrawPages[0].BorderTop, 508)
49 self.assertEqual(document.DrawPages[0].BorderBottom, 254)
50 self.assertEqual(document.MasterPages[0].BackgroundFullSize, False)
51
52 # check it
53 with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
54 xTabs = DrawPageDialog.getChild("tabcontrol")
55 select_pos(xTabs, "0")
56 checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
57 self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
58 checkBackgroundFullSize.executeAction("CLICK",tuple())
59
60 self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID)
61 self.assertEqual(document.DrawPages[0].BorderLeft, 1016)
62 self.assertEqual(document.DrawPages[0].BorderRight, 762)
63 self.assertEqual(document.DrawPages[0].BorderTop, 508)
64 self.assertEqual(document.DrawPages[0].BorderBottom, 254)
65 self.assertEqual(document.MasterPages[0].BackgroundFullSize, True)
66
67 # uncheck it again
68 with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
69 xTabs = DrawPageDialog.getChild("tabcontrol")
70 select_pos(xTabs, "0")
71 checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
72 self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
73 checkBackgroundFullSize.executeAction("CLICK",tuple())
74
75 self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID)
76 self.assertEqual(document.DrawPages[0].BorderLeft, 1016)
77 self.assertEqual(document.DrawPages[0].BorderRight, 762)
78 self.assertEqual(document.DrawPages[0].BorderTop, 508)
79 self.assertEqual(document.DrawPages[0].BorderBottom, 254)
80 self.assertEqual(document.MasterPages[0].BackgroundFullSize, False)
81
82
83 # vim: set shiftwidth=4 softtabstop=4 expandtab: