diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2024-01-29 16:04:45 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2024-02-05 07:50:17 +0100 |
commit | 070b4ddda4983773e8a989a116924bee0f651f25 (patch) | |
tree | c8656329425e2cb9b6ce007f31ed60bf8449fb63 /sw/qa | |
parent | ab320f4e11c70b50e5beddf12ad925f192941d9a (diff) |
tdf#159428 Prefer heading over bookmarks in Navigator
When a bookmark is in a heading, highlighting the heading
is more important than highlighting the bookmark.
Change-Id: I6348e42b14ece226a25961bd3145193645972e79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162694
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/uitest/data/tdf159428.odt | bin | 0 -> 38356 bytes | |||
-rw-r--r-- | sw/qa/uitest/navigator/tdf159428.py | 49 |
2 files changed, 49 insertions, 0 deletions
diff --git a/sw/qa/uitest/data/tdf159428.odt b/sw/qa/uitest/data/tdf159428.odt Binary files differnew file mode 100644 index 000000000000..6b30d6bf0cdc --- /dev/null +++ b/sw/qa/uitest/data/tdf159428.odt diff --git a/sw/qa/uitest/navigator/tdf159428.py b/sw/qa/uitest/navigator/tdf159428.py new file mode 100644 index 000000000000..3a8634a57629 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf159428.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf159428(UITestCase): + + def test_tdf159428(self): + global selectionChangedResult + with self.ui_test.load_file(get_url_for_data_file('tdf159428.odt')): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + xContentTree = xNavigatorPanel.getChild("contenttree") + + # select fist bookmark - Heading "H1" should be tracked + self.xUITest.executeCommand(".uno:GoToNextPara") + self.xUITest.executeCommand(".uno:GoToNextPara") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "111", "END_POS": "119"})) + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "H1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "H1") + + # select second bookmark - Heading "H1 mit Lesezeichen" should be tracked + self.xUITest.executeCommand(".uno:GoToNextPara") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "18"})) + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "H1 mit Lesezeichen") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "H1 mit Lesezeichen") + + # select third bookmark - no heading tracked + self.xUITest.executeCommand(".uno:GoToPrevPara") + self.xUITest.executeCommand(".uno:GoToPrevPara") + self.xUITest.executeCommand(".uno:GoToPrevPara") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "141", "END_POS": "146"})) + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "Lesezeichen 3") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Lesezeichen 3") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |