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 get_state_as_dict
, get_url_for_data_file
14 class tdf149916(UITestCase
):
16 def get_item(self
, xTree
, name
):
17 for i
in xTree
.getChildren():
18 xItem
= xTree
.getChild(i
)
19 if name
== get_state_as_dict(xItem
)['Text']:
22 def test_tdf149916(self
):
24 with self
.ui_test
.load_file(get_url_for_data_file('tdf149916.odt')):
25 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
26 xWriterEdit
= xWriterDoc
.getChild('writer_edit')
28 self
.xUITest
.executeCommand('.uno:Sidebar')
29 xWriterEdit
.executeAction('SIDEBAR', mkPropertyValues({'PANEL': 'SwNavigatorPanel'}))
31 # wait until the navigator panel is available
32 xNavigatorPanel
= self
.ui_test
.wait_until_child_is_available('NavigatorPanel')
34 xContentTree
= xNavigatorPanel
.getChild('contenttree')
35 xFields
= self
.get_item(xContentTree
, 'Fields')
36 self
.assertEqual('Fields', get_state_as_dict(xFields
)['Text'])
38 xFields
.executeAction('EXPAND', tuple())
40 self
.assertEqual('1', get_state_as_dict(xFields
)['Children'])
42 # Without the fix in place, this test would have failed with
43 # AssertionError: 'cross-reference - First - 1' != 'cross-reference - __RefHeading___Toc45_480138666 - 1'
44 self
.assertEqual('cross-reference - First - 1', get_state_as_dict(xFields
.getChild('0'))['Text'])
46 self
.xUITest
.executeCommand('.uno:Sidebar')
48 # vim: set shiftwidth=4 softtabstop=4 expandtab: