@@ -31,6 +31,17 @@ def given_a_font_having_typeface_name(context, name):
3131 context .font = document .styles [style_name ].font
3232
3333
34+ @given ('a font of size {size}' )
35+ def given_a_font_of_size (context , size ):
36+ document = Document (test_docx ('txt-font-props' ))
37+ style_name = {
38+ 'unspecified' : 'Normal' ,
39+ '14 pt' : 'Having Typeface' ,
40+ '18 pt' : 'Large Size' ,
41+ }[size ]
42+ context .font = document .styles [style_name ].font
43+
44+
3445@given ('a run' )
3546def given_a_run (context ):
3647 document = Document ()
@@ -165,6 +176,13 @@ def when_I_assign_value_to_font_name(context, value):
165176 font .name = value
166177
167178
179+ @when ('I assign {value} to font.size' )
180+ def when_I_assign_value_str_to_font_size (context , value ):
181+ value = None if value == 'None' else int (value )
182+ font = context .font
183+ font .size = value
184+
185+
168186@when ('I assign {value_str} to its {bool_prop_name} property' )
169187def when_assign_true_to_bool_run_prop (context , value_str , bool_prop_name ):
170188 value = {'True' : True , 'False' : False , 'None' : None }[value_str ]
@@ -204,6 +222,13 @@ def then_font_name_is_value(context, value):
204222 assert font .name == value
205223
206224
225+ @then ('font.size is {value}' )
226+ def then_font_size_is_value (context , value ):
227+ value = None if value == 'None' else int (value )
228+ font = context .font
229+ assert font .size == value
230+
231+
207232@then ('it is a column break' )
208233def then_type_is_column_break (context ):
209234 attrib = context .last_child .attrib
0 commit comments