X Tutup
Skip to content

Commit 4c556a3

Browse files
author
Steve Canny
committed
acpt: add scenarios for Section.start_type setter
1 parent c6ec277 commit 4c556a3

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

features/sct-section-props.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@ Feature: Access and change section properties
1515
| NEW_PAGE |
1616
| EVEN_PAGE |
1717
| ODD_PAGE |
18+
19+
20+
@wip
21+
Scenario Outline: Set section start type
22+
Given a section having start type <initial-start-type>
23+
When I set the section start type to <new-start-type>
24+
Then the reported section start type is <reported-start-type>
25+
26+
Examples: Section start types
27+
| initial-start-type | new-start-type | reported-start-type |
28+
| CONTINUOUS | NEW_PAGE | NEW_PAGE |
29+
| NEW_PAGE | ODD_PAGE | ODD_PAGE |
30+
| NEW_COLUMN | None | NEW_PAGE |

features/steps/section.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from __future__ import absolute_import, print_function, unicode_literals
88

9-
from behave import given, then
9+
from behave import given, then, when
1010

1111
from docx import Document
1212
from docx.enum.section import WD_SECTION
@@ -29,6 +29,21 @@ def given_a_section_having_start_type(context, start_type):
2929
context.section = document.sections[section_idx]
3030

3131

32+
# when =====================================================
33+
34+
@when('I set the section start type to {start_type}')
35+
def when_I_set_the_section_start_type_to_start_type(context, start_type):
36+
new_start_type = {
37+
'None': None,
38+
'CONTINUOUS': WD_SECTION.CONTINUOUS,
39+
'EVEN_PAGE': WD_SECTION.EVEN_PAGE,
40+
'NEW_COLUMN': WD_SECTION.NEW_COLUMN,
41+
'NEW_PAGE': WD_SECTION.NEW_PAGE,
42+
'ODD_PAGE': WD_SECTION.ODD_PAGE,
43+
}[start_type]
44+
context.section.start_type = new_start_type
45+
46+
3247
# then =====================================================
3348

3449
@then('the reported section start type is {start_type}')

0 commit comments

Comments
 (0)
X Tutup