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 uitest
.uihelper
.common
import type_text
12 from uitest
.uihelper
.common
import select_pos
13 from uitest
.uihelper
.common
import get_state_as_dict
14 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 class tdf115871(UITestCase
):
18 def test_tdf115871_reset_outline_list_options_parent(self
):
20 with self
.ui_test
.create_doc_in_start_center("writer"):
22 # Create new style from selection
23 with self
.ui_test
.execute_dialog_through_command(".uno:StyleNewByExample") as xDialog
:
24 xStyleName
= xDialog
.getChild("stylename")
25 type_text(xStyleName
, "Custom Heading 1")
27 # Modify the created style to inherit paragraph attributes from Heading 1
28 with self
.ui_test
.execute_dialog_through_command(".uno:EditStyle") as xDialog
:
29 xTabs
= xDialog
.getChild("tabcontrol")
30 select_pos(xTabs
, "0")
31 xLinkedWith
= xTabs
.getChild("linkedwith")
32 xLinkedWith
.executeAction("SELECT", mkPropertyValues({"TEXT": "Heading 1"}))
33 self
.assertEqual(get_state_as_dict(xLinkedWith
)["SelectEntryText"], "Heading 1")
35 # Modify outline & list settings of the created style
36 with self
.ui_test
.execute_dialog_through_command(".uno:EditStyle") as xDialog
:
37 xTabs
= xDialog
.getChild("tabcontrol")
38 select_pos(xTabs
, "13")
41 xOutlineLevel
= xTabs
.getChild("comboLB_OUTLINE_LEVEL")
42 xOutlineLevel
.executeAction("SELECT", mkPropertyValues({"TEXT": "Level 5"}))
43 self
.assertEqual(get_state_as_dict(xOutlineLevel
)["SelectEntryText"], "Level 5")
46 xListStyle
= xTabs
.getChild("comboLB_NUMBER_STYLE")
47 xListStyle
.executeAction("SELECT", mkPropertyValues({"TEXT": "Numbering 123"}))
48 self
.assertEqual(get_state_as_dict(xListStyle
)["SelectEntryText"], "Numbering 123")
50 # Line numbering including start with
51 xRestartAtParagraph
= xTabs
.getChild("checkCB_RESTART_PARACOUNT")
52 xRestartAtParagraph
.executeAction("CLICK", tuple())
53 self
.assertEqual(get_state_as_dict(xRestartAtParagraph
)["Selected"], "true")
54 xStartWith
= xTabs
.getChild("spinNF_RESTART_PARA")
55 xStartWith
.executeAction("UP", tuple())
56 self
.assertEqual(get_state_as_dict(xStartWith
)["Text"], "2")
58 # Open the paragraph style dialog and reset dialog to parent settings
59 with self
.ui_test
.execute_dialog_through_command(".uno:EditStyle") as xDialog
:
60 xTabs
= xDialog
.getChild("tabcontrol")
61 select_pos(xTabs
, "13")
63 xStandardButton
= xDialog
.getChild("standard")
64 xStandardButton
.executeAction("CLICK", tuple())
66 xOutlineLevel
= xTabs
.getChild("comboLB_OUTLINE_LEVEL")
67 # Without the fix in place, this test would have failed with
68 # AssertionError: 'Level 5' != 'Level 1'
69 self
.assertEqual(get_state_as_dict(xOutlineLevel
)["SelectEntryText"], "Level 1")
71 xListStyle
= xTabs
.getChild("comboLB_NUMBER_STYLE")
72 # Without the fix in place, this test would have failed with
73 # AssertionError: 'Numbering 123' != 'Heading Numbering'
74 self
.assertEqual(get_state_as_dict(xListStyle
)["SelectEntryText"], "Heading Numbering")
76 xRestartAtParagraph
= xTabs
.getChild("checkCB_RESTART_PARACOUNT")
77 # Without the fix in place, this test would have failed with
78 # AssertionError: 'true' != 'false'
79 self
.assertEqual(get_state_as_dict(xRestartAtParagraph
)["Selected"], "false")
80 self
.assertEqual(get_state_as_dict(xListStyle
)["SelectEntryText"], "Heading Numbering")
82 xStartWith
= xTabs
.getChild("spinNF_RESTART_PARA")
83 # Without the fix in place, this test would have failed with
84 # AssertionError: '2' != '1'
85 self
.assertEqual(get_state_as_dict(xStartWith
)["Text"], "1")
87 # vim: set shiftwidth=4 softtabstop=4 expandtab: