Skip to content

Commit bbedd39

Browse files
author
Steve Canny
committed
acpt: add scenarios for .next_paragraph_style
1 parent cb1ce72 commit bbedd39

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

features/steps/styles.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@ def given_a_style_having_locked_setting(context, setting):
140140
context.style = document.styles[style_name]
141141

142142

143+
@given('a style having next paragraph style set to {setting}')
144+
def given_a_style_having_next_paragraph_style_setting(context, setting):
145+
document = Document(test_docx('sty-known-styles'))
146+
style_name = {
147+
'Sub Normal': 'Citation',
148+
'Foobar': 'Sub Normal',
149+
'Base': 'Foo',
150+
'no setting': 'Base',
151+
}[setting]
152+
context.styles = document.styles
153+
context.style = document.styles[style_name]
154+
155+
143156
@given('a style having priority of {setting}')
144157
def given_a_style_having_priority_of_setting(context, setting):
145158
document = Document(test_docx('sty-behav-props'))
@@ -248,6 +261,13 @@ def when_I_assign_value_to_style_locked(context, value):
248261
style.locked = new_value
249262

250263

264+
@when('I assign {value} to style.next_paragraph_style')
265+
def when_I_assign_value_to_style_next_paragraph_style(context, value):
266+
styles, style = context.styles, context.style
267+
new_value = None if value == 'None' else styles[value]
268+
style.next_paragraph_style = new_value
269+
270+
251271
@when('I assign {value} to style.priority')
252272
def when_I_assign_value_to_style_priority(context, value):
253273
style = context.style
@@ -426,6 +446,14 @@ def then_style_name_is_the_which_name(context, which):
426446
assert style.name == expected_name
427447

428448

449+
@then('style.next_paragraph_style is {value}')
450+
def then_style_next_paragraph_style_is_value(context, value):
451+
style, styles = context.style, context.styles
452+
actual_value = style.next_paragraph_style
453+
expected_value = styles[value]
454+
assert actual_value == expected_value, 'got %s' % actual_value
455+
456+
429457
@then('style.paragraph_format is the ParagraphFormat object for the style')
430458
def then_style_paragraph_format_is_the_ParagraphFormat_object(context):
431459
style = context.style
30 Bytes
Binary file not shown.

features/sty-style-props.feature

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,31 @@ Feature: Get and set style properties
8181
Then style.name is the new name
8282

8383

84+
@wip
85+
Scenario Outline: Get next paragraph style
86+
Given a style having next paragraph style set to <setting>
87+
Then style.next_paragraph_style is <value>
88+
89+
Examples: Style next paragraph style values
90+
| setting | value |
91+
| no setting | Base |
92+
| Sub Normal | Sub Normal |
93+
| Foobar | Sub Normal |
94+
95+
96+
@wip
97+
Scenario Outline: Set next paragraph style
98+
Given a style having next paragraph style set to <setting>
99+
When I assign <new-value> to style.next_paragraph_style
100+
Then style.next_paragraph_style is <value>
101+
102+
Examples: Results of assignment to .next_paragraph_style
103+
| setting | new-value | value |
104+
| no setting | Citation | Citation |
105+
| Sub Normal | Base | Base |
106+
| Base | None | Foo |
107+
108+
84109
Scenario Outline: Get style display sort order
85110
Given a style having priority of <setting>
86111
Then style.priority is <value>

0 commit comments

Comments
 (0)