Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / navigator / tdf114724.py
blob0ddc9fa11d5a7b6760137ecb5c6bc88d16f270ec
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 tdf114724(UITestCase):
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")
21 self.xUITest.executeCommand(".uno:Sidebar")
22 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
24 xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
25 xToolBar = xNavigatorPanel.getChild("content5")
26 xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button
28 xWriterEdit.executeAction("FOCUS", tuple())
30 xContentTree = xNavigatorPanel.getChild("contenttree")
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"}))
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")
42 for _ in range(0,3):
43 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
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")
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")
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: