Skip to content

Commit 1db743c

Browse files
committed
acpt: add scenarios for Section.diff_first_page..
Add scenarios for Section.different_first_page_header_footer.
1 parent b48f860 commit 1db743c

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

features/sct-section.feature

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ Feature: Access and change section properties
44
I need a way to get and set the properties of a section
55

66

7+
@wip
8+
Scenario Outline: Section.different_first_page_header_footer getter
9+
Given a Section object <with-or-without> a distinct first-page header as section
10+
Then section.different_first_page_header_footer is <value>
11+
12+
Examples: Section.different_first_page_header_footer states
13+
| with-or-without | value |
14+
| with | True |
15+
| without | False |
16+
17+
18+
@wip
19+
Scenario Outline: Section.different_first_page_header_footer setter
20+
Given a Section object <with-or-without> a distinct first-page header as section
21+
When I assign <value> to section.different_first_page_header_footer
22+
Then section.different_first_page_header_footer is <value>
23+
24+
Examples: Section.different_first_page_header_footer assignment cases
25+
| with-or-without | value |
26+
| with | True |
27+
| with | False |
28+
| without | True |
29+
| without | False |
30+
31+
732
Scenario: Section.footer
833
Given a Section object as section
934
Then section.footer is a _Footer object

features/steps/section.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def given_a_Section_object_as_section(context):
2323
context.section = Document(test_docx("sct-section-props")).sections[-1]
2424

2525

26+
@given("a Section object {with_or_without} a distinct first-page header as section")
27+
def given_a_Section_object_with_or_without_first_page_header(context, with_or_without):
28+
section_idx = {"with": 1, "without": 0}[with_or_without]
29+
context.section = Document(test_docx("sct-first-page-hdrftr")).sections[section_idx]
30+
31+
2632
@given('a section collection containing 3 sections')
2733
def given_a_section_collection_containing_3_sections(context):
2834
document = Document(test_docx('doc-access-sections'))
@@ -66,6 +72,11 @@ def given_a_section_having_known_orientation(context, orientation):
6672

6773
# when =====================================================
6874

75+
@when("I assign {bool_val} to section.different_first_page_header_footer")
76+
def when_I_assign_value_to_section_different_first_page_hdrftr(context, bool_val):
77+
context.section.different_first_page_header_footer = eval(bool_val)
78+
79+
6980
@when('I set the {margin_side} margin to {inches} inches')
7081
def when_I_set_the_margin_side_length(context, margin_side, inches):
7182
prop_name = {
@@ -142,6 +153,15 @@ def then_len_sections_is_3(context):
142153
)
143154

144155

156+
@then("section.different_first_page_header_footer is {bool_val}")
157+
def then_section_different_first_page_header_footer_is(context, bool_val):
158+
actual = context.section.different_first_page_header_footer
159+
expected = eval(bool_val)
160+
assert actual == expected, (
161+
"section.different_first_page_header_footer is %s" % actual
162+
)
163+
164+
145165
@then("section.footer is a _Footer object")
146166
def then_section_footer_is_a_Footer_object(context):
147167
actual = type(context.section.footer).__name__
14.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)