@@ -66,6 +66,13 @@ def it_can_grow_itself_to_help_merge(self, grow_to_fixture):
66
66
tc ._grow_to (width , height , top_tc )
67
67
assert tc ._span_to_width .call_args_list == expected_calls
68
68
69
+ def it_can_extend_its_horz_span_to_help_merge (self , span_width_fixture ):
70
+ tc , grid_width , top_tc , vMerge , expected_calls = span_width_fixture
71
+ tc ._span_to_width (grid_width , top_tc , vMerge )
72
+ tc ._move_content_to .assert_called_once_with (top_tc )
73
+ assert tc ._swallow_next_tc .call_args_list == expected_calls
74
+ assert tc .vMerge == vMerge
75
+
69
76
def it_raises_on_tr_above (self , tr_above_raise_fixture ):
70
77
tc = tr_above_raise_fixture
71
78
with pytest .raises (ValueError ):
@@ -154,9 +161,20 @@ def span_raise_fixture(self, request):
154
161
tbl = self ._snippet_tbl (snippet_idx )
155
162
tc = tbl .tr_lst [row ].tc_lst [col ]
156
163
tc_2 = tbl .tr_lst [row_2 ].tc_lst [col_2 ]
157
- print (tc .top , tc_2 .top , tc .bottom , tc_2 .bottom )
158
164
return tc , tc_2
159
165
166
+ @pytest .fixture
167
+ def span_width_fixture (
168
+ self , top_tc_ , grid_span_ , _move_content_to_ , _swallow_next_tc_ ):
169
+ tc = element ('w:tc' )
170
+ grid_span_ .side_effect = [1 , 3 , 4 ]
171
+ grid_width , vMerge = 4 , 'continue'
172
+ expected_calls = [
173
+ call (grid_width , top_tc_ ),
174
+ call (grid_width , top_tc_ )
175
+ ]
176
+ return tc , grid_width , top_tc_ , vMerge , expected_calls
177
+
160
178
@pytest .fixture (params = [(0 , 0 , 0 ), (4 , 0 , 0 )])
161
179
def tr_above_raise_fixture (self , request ):
162
180
snippet_idx , row_idx , col_idx = request .param
@@ -166,10 +184,18 @@ def tr_above_raise_fixture(self, request):
166
184
167
185
# fixture components ---------------------------------------------
168
186
187
+ @pytest .fixture
188
+ def grid_span_ (self , request ):
189
+ return property_mock (request , CT_Tc , 'grid_span' )
190
+
169
191
@pytest .fixture
170
192
def _grow_to_ (self , request ):
171
193
return method_mock (request , CT_Tc , '_grow_to' )
172
194
195
+ @pytest .fixture
196
+ def _move_content_to_ (self , request ):
197
+ return method_mock (request , CT_Tc , '_move_content_to' )
198
+
173
199
@pytest .fixture
174
200
def _span_dimensions_ (self , request ):
175
201
return method_mock (request , CT_Tc , '_span_dimensions' )
@@ -185,6 +211,10 @@ def _snippet_tbl(self, idx):
185
211
"""
186
212
return parse_xml (snippet_seq ('tbl-cells' )[idx ])
187
213
214
+ @pytest .fixture
215
+ def _swallow_next_tc_ (self , request ):
216
+ return method_mock (request , CT_Tc , '_swallow_next_tc' )
217
+
188
218
@pytest .fixture
189
219
def _tbl_ (self , request ):
190
220
return property_mock (request , CT_Tc , '_tbl' )
0 commit comments