1313 WD_TABLE_DIRECTION ,
1414)
1515from docx .shared import Inches
16- from docx .table import Table , _Column , _Columns , _Row , _Rows
16+ from docx .table import Table , _Cell , _Column , _Columns , _Row , _Rows
1717
1818from helpers import test_docx
1919
@@ -37,6 +37,13 @@ def given_a_3x3_table_having_span_state(context: Context, span_state: str):
3737 context .table_ = document .tables [table_idx ]
3838
3939
40+ @given ("a _Cell object spanning {count} layout-grid cells" )
41+ def given_a_Cell_object_spanning_count_layout_grid_cells (context : Context , count : str ):
42+ document = Document (test_docx ("tbl-cell-props" ))
43+ table = document .tables [0 ]
44+ context .cell = _Cell (table ._tbl .tr_lst [int (count )].tc_lst [0 ], table )
45+
46+
4047@given ("a _Cell object with {state} vertical alignment as cell" )
4148def given_a_Cell_object_with_vertical_alignment_as_cell (context : Context , state : str ):
4249 table_idx = {
@@ -292,6 +299,13 @@ def when_I_set_the_table_autofit_to_setting(context: Context, setting: str):
292299# then =====================================================
293300
294301
302+ @then ("cell.grid_span is {count}" )
303+ def then_cell_grid_span_is_count (context : Context , count : str ):
304+ expected = int (count )
305+ actual = context .cell .grid_span
306+ assert actual == expected , f"expected { expected } , got { actual } "
307+
308+
295309@then ("cell.tables[0] is a 2 x 2 table" )
296310def then_cell_tables_0_is_a_2x2_table (context : Context ):
297311 cell = context .cell
0 commit comments