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 tdf151051(UITestCase
):
16 def test_tdf151051(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file('tdf151051.odt')):
19 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
20 xWriterEdit
= xWriterDoc
.getChild('writer_edit')
22 self
.xUITest
.executeCommand('.uno:Sidebar')
23 xWriterEdit
.executeAction('SIDEBAR', mkPropertyValues({'PANEL': 'SwNavigatorPanel'}))
25 # wait until the navigator panel is available
26 xNavigatorPanel
= self
.ui_test
.wait_until_child_is_available('NavigatorPanel')
28 xContentTree
= xNavigatorPanel
.getChild("contenttree")
30 xHeadings
= xContentTree
.getChild('0')
31 xHeadings
.executeAction("EXPAND", tuple())
33 xChild
= xHeadings
.getChild('0')
34 self
.assertEqual('0', get_state_as_dict(xChild
)['Children'])
36 xNavigatorPanel
= xWriterEdit
.getChild("NavigatorPanel")
37 xToolBar
= xNavigatorPanel
.getChild("content6")
38 xToolBar
.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 'promote' button
40 xHeadings
= xContentTree
.getChild('0')
41 xHeadings
.executeAction("EXPAND", tuple())
43 xChild
= xHeadings
.getChild('0')
44 xChild
.executeAction("EXPAND", tuple())
46 # Without the fix in place, this test would have failed with
47 # AssertionError: '1' != '0'
48 self
.assertEqual('1', get_state_as_dict(xChild
)['Children'])
50 self
.xUITest
.executeCommand('.uno:Sidebar')
52 # vim: set shiftwidth=4 softtabstop=4 expandtab: