File size: 812 Bytes
108c965
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def test_make_cell():
    """
    Test the make_cell function.
    """
    import numpy as np
    from app.tabs.submit_functions import make_cell

    # Arrange
    value = "Hello, World!"
    bbox = [10, 20, 30, 40]
    
    # Act
    cell = make_cell(value, bbox)
    
    # Assert
    expected_polygon = ((0, -5), (40, -5), (40, 25), (0, 25), (0, -5))
    assert np.array_equal(cell.polygon, expected_polygon)


def test_make_cell_for_text_position():
    """
    Test the make_cell function for text position.
    """
    import numpy as np
    from app.tabs.submit_functions import make_cell
    
    # Arrange
    value = "Hello, World!"
    bbox = [10, 20, 30, 40]

    # Act
    cell = make_cell(value, bbox)

    # Assert
    text_position = 10, 10
    assert (cell.text_x, cell.text_y) == text_position