Debian Codegraph @

sw/qa/uitest/writer_tests8/tdf142785.py

raw symbols SCIP
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 from uitest.framework import UITestCase
10 from uitest.uihelper.common import get_url_for_data_file
11 from uitest.uihelper.common import select_pos
12
13 class tdf142785(UITestCase):
14 def test_tdf142785(self):
15
16 with self.ui_test.load_file(get_url_for_data_file("tdf142785.docx")) as document:
17
18 sHeader = "ODD ODD ODD ODD ODD header"
19 sFooter = "ODD ODD ODD ODD ODD footer"
20
21 xStandardStyle = document.StyleFamilies.PageStyles.Standard
22 self.assertEqual(sHeader, xStandardStyle.HeaderText.String)
23 self.assertEqual(sHeader, xStandardStyle.HeaderTextFirst.String)
24 self.assertEqual(sHeader, xStandardStyle.HeaderTextLeft.String)
25 self.assertEqual(sHeader, xStandardStyle.HeaderTextRight.String)
26
27 self.assertEqual(sFooter, xStandardStyle.FooterText.String)
28 self.assertEqual(sFooter, xStandardStyle.FooterTextFirst.String)
29 self.assertEqual(sFooter, xStandardStyle.FooterTextLeft.String)
30 self.assertEqual(sFooter, xStandardStyle.FooterTextRight.String)
31
32 with self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog:
33 xTabs = xDialog.getChild("tabcontrol")
34 select_pos(xTabs, "4")
35 checkSameLR = xDialog.getChild("checkSameLR-header")
36 checkSameLR.executeAction("CLICK",tuple())
37
38 self.assertEqual(sHeader, xStandardStyle.HeaderText.String)
39 self.assertEqual(sHeader, xStandardStyle.HeaderTextFirst.String)
40 self.assertEqual("EVEN EVEN EVEN EVEN EVEN header", xStandardStyle.HeaderTextLeft.String)
41 self.assertEqual(sHeader, xStandardStyle.HeaderTextRight.String)
42
43 self.assertEqual(sFooter, xStandardStyle.FooterText.String)
44 self.assertEqual(sFooter, xStandardStyle.FooterTextFirst.String)
45 self.assertEqual(sFooter, xStandardStyle.FooterTextLeft.String)
46 self.assertEqual(sFooter, xStandardStyle.FooterTextRight.String)
47
48 with self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog:
49 xTabs = xDialog.getChild("tabcontrol")
50 select_pos(xTabs, "5")
51 checkSameLR = xDialog.getChild("checkSameLR-footer")
52 checkSameLR.executeAction("CLICK",tuple())
53
54 self.assertEqual(sHeader, xStandardStyle.HeaderText.String)
55 self.assertEqual(sHeader, xStandardStyle.HeaderTextFirst.String)
56 self.assertEqual("EVEN EVEN EVEN EVEN EVEN header", xStandardStyle.HeaderTextLeft.String)
57 self.assertEqual(sHeader, xStandardStyle.HeaderTextRight.String)
58
59 self.assertEqual(sFooter, xStandardStyle.FooterText.String)
60 self.assertEqual(sFooter, xStandardStyle.FooterTextFirst.String)
61
62 # Without the fix in place, this test would have failed with
63 # AssertionError: 'EVEN EVEN EVEN EVEN EVEN footer' != 'ODD ODD ODD ODD ODD footer'
64 self.assertEqual("EVEN EVEN EVEN EVEN EVEN footer", xStandardStyle.FooterTextLeft.String)
65 self.assertEqual(sFooter, xStandardStyle.FooterTextRight.String)
66
67 # vim: set shiftwidth=4 softtabstop=4 expandtab: