from __future__ import annotations

from planemapper.renderer.projection import MapBounds, project


def test_home_projects_to_centre() -> None:
    bounds = MapBounds(home_lat=53.0, home_lon=-6.0, radius_nm=100.0)
    x, y = project(53.0, -6.0, bounds)
    assert abs(x - 400) <= 2
    assert abs(y - 240) <= 2


def test_out_of_bounds_not_clamped() -> None:
    bounds = MapBounds(home_lat=53.0, home_lon=-6.0, radius_nm=100.0)
    # 10 degrees of lat north is far outside any 100nm bounds
    x, y = project(63.0, -6.0, bounds)
    # y should be well above display top (y < 0)
    assert y < 0 or y > 480 or x < 0 or x > 800
