Skip to content

Commit 18f4b7d

Browse files
author
Steve Canny
committed
acpt: add scenario for Section.page_width
1 parent ab625af commit 18f4b7d

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

features/sct-section-props.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,10 @@ Feature: Access and change section properties
2727
| CONTINUOUS | NEW_PAGE | NEW_PAGE |
2828
| NEW_PAGE | ODD_PAGE | ODD_PAGE |
2929
| NEW_COLUMN | None | NEW_PAGE |
30+
31+
32+
@wip
33+
Scenario: Get section page width
34+
Given a section having known page dimension
35+
Then the reported page width is 8.5 inches
36+
And the reported page height is 11 inches

features/steps/section.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@
1010

1111
from docx import Document
1212
from docx.enum.section import WD_SECTION
13+
from docx.shared import Inches
1314

1415
from helpers import test_docx
1516

1617

1718
# given ====================================================
1819

20+
@given('a section having known page dimension')
21+
def given_a_section_having_known_page_dimension(context):
22+
document = Document(test_docx('sct-section-props'))
23+
context.section = document.sections[-1]
24+
25+
1926
@given('a section having start type {start_type}')
2027
def given_a_section_having_start_type(context, start_type):
2128
section_idx = {
@@ -46,6 +53,16 @@ def when_I_set_the_section_start_type_to_start_type(context, start_type):
4653

4754
# then =====================================================
4855

56+
@then('the reported page width is 8.5 inches')
57+
def then_the_reported_page_width_is_width(context):
58+
assert context.section.page_width == Inches(8.5)
59+
60+
61+
@then('the reported page height is 11 inches')
62+
def then_the_reported_page_height_is_11_inches(context):
63+
assert context.section.page_height == Inches(11)
64+
65+
4966
@then('the reported section start type is {start_type}')
5067
def then_the_reported_section_start_type_is_type(context, start_type):
5168
expected_start_type = {

0 commit comments

Comments
 (0)