feat(map): quiet HUD chrome — VIIRS default, collapsed rail
Satellite-first chrome: daily VIIRS preferred, layer rail collapsed on load, geofence after basemap, FIRMS-only default overlays, hide MKT standby ticker, Strait select instead of buttons, IBM Plex instead of Orbitron, news as 6px circleMarkers.
This commit is contained in:
parent
cb20473119
commit
beb457c382
2 changed files with 289 additions and 170 deletions
105
tests/test_hud_chrome.py
Normal file
105
tests/test_hud_chrome.py
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
"""Quiet HUD chrome: VIIRS default, collapsed rail, no Orbitron/MKT dashes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
HTML = (ROOT / "app/static/index.html").read_text()
|
||||
|
||||
|
||||
def _attr(html: str, elem_id: str) -> str:
|
||||
chunk = html.split(f'id="{elem_id}"', 1)[1].split(">", 1)[0]
|
||||
return chunk
|
||||
|
||||
|
||||
def test_initmap_prefers_viirs_true_color():
|
||||
init = HTML.split("async function initMap", 1)[1].split("function readMapPrefs", 1)[0]
|
||||
assert "VIIRS_SNPP_CorrectedReflectance_TrueColor" in init
|
||||
assert init.index("VIIRS_SNPP_CorrectedReflectance_TrueColor") < init.index(
|
||||
"MODIS_Terra_CorrectedReflectance_TrueColor"
|
||||
)
|
||||
assert init.index("MODIS_Terra_CorrectedReflectance_TrueColor") < init.index(
|
||||
"BlueMarble_ShadedRelief_Bathymetry"
|
||||
)
|
||||
|
||||
|
||||
def test_orbitron_gone():
|
||||
assert "Orbitron" not in HTML
|
||||
assert "IBM Plex Sans" in HTML
|
||||
assert "IBM Plex Mono" in HTML
|
||||
|
||||
|
||||
def test_lp_note_stripped_from_layer_list():
|
||||
assert 'class="lp-note"' not in HTML
|
||||
body = HTML.split('class="lp-body"', 1)[1].split("lp-legend", 1)[0]
|
||||
assert "lp-note" not in body
|
||||
|
||||
|
||||
def test_default_overlays_basemap_and_firms_only():
|
||||
fires = _attr(HTML, "lp-fires-on")
|
||||
assert "checked" in fires
|
||||
for eid in (
|
||||
"lp-cams-on",
|
||||
"lp-blips-on",
|
||||
"lp-news-on",
|
||||
"lp-radar-on",
|
||||
"lp-alerts-on",
|
||||
"lp-perim-on",
|
||||
"lp-ac-on",
|
||||
"lp-trains-on",
|
||||
"lp-storms-on",
|
||||
):
|
||||
assert "checked" not in _attr(HTML, eid), eid
|
||||
|
||||
|
||||
def test_geofence_markup_before_cameras():
|
||||
assert 'id="gf-draw"' in HTML
|
||||
assert HTML.index('id="gf-draw"') < HTML.index('id="lp-cams-on"')
|
||||
assert HTML.index('id="lp-base-on"') < HTML.index('id="gf-draw"')
|
||||
|
||||
|
||||
def test_parent_geofence_hud_survives():
|
||||
assert "watch_geofences" in HTML
|
||||
assert "function deleteGeofence" in HTML
|
||||
assert 'id="gf-finish"' in HTML
|
||||
assert 'id="gf-cancel"' in HTML
|
||||
assert 'id="gf-inbox"' in HTML
|
||||
|
||||
|
||||
def test_layer_rail_collapsed_on_load():
|
||||
head = HTML.split('class="lp-head"', 1)[1].split("</div>", 1)[0]
|
||||
assert 'aria-expanded="false"' in head
|
||||
assert 'id="layer-panel" class="collapsed"' in HTML
|
||||
|
||||
|
||||
def test_market_ticker_hidden_no_poll():
|
||||
mkt = HTML.split('class="ticker market"', 1)[1].split(">", 1)[0]
|
||||
assert "hidden" in mkt
|
||||
assert "setInterval(probeMarket" not in HTML
|
||||
assert "setInterval(loadMarket" not in HTML
|
||||
init = HTML.split("function initMarketTicker", 1)[1].split("function ", 1)[0]
|
||||
assert "/api/market" in init or "404-poll" in init
|
||||
assert "setInterval" not in init
|
||||
|
||||
|
||||
def test_news_pins_are_circle_markers():
|
||||
js = HTML.split("async function loadNewsPins", 1)[1].split("function refreshLiveOverlays", 1)[0]
|
||||
assert "L.circleMarker" in js
|
||||
assert "fillOpacity: 0.7" in js or "fillOpacity:0.7" in js
|
||||
assert "rotate(45deg)" not in js
|
||||
assert "L.divIcon" not in js
|
||||
|
||||
|
||||
def test_chokepoint_buttons_not_in_toolbar_flow():
|
||||
assert 'id="chokepoint-select"' in HTML
|
||||
css = HTML.split("</style>", 1)[0]
|
||||
assert ".chokepoint-btns { display: none; }" in css or ".chokepoint-btns{display:none" in css.replace(
|
||||
" ", ""
|
||||
)
|
||||
|
||||
|
||||
def test_brand_is_osint_slash():
|
||||
assert "GLOBAL SITUATIONAL AWARENESS TERMINAL" not in HTML
|
||||
assert "OSINT" in HTML
|
||||
assert 'class="accent">//</span>' in HTML
|
||||
Loading…
Reference in a new issue