Skip to content

Commit 92a0e52

Browse files
author
Steve Canny
committed
acpt: add scenarios for BaseStyle.priority
1 parent 0b89586 commit 92a0e52

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

features/steps/styles.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ def given_a_style_having_hidden_set_setting(context, setting):
8686
context.style = document.styles[style_name]
8787

8888

89+
@given('a style having priority of {setting}')
90+
def given_a_style_having_priority_of_setting(context, setting):
91+
document = Document(test_docx('sty-behav-props'))
92+
style_name = {
93+
'no setting': 'Baz',
94+
'42': 'Foo',
95+
}[setting]
96+
context.style = document.styles[style_name]
97+
98+
8999
@given('a style of type {style_type}')
90100
def given_a_style_of_type(context, style_type):
91101
document = Document(test_docx('sty-known-styles'))
@@ -126,6 +136,13 @@ def when_I_assign_value_to_style_hidden(context, value):
126136
style.hidden = new_value
127137

128138

139+
@when('I assign {value} to style.priority')
140+
def when_I_assign_value_to_style_priority(context, value):
141+
style = context.style
142+
new_value = None if value == 'None' else int(value)
143+
style.priority = new_value
144+
145+
129146
@when('I call add_style(\'{name}\', {type_str}, builtin={builtin_str})')
130147
def when_I_call_add_style(context, name, type_str, builtin_str):
131148
styles = context.document.styles
@@ -224,6 +241,13 @@ def then_style_paragraph_format_is_the_ParagraphFormat_object(context):
224241
assert paragraph_format.element is style.element
225242

226243

244+
@then('style.priority is {value}')
245+
def then_style_priority_is_value(context, value):
246+
style = context.style
247+
expected_value = None if value == 'None' else int(value)
248+
assert style.priority == expected_value
249+
250+
227251
@then('style.style_id is the {which} style id')
228252
def then_style_style_id_is_the_which_style_id(context, which):
229253
expected_style_id = {

features/sty-style-props.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,30 @@ Feature: Get and set style properties
5959
Then style.name is the new name
6060

6161

62+
@wip
63+
Scenario Outline: Get style display sort order
64+
Given a style having priority of <setting>
65+
Then style.priority is <value>
66+
67+
Examples: style.priority values
68+
| setting | value |
69+
| no setting | None |
70+
| 42 | 42 |
71+
72+
73+
@wip
74+
Scenario Outline: Set style display sort order
75+
Given a style having priority of <setting>
76+
When I assign <new-value> to style.priority
77+
Then style.priority is <value>
78+
79+
Examples: Style priority values
80+
| setting | new-value | value |
81+
| no setting | 42 | 42 |
82+
| 42 | 24 | 24 |
83+
| 42 | None | None |
84+
85+
6286
Scenario: Get style id
6387
Given a style having a known style id
6488
Then style.style_id is the known style id

0 commit comments

Comments
 (0)