added linear slider

This commit is contained in:
2026-06-15 07:50:41 +03:00
parent d28391c71f
commit ab2a3bb035
7 changed files with 239 additions and 16 deletions
+28
View File
@@ -64,6 +64,34 @@ def test_build_profile_reports_unreachable(monkeypatch):
assert "unreachable" in profile["api_error"]
def test_resample_track_path_count_even_spacing():
pts = [{"lat": 55.0, "lon": 37.0}, {"lat": 55.01, "lon": 37.0}]
samples = elev.resample_track_path_count(pts, 50)
assert len(samples) == 50
assert samples[0]["dist_m"] == 0.0
assert samples[-1]["dist_m"] > samples[0]["dist_m"]
gaps = [samples[i]["dist_m"] - samples[i - 1]["dist_m"] for i in range(1, len(samples))]
assert max(gaps) - min(gaps) < 1.0
def test_build_profile_target_points(monkeypatch):
monkeypatch.setattr(elev, "_probe_checked_at", 0.0)
monkeypatch.setattr(elev, "probe_elevation_api", lambda force=False: {"ok": True, "error": None})
monkeypatch.setattr(
elev,
"fetch_elevations_batch",
lambda lats, lons: [100.0 + i for i in range(len(lats))],
)
profile = elev.build_elevation_profile(
[{"lat": 55.0, "lon": 37.0}, {"lat": 55.01, "lon": 37.0}],
target_points=120,
)
assert len(profile["points"]) == 120
assert profile["step_m"] > 0
def test_find_nearest_hill_unreachable(monkeypatch):
monkeypatch.setattr(
elev,