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 libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import select_pos
13 from uitest
.uihelper
.common
import get_url_for_data_file
15 class TestTdf141158(UITestCase
):
16 def test_tdf141158(self
):
17 # load the desired bugdoc
18 with self
.ui_test
.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) as document
:
19 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
20 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
21 # open the page styles dialog and select the headers tab
22 with self
.ui_test
.execute_dialog_through_command(".uno:PageStyleName") as xDialog
:
23 xTabs
= xDialog
.getChild("tabcontrol")
24 select_pos(xTabs
, "4")
25 # make the same left right page header state to off and apply the setting
26 checkSameLR
= xDialog
.getChild("checkSameLR")
27 checkSameLR
.executeAction("CLICK",tuple())
29 # go to the left header
30 xWriterEdit
.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
31 self
.xUITest
.executeCommand(".uno:JumpToHeader")
32 # get the text of the header
33 xPageSytle
= document
.getStyleFamilies().getByIndex(2)
34 xHeaderLeftText
= xPageSytle
.getByIndex(0).HeaderTextLeft
.String
35 # without the fix in place it was "Right Header" (lost hidden left header),
36 # with the fix it should pass...
37 self
.assertEqual("Left Header", xHeaderLeftText
)
39 # vim: set shiftwidth=4 softtabstop=4 expandtab: