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 # See the `m_aUpdateTimer.SetTimeout(200)` (to "avoid flickering of buttons")
29 # in the SwChildWinWrapper ctor in sw/source/uibase/fldui/fldwrap.cxx, where that
30 # m_aUpdateTimer is started by SwChildWinWrapper::ReInitDlg triggered from the
31 # xInsert click above.
32 xToolkit
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.awt.Toolkit')
33 xToolkit
.waitUntilAllIdlesDispatched()
35 xContentTree
= xNavigatorPanel
.getChild("contenttree")
37 xHeadings
= xContentTree
.getChild('0')
38 xHeadings
.executeAction("EXPAND", tuple())
40 xChild
= xHeadings
.getChild('0')
41 self
.assertEqual('0', get_state_as_dict(xChild
)['Children'])
43 xNavigatorPanel
= xWriterEdit
.getChild("NavigatorPanel")
44 xToolBar
= xNavigatorPanel
.getChild("HeadingsContentFunctionButtonsToolbar")
45 xToolBar
.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'promote' button
47 xHeadings
= xContentTree
.getChild('0')
48 xHeadings
.executeAction("EXPAND", tuple())
50 xChild
= xHeadings
.getChild('0')
51 xChild
.executeAction("EXPAND", tuple())
53 # Without the fix in place, this test would have failed with
54 # AssertionError: '1' != '0'
55 self
.assertEqual('1', get_state_as_dict(xChild
)['Children'])
57 self
.xUITest
.executeCommand('.uno:Sidebar')
59 # vim: set shiftwidth=4 softtabstop=4 expandtab: