@@ -291,6 +291,11 @@ def it_knows_its_alignment_value(self, alignment_get_fixture):
291291 paragraph_format , expected_value = alignment_get_fixture
292292 assert paragraph_format .alignment == expected_value
293293
294+ def it_can_change_its_alignment_value (self , alignment_set_fixture ):
295+ paragraph_format , value , expected_xml = alignment_set_fixture
296+ paragraph_format .alignment = value
297+ assert paragraph_format ._element .xml == expected_xml
298+
294299 # fixtures -------------------------------------------------------
295300
296301 @pytest .fixture (params = [
@@ -302,3 +307,21 @@ def alignment_get_fixture(self, request):
302307 p_cxml , expected_value = request .param
303308 paragraph_format = ParagraphFormat (element (p_cxml ))
304309 return paragraph_format , expected_value
310+
311+ @pytest .fixture (params = [
312+ ('w:p' , WD_ALIGN_PARAGRAPH .LEFT ,
313+ 'w:p/w:pPr/w:jc{w:val=left}' ),
314+ ('w:p/w:pPr' , WD_ALIGN_PARAGRAPH .CENTER ,
315+ 'w:p/w:pPr/w:jc{w:val=center}' ),
316+ ('w:p/w:pPr/w:jc{w:val=center}' , WD_ALIGN_PARAGRAPH .RIGHT ,
317+ 'w:p/w:pPr/w:jc{w:val=right}' ),
318+ ('w:p/w:pPr/w:jc{w:val=right}' , None ,
319+ 'w:p/w:pPr' ),
320+ ('w:p' , None ,
321+ 'w:p/w:pPr' ),
322+ ])
323+ def alignment_set_fixture (self , request ):
324+ p_cxml , value , expected_cxml = request .param
325+ paragraph_format = ParagraphFormat (element (p_cxml ))
326+ expected_xml = xml (expected_cxml )
327+ return paragraph_format , value , expected_xml
0 commit comments