X Tutup
Skip to content

Commit 4e56ce0

Browse files
author
Steve Canny
committed
acpt: add scenario for Section margin getters
1 parent bb37339 commit 4e56ce0

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

features/sct-section-props.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,15 @@ Feature: Access and change section properties
6363
| portrait | WD_ORIENT.LANDSCAPE | WD_ORIENT.LANDSCAPE |
6464
| landscape | WD_ORIENT.PORTRAIT | WD_ORIENT.PORTRAIT |
6565
| landscape | None | WD_ORIENT.PORTRAIT |
66+
67+
68+
@wip
69+
Scenario: Get section page margins
70+
Given a section having known page margins
71+
Then the reported left margin is 1.0 inches
72+
And the reported right margin is 1.25 inches
73+
And the reported top margin is 1.5 inches
74+
And the reported bottom margin is 1.75 inches
75+
And the reported gutter margin is 0.25 inches
76+
And the reported header margin is 0.5 inches
77+
And the reported footer margin is 0.75 inches

features/steps/section.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def given_a_section_having_known_page_dimension(context):
2323
context.section = document.sections[-1]
2424

2525

26+
@given('a section having known page margins')
27+
def given_a_section_having_known_page_margins(context):
28+
document = Document(test_docx('sct-section-props'))
29+
context.section = document.sections[0]
30+
31+
2632
@given('a section having start type {start_type}')
2733
def given_a_section_having_start_type(context, start_type):
2834
section_idx = {
@@ -83,6 +89,22 @@ def when_I_set_the_section_start_type_to_start_type(context, start_type):
8389

8490
# then =====================================================
8591

92+
@then('the reported {margin_side} margin is {inches} inches')
93+
def then_the_reported_margin_is_inches(context, margin_side, inches):
94+
prop_name = {
95+
'left': 'left_margin',
96+
'right': 'right_margin',
97+
'top': 'top_margin',
98+
'bottom': 'bottom_margin',
99+
'gutter': 'gutter',
100+
'header': 'header_distance',
101+
'footer': 'footer_distance',
102+
}[margin_side]
103+
expected_value = Inches(float(inches))
104+
actual_value = getattr(context.section, prop_name)
105+
assert actual_value == expected_value
106+
107+
86108
@then('the reported page orientation is {orientation}')
87109
def then_the_reported_page_orientation_is_orientation(context, orientation):
88110
expected_value = {
-378 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
X Tutup