@@ -97,6 +97,19 @@ def given_a_paragraph_format_having_align_type_alignment(context, type):
9797 context .paragraph_format = document .styles [style_name ].paragraph_format
9898
9999
100+ @given ('a paragraph format having {type} indent of {value}' )
101+ def given_a_paragraph_format_having_type_indent_value (context , type , value ):
102+ style_name = {
103+ 'inherit' : 'Normal' ,
104+ '18 pt' : 'Base' ,
105+ '17.3 pt' : 'Base' ,
106+ '-17.3 pt' : 'Citation' ,
107+ '46.1 pt' : 'Citation' ,
108+ }[value ]
109+ document = Document (test_docx ('sty-known-styles' ))
110+ context .paragraph_format = document .styles [style_name ].paragraph_format
111+
112+
100113@given ('a run' )
101114def given_a_run (context ):
102115 document = Document ()
@@ -315,6 +328,14 @@ def when_I_assign_value_to_paragraph_format_space(context, value_key, side):
315328 setattr (paragraph_format , prop_name , value )
316329
317330
331+ @when ('I assign {value} to paragraph_format.{type_}_indent' )
332+ def when_I_assign_value_to_paragraph_format_indent (context , value , type_ ):
333+ paragraph_format = context .paragraph_format
334+ prop_name = '%s_indent' % type_
335+ value = None if value == 'None' else Pt (float (value .split ()[0 ]))
336+ setattr (paragraph_format , prop_name , value )
337+
338+
318339@when ('I assign {value_str} to its {bool_prop_name} property' )
319340def when_assign_true_to_bool_run_prop (context , value_str , bool_prop_name ):
320341 value = {'True' : True , 'False' : False , 'None' : None }[value_str ]
@@ -458,6 +479,15 @@ def then_paragraph_format_space_side_is_value(context, side, value):
458479 assert actual_value == expected_value
459480
460481
482+ @then ('paragraph_format.{type_}_indent is {value}' )
483+ def then_paragraph_format_type_indent_is_value (context , type_ , value ):
484+ expected_value = None if value == 'None' else int (value )
485+ prop_name = '%s_indent' % type_
486+ paragraph_format = context .paragraph_format
487+ actual_value = getattr (paragraph_format , prop_name )
488+ assert actual_value == expected_value
489+
490+
461491@then ('run.font is the Font object for the run' )
462492def then_run_font_is_the_Font_object_for_the_run (context ):
463493 run , font = context .run , context .run .font
0 commit comments