Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf140117.py
blob835d99219fae325c1bfab320f969c4e601f1cbe8
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 libreoffice.uno.propertyvalue import mkPropertyValues
11 from uitest.uihelper.common import select_pos
12 from uitest.uihelper.common import type_text
13 from uitest.uihelper.common import get_url_for_data_file
15 class tdf140117(UITestCase):
16 def test_tdf140117(self):
17 # load the sample file
18 with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")) as document:
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
22 for i in range(3):
23 xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
25 self.xUITest.executeCommand(".uno:JumpToHeader")
27 xPageSytle = document.getStyleFamilies().getByIndex(2)
28 xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
29 xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
30 xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String
32 # Option "same content on left and right pages" is false,
33 # insert text "XXXX" before actual header text "left" on page 2
34 if i == 0:
35 type_text(xWriterEdit, "XXXX")
37 # Option "same content on left and right pages" is true,
38 # header of page 2 contains the same text as page 1
39 elif i == 1:
40 self.assertEqual("right", xHeaderText)
41 self.assertEqual("right", xHeaderRightText)
43 # Option "same content on left and right pages" is false again.
44 # This was "right" instead of keeping the header content disabled
45 # temporarily for the second interaction of the loop.
46 elif i == 2:
47 self.assertEqual("XXXXleft", xHeaderLeftText)
49 with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog:
51 xTabs = PageDialog.getChild("tabcontrol")
52 select_pos(xTabs, "4")
54 # Change option "same content on left and right pages" for the next iteration
55 Button = xTabs.getChild('checkSameLR')
56 Button.executeAction("CLICK", tuple())
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: