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
, select_pos
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
15 class Tdf142763(UITestCase
):
17 def test_tdf142763_header(self
):
18 with self
.ui_test
.create_doc_in_start_center("calc"):
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
21 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
23 with self
.ui_test
.execute_dialog_through_command(".uno:PageFormatDialog") as xPageFormatDialog
:
24 xTabControl
= xPageFormatDialog
.getChild("tabcontrol")
25 select_pos(xTabControl
, "4")
27 xHeaderOnBtn
= xPageFormatDialog
.getChild("checkHeaderOn")
28 xHeaderOnBtn
.executeAction("CLICK", tuple())
29 xFirstHeaderSameBtn
= xPageFormatDialog
.getChild("checkSameFP")
30 xFirstHeaderSameBtn
.executeAction("CLICK", tuple())
32 with self
.ui_test
.execute_dialog_through_command(".uno:EditHeaderAndFooter") as xHeaderDialog
:
33 xLeftTextWindow
= xHeaderDialog
.getChild("textviewWND_LEFT")
34 xLeftTextWindow
.executeAction("TYPE", mkPropertyValues({"TEXT": "first"}))
35 xCenterTextWindow
= xHeaderDialog
.getChild("textviewWND_CENTER")
36 xCenterTextWindow
.executeAction("TYPE", mkPropertyValues({"TEXT": "page | "}))
37 xRightTextWindow
= xHeaderDialog
.getChild("textviewWND_RIGHT")
38 xRightTextWindow
.executeAction("TYPE", mkPropertyValues({"TEXT": "header"}))
40 self
.assertEqual("first", get_state_as_dict(xLeftTextWindow
)["Text"])
41 self
.assertEqual("page | Sheet1", get_state_as_dict(xCenterTextWindow
)["Text"])
42 self
.assertEqual("header", get_state_as_dict(xRightTextWindow
)["Text"])
44 def test_tdf142763_footer(self
):
45 with self
.ui_test
.create_doc_in_start_center("calc"):
46 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
47 gridwin
= xCalcDoc
.getChild("grid_window")
48 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
50 with self
.ui_test
.execute_dialog_through_command(".uno:PageFormatDialog") as xPageFormatDialog
:
51 xTabControl
= xPageFormatDialog
.getChild("tabcontrol")
52 select_pos(xTabControl
, "5")
54 xFooterOnBtn
= xPageFormatDialog
.getChild("checkFooterOn")
55 xFooterOnBtn
.executeAction("CLICK", tuple())
56 xFirstFooterSameBtn
= xPageFormatDialog
.getChild("checkSameFP")
57 xFirstFooterSameBtn
.executeAction("CLICK", tuple())
59 with self
.ui_test
.execute_dialog_through_command(".uno:EditHeaderAndFooter") as xFooterDialog
:
60 xLeftTextWindow
= xFooterDialog
.getChild("textviewWND_LEFT")
61 xLeftTextWindow
.executeAction("TYPE", mkPropertyValues({"TEXT": "first"}))
62 xCenterTextWindow
= xFooterDialog
.getChild("textviewWND_CENTER")
63 xCenterTextWindow
.executeAction("TYPE", mkPropertyValues({"TEXT": "page | "}))
64 xRightTextWindow
= xFooterDialog
.getChild("textviewWND_RIGHT")
65 xRightTextWindow
.executeAction("TYPE", mkPropertyValues({"TEXT": "footer"}))
67 self
.assertEqual("first", get_state_as_dict(xLeftTextWindow
)["Text"])
68 self
.assertEqual("page | Sheet1", get_state_as_dict(xCenterTextWindow
)["Text"])
69 self
.assertEqual("footer", get_state_as_dict(xRightTextWindow
)["Text"])
71 # vim: set shiftwidth=4 softtabstop=4 expandtab: