@@ -68,6 +68,17 @@ def given_a_font_of_size(context, size):
6868 context .font = document .styles [style_name ].font
6969
7070
71+ @given ('a paragraph format having {prop_name} set {setting}' )
72+ def given_a_paragraph_format_having_prop_set (context , prop_name , setting ):
73+ style_name = {
74+ 'to inherit' : 'Normal' ,
75+ 'On' : 'Base' ,
76+ 'Off' : 'Citation' ,
77+ }[setting ]
78+ document = Document (test_docx ('sty-known-styles' ))
79+ context .paragraph_format = document .styles [style_name ].paragraph_format
80+
81+
7182@given ('a paragraph format having {setting} line spacing' )
7283def given_a_paragraph_format_having_setting_line_spacing (context , setting ):
7384 style_name = {
@@ -336,6 +347,13 @@ def when_I_assign_value_to_paragraph_format_indent(context, value, type_):
336347 setattr (paragraph_format , prop_name , value )
337348
338349
350+ @when ('I assign {value} to paragraph_format.{prop_name}' )
351+ def when_I_assign_value_to_paragraph_format_prop (context , value , prop_name ):
352+ paragraph_format = context .paragraph_format
353+ value = {'None' : None , 'True' : True , 'False' : False }[value ]
354+ setattr (paragraph_format , prop_name , value )
355+
356+
339357@when ('I assign {value_str} to its {bool_prop_name} property' )
340358def when_assign_true_to_bool_run_prop (context , value_str , bool_prop_name ):
341359 value = {'True' : True , 'False' : False , 'None' : None }[value_str ]
@@ -488,6 +506,14 @@ def then_paragraph_format_type_indent_is_value(context, type_, value):
488506 assert actual_value == expected_value
489507
490508
509+ @then ('paragraph_format.{prop_name} is {value}' )
510+ def then_paragraph_format_prop_name_is_value (context , prop_name , value ):
511+ expected_value = {'None' : None , 'True' : True , 'False' : False }[value ]
512+ paragraph_format = context .paragraph_format
513+ actual_value = getattr (paragraph_format , prop_name )
514+ assert actual_value == expected_value
515+
516+
491517@then ('run.font is the Font object for the run' )
492518def then_run_font_is_the_Font_object_for_the_run (context ):
493519 run , font = context .run , context .run .font
0 commit comments