Debian Codegraph @

sw/qa/uitest/navigator/tdf114724.py

raw
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
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/.
8 #
9
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
13
14 class tdf114724(UITestCase):
15
16 def test_track_headings_outline(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf114724.odt")):
18 xWriterDoc = self.xUITest.getTopFocusWindow()
19 xWriterEdit = xWriterDoc.getChild("writer_edit")
20
21 self.xUITest.executeCommand(".uno:Sidebar")
22 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
23
24 xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
25 xToolBar = xNavigatorPanel.getChild("content5")
26 xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button
27
28 xWriterEdit.executeAction("FOCUS", tuple())
29
30 xContentTree = xNavigatorPanel.getChild("contenttree")
31
32 self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1")
33 self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
34 self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
35 for _ in range(0,3):
36 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
37
38 self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 4")
39 self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4")
40 self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
41
42 for _ in range(0,3):
43 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
44
45 self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1")
46 self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
47 self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
48
49 # tdf#124456 makes the sidebar navigator consistent with the floating navigator's use
50 # of the stored root mode setting. This requires the root mode button to be clicked
51 # here to change the content navigation view back to all categories view for subsequent
52 # tests that expect the navigator tree to not be in root mode.
53 xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button
54 self.xUITest.executeCommand(".uno:Sidebar")
55
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: