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
14 class TestClass(UITestCase
):
15 def test_master_page_background(self
):
16 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
18 # set margins and fill color
19 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog
:
20 xTabs
= DrawPageDialog
.getChild("tabcontrol")
21 select_pos(xTabs
, "1")
22 checkBackgroundFullSize
= DrawPageDialog
.getChild("checkBackgroundFullSize")
23 self
.assertEqual(get_state_as_dict(checkBackgroundFullSize
)["Selected"], "true")
24 spinMargLeft
= DrawPageDialog
.getChild("spinMargLeft")
26 spinMargLeft
.executeAction("UP",tuple())
27 spinMargRight
= DrawPageDialog
.getChild("spinMargRight")
29 spinMargRight
.executeAction("UP",tuple())
30 spinMargTop
= DrawPageDialog
.getChild("spinMargTop")
32 spinMargTop
.executeAction("UP",tuple())
33 spinMargBot
= DrawPageDialog
.getChild("spinMargBot")
35 spinMargBot
.executeAction("UP",tuple())
36 xTabs
= DrawPageDialog
.getChild("tabcontrol")
37 select_pos(xTabs
, "2")
38 btncolor
= DrawPageDialog
.getChild("btncolor")
39 btncolor
.executeAction("CLICK",tuple())
41 xStyle
= document
.StyleFamilies
["PageStyles"]["Standard"]
43 self
.assertEqual(xStyle
.FillStyle
, SOLID
)
44 self
.assertEqual(xStyle
.LeftMargin
, 2997)
45 self
.assertEqual(xStyle
.RightMargin
, 2743)
46 self
.assertEqual(xStyle
.TopMargin
, 2489)
47 self
.assertEqual(xStyle
.BottomMargin
, 2235)
48 self
.assertEqual(xStyle
.BackgroundFullSize
, True)
51 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog
:
52 xTabs
= DrawPageDialog
.getChild("tabcontrol")
53 select_pos(xTabs
, "1")
54 checkBackgroundFullSize
= DrawPageDialog
.getChild("checkBackgroundFullSize")
55 self
.assertEqual(get_state_as_dict(checkBackgroundFullSize
)["Selected"], "true")
56 checkBackgroundFullSize
.executeAction("CLICK",tuple())
58 self
.assertEqual(xStyle
.FillStyle
, SOLID
)
59 self
.assertEqual(xStyle
.LeftMargin
, 2997)
60 self
.assertEqual(xStyle
.RightMargin
, 2743)
61 self
.assertEqual(xStyle
.TopMargin
, 2489)
62 self
.assertEqual(xStyle
.BottomMargin
, 2235)
63 self
.assertEqual(xStyle
.BackgroundFullSize
, False)
66 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog
:
67 xTabs
= DrawPageDialog
.getChild("tabcontrol")
68 select_pos(xTabs
, "1")
69 checkBackgroundFullSize
= DrawPageDialog
.getChild("checkBackgroundFullSize")
70 self
.assertEqual(get_state_as_dict(checkBackgroundFullSize
)["Selected"], "false")
71 checkBackgroundFullSize
.executeAction("CLICK",tuple())
73 self
.assertEqual(xStyle
.FillStyle
, SOLID
)
74 self
.assertEqual(xStyle
.LeftMargin
, 2997)
75 self
.assertEqual(xStyle
.RightMargin
, 2743)
76 self
.assertEqual(xStyle
.TopMargin
, 2489)
77 self
.assertEqual(xStyle
.BottomMargin
, 2235)
78 self
.assertEqual(xStyle
.BackgroundFullSize
, True)
81 # vim: set shiftwidth=4 softtabstop=4 expandtab: