# Path: diva/dashboard.py
# def row_layout(*row_sizes):
#     # calc a common-multiple so that can define all columns
#     # (not actually the LCM using this lazy way)
#     lcm = 1
#     for size in row_sizes:
#         lcm *= size
#     layout = []
#     for row_num, num_cols in enumerate(row_sizes):
#         col_width = int(lcm / num_cols)
#         for i in range(num_cols):
#             layout.append([i * col_width, row_num, col_width, 1])
# 
#     return layout
# 
# def get_grid_size(layout):
#     max_x = max([x + w for x, y, w, h in layout])
#     max_y = max([y + h for x, y, w, h in layout])
#     return (max_x, max_y)


import pytest
from diva.dashboard import row_layout, get_grid_size

def test_grid_size():
    size = get_grid_size([[0, 0, 1, 1]])
    assert size == (1, 1)
    size = get_grid_size([[0, 0, 1, 1], [1, 0, 1, 1]])
    assert size == (2, 1)

# Path: diva/dashboard.py
# def row_layout(*row_sizes):
#     # calc a common-multiple so that can define all columns
#     # (not actually the LCM using this lazy way)
#     lcm = 1
#     for size in row_sizes:
#         lcm *= size
#     layout = []
#     for row_num, num_cols in enumerate(row_sizes):
#         col_width = int(lcm / num_cols)
#         for i in range(num_cols):
#             layout.append([i * col_width, row_num, col_width, 1])
# 
#     return layout
# 
# def get_grid_size(layout):
#     max_x = max([x + w for x, y, w, h in layout])
#     max_y = max([y + h for x, y, w, h in layout])
#     return (max_x, max_y)


# Path: tests/dashboard_test.py
import pytest
from diva.dashboard import row_layout, get_grid_size


def test_grid_size():
    size = get_grid_size([[0, 0, 1, 1]])
    assert size == (1, 1)
    size = get_grid_size([[0, 0, 1, 1], [1, 0, 1, 1]])
    assert size == (2, 1)

    size = get_grid_size(row_layout(1, 2))