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 tdf143569(UITestCase
):
16 def test_Tdf143569(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file("tdf143569.odt")):
20 xMainWindow
= self
.xUITest
.getTopFocusWindow()
21 xWriterEdit
= xMainWindow
.getChild("writer_edit")
23 self
.xUITest
.executeCommand(".uno:Sidebar")
25 xWriterEdit
.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
27 # wait until the navigator panel is available
28 xNavigatorPanel
= self
.ui_test
.wait_until_child_is_available('NavigatorPanel')
30 xContentTree
= xNavigatorPanel
.getChild("contenttree")
32 xHeadings
= xContentTree
.getChild('0')
33 self
.assertEqual('Headings', get_state_as_dict(xHeadings
)['Text'])
34 self
.assertEqual("1", get_state_as_dict(xHeadings
)['Children'])
36 xHeadings
.executeAction("EXPAND", tuple())
38 xChild
= xHeadings
.getChild('0')
40 # Without the fix in place, this test would have failed with
41 # AssertionError: 'Introduction' != 'Anchored to Paragraph'
42 self
.assertEqual('Introduction', get_state_as_dict(xChild
)['Text'])
43 self
.assertEqual("1", get_state_as_dict(xChild
)['Children'])
45 xChild
.executeAction("EXPAND", tuple())
47 xChild
= xChild
.getChild('0')
48 self
.assertEqual('Problem', get_state_as_dict(xChild
)['Text'])
49 self
.assertEqual("1", get_state_as_dict(xChild
)['Children'])
51 xChild
.executeAction("EXPAND", tuple())
53 xChild
= xChild
.getChild('0')
54 self
.assertEqual('Discussion Agenda', get_state_as_dict(xChild
)['Text'])
55 self
.assertEqual("2", get_state_as_dict(xChild
)['Children'])
57 xChild
.executeAction("EXPAND", tuple())
59 xChild1
= xChild
.getChild('0')
60 self
.assertEqual('Anchored to Paragraph', get_state_as_dict(xChild1
)['Text'])
61 self
.assertEqual("0", get_state_as_dict(xChild1
)['Children'])
63 xChild2
= xChild
.getChild('1')
64 self
.assertEqual('Anchored as Character', get_state_as_dict(xChild2
)['Text'])
65 self
.assertEqual("0", get_state_as_dict(xChild2
)['Children'])
67 self
.xUITest
.executeCommand(".uno:Sidebar")
69 # vim: set shiftwidth=4 softtabstop=4 expandtab: