@@ -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}' )
2733def 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}' )
87109def then_the_reported_page_orientation_is_orientation (context , orientation ):
88110 expected_value = {
0 commit comments