Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / qa / uitest / impress_tests / tdf134734.py
blob07985e8f6b436d1820c652576f8e8f54a5ea6763
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 uitest.uihelper.common import get_state_as_dict, select_pos
12 from com.sun.star.drawing.FillStyle import SOLID
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)
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())
45 self.assertEqual(
46 document.DrawPages.getByIndex(0).Background.FillStyle, SOLID)
47 self.assertEqual(
48 document.DrawPages.getByIndex(0).BorderLeft, 1016)
49 self.assertEqual(
50 document.DrawPages.getByIndex(0).BorderRight, 762)
51 self.assertEqual(
52 document.DrawPages.getByIndex(0).BorderTop, 508)
53 self.assertEqual(
54 document.DrawPages.getByIndex(0).BorderBottom, 254)
55 self.assertEqual(
56 document.MasterPages.getByIndex(0).BackgroundFullSize, False)
58 # check it
59 with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
60 xTabs = DrawPageDialog.getChild("tabcontrol")
61 select_pos(xTabs, "0")
62 checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
63 self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
64 checkBackgroundFullSize.executeAction("CLICK",tuple())
66 self.assertEqual(
67 document.DrawPages.getByIndex(0).Background.FillStyle, SOLID)
68 self.assertEqual(
69 document.DrawPages.getByIndex(0).BorderLeft, 1016)
70 self.assertEqual(
71 document.DrawPages.getByIndex(0).BorderRight, 762)
72 self.assertEqual(
73 document.DrawPages.getByIndex(0).BorderTop, 508)
74 self.assertEqual(
75 document.DrawPages.getByIndex(0).BorderBottom, 254)
76 self.assertEqual(
77 document.MasterPages.getByIndex(0).BackgroundFullSize, True)
79 # uncheck it again
80 with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
81 xTabs = DrawPageDialog.getChild("tabcontrol")
82 select_pos(xTabs, "0")
83 checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
84 self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
85 checkBackgroundFullSize.executeAction("CLICK",tuple())
87 self.assertEqual(
88 document.DrawPages.getByIndex(0).Background.FillStyle, SOLID)
89 self.assertEqual(
90 document.DrawPages.getByIndex(0).BorderLeft, 1016)
91 self.assertEqual(
92 document.DrawPages.getByIndex(0).BorderRight, 762)
93 self.assertEqual(
94 document.DrawPages.getByIndex(0).BorderTop, 508)
95 self.assertEqual(
96 document.DrawPages.getByIndex(0).BorderBottom, 254)
97 self.assertEqual(
98 document.MasterPages.getByIndex(0).BackgroundFullSize, False)
101 # vim: set shiftwidth=4 softtabstop=4 expandtab: