diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2023-11-21 15:45:22 +0100 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2023-11-21 16:55:59 +0100 |
commit | c95f406fcde65e383cff90842ff66e55bfabfc79 (patch) | |
tree | d36bab2a208b938a6041f094c7941d4de35edaaf | |
parent | 2b4cb63a4450aff4582994ca6ac701287da61ddd (diff) |
tdf#115871 - Reset outline and list options to parent settings
Added the various items of the controls in the outline and list options
tab to the range container. Otherwise, the main dialog does not have any
knowledge about the options to reset to the parent settings.
Change-Id: Icc9f862e741eb0457cfb1c74e64324809c143ab3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159787
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
-rwxr-xr-x | sw/qa/uitest/writer_tests5/tdf115871.py | 87 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/numpara.cxx | 6 |
2 files changed, 92 insertions, 1 deletions
diff --git a/sw/qa/uitest/writer_tests5/tdf115871.py b/sw/qa/uitest/writer_tests5/tdf115871.py new file mode 100755 index 000000000000..1f8639b64586 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf115871.py @@ -0,0 +1,87 @@ +# -*- 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 uitest.uihelper.common import type_text +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf115871(UITestCase): + + def test_tdf115871_reset_outline_list_options_parent(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + # Create new style from selection + with self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") as xDialog: + xStyleName = xDialog.getChild("stylename") + type_text(xStyleName, "Custom Heading 1") + + # Modify the created style to inherit paragraph attributes from Heading 1 + with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xLinkedWith = xTabs.getChild("linkedwith") + xLinkedWith.executeAction("SELECT", mkPropertyValues({"TEXT": "Heading 1"})) + self.assertEqual(get_state_as_dict(xLinkedWith)["SelectEntryText"], "Heading 1") + + # Modify outline & list settings of the created style + with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "15") + + # Outline level + xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL") + xOutlineLevel.executeAction("SELECT", mkPropertyValues({"TEXT": "Level 5"})) + self.assertEqual(get_state_as_dict(xOutlineLevel)["SelectEntryText"], "Level 5") + + # List style + xListStyle = xTabs.getChild("comboLB_NUMBER_STYLE") + xListStyle.executeAction("SELECT", mkPropertyValues({"TEXT": "Numbering 123"})) + self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Numbering 123") + + # Line numbering including start with + xRestartAtParagraph = xTabs.getChild("checkCB_RESTART_PARACOUNT") + xRestartAtParagraph.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xRestartAtParagraph)["Selected"], "true") + xStartWith = xTabs.getChild("spinNF_RESTART_PARA") + xStartWith.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xStartWith)["Text"], "2") + + # Open the paragraph style dialog and reset dialog to parent settings + with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "15") + + xStandardButton = xDialog.getChild("standard") + xStandardButton.executeAction("CLICK", tuple()) + + xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL") + # Without the fix in place, this test would have failed with + # AssertionError: 'Level 5' != 'Level 1' + self.assertEqual(get_state_as_dict(xOutlineLevel)["SelectEntryText"], "Level 1") + + xListStyle = xTabs.getChild("comboLB_NUMBER_STYLE") + # Without the fix in place, this test would have failed with + # AssertionError: 'Numbering 123' != 'Heading Numbering' + self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Heading Numbering") + + xRestartAtParagraph = xTabs.getChild("checkCB_RESTART_PARACOUNT") + # Without the fix in place, this test would have failed with + # AssertionError: 'true' != 'false' + self.assertEqual(get_state_as_dict(xRestartAtParagraph)["Selected"], "false") + self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Heading Numbering") + + xStartWith = xTabs.getChild("spinNF_RESTART_PARA") + # Without the fix in place, this test would have failed with + # AssertionError: '2' != '1' + self.assertEqual(get_state_as_dict(xStartWith)["Text"], "1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index e002a6db1640..65875eb79c39 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -34,7 +34,11 @@ #include <sfx2/frame.hxx> #include <sfx2/viewsh.hxx> -const WhichRangesContainer SwParagraphNumTabPage::s_aPageRg(svl::Items<FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT>); +// tdf#115871 - reset outline and list options to parent settings +const WhichRangesContainer SwParagraphNumTabPage::s_aPageRg( + svl::Items<RES_LINENUMBER, RES_LINENUMBER, SID_ATTR_PARA_NUMRULE, SID_ATTR_PARA_NUMRULE, + SID_ATTR_PARA_OUTLINE_LEVEL, SID_ATTR_PARA_OUTLINE_LEVEL, FN_NUMBER_NEWSTART, + FN_NUMBER_NEWSTART_AT>); SwParagraphNumTabPage::SwParagraphNumTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttr) : SfxTabPage(pPage, pController, "modules/swriter/ui/numparapage.ui", "NumParaPage", &rAttr) |