@@ -657,6 +657,11 @@ def it_knows_its_height_rule(self, height_rule_get_fixture):
657657 row , expected_rule = height_rule_get_fixture
658658 assert row .height_rule == expected_rule
659659
660+ def it_can_change_its_height_rule (self , height_rule_set_fixture ):
661+ row , rule , expected_xml = height_rule_set_fixture
662+ row .height_rule = rule
663+ assert row ._tr .xml == expected_xml
664+
660665 def it_provides_access_to_its_cells (self , cells_fixture ):
661666 row , row_idx , expected_cells = cells_fixture
662667 cells = row .cells
@@ -696,6 +701,32 @@ def height_rule_get_fixture(self, request):
696701 row = _Row (element (tr_cxml ), None )
697702 return row , expected_rule
698703
704+ @pytest .fixture (params = [
705+ ('w:tr' ,
706+ WD_ROW_HEIGHT .AUTO ,
707+ 'w:tr/w:trPr/w:trHeight{w:hRule=auto}' ),
708+ ('w:tr/w:trPr' ,
709+ WD_ROW_HEIGHT .AT_LEAST ,
710+ 'w:tr/w:trPr/w:trHeight{w:hRule=atLeast}' ),
711+ ('w:tr/w:trPr/w:trHeight' ,
712+ WD_ROW_HEIGHT .EXACTLY ,
713+ 'w:tr/w:trPr/w:trHeight{w:hRule=exact}' ),
714+ ('w:tr/w:trPr/w:trHeight{w:val=1440, w:hRule=exact}' ,
715+ WD_ROW_HEIGHT .AUTO ,
716+ 'w:tr/w:trPr/w:trHeight{w:val=1440, w:hRule=auto}' ),
717+ ('w:tr/w:trPr/w:trHeight{w:val=1440, w:hRule=auto}' ,
718+ None ,
719+ 'w:tr/w:trPr/w:trHeight{w:val=1440}' ),
720+ ('w:tr' , None , 'w:tr/w:trPr' ),
721+ ('w:tr/w:trPr' , None , 'w:tr/w:trPr' ),
722+ ('w:tr/w:trPr/w:trHeight' , None , 'w:tr/w:trPr/w:trHeight' ),
723+ ])
724+ def height_rule_set_fixture (self , request ):
725+ tr_cxml , new_rule , expected_cxml = request .param
726+ row = _Row (element (tr_cxml ), None )
727+ expected_xml = xml (expected_cxml )
728+ return row , new_rule , expected_xml
729+
699730 @pytest .fixture
700731 def idx_fixture (self ):
701732 tbl = element ('w:tbl/(w:tr,w:tr,w:tr)' )
0 commit comments