Files
uconsole_asw_game/tests/test_feed_overlay_uboot.py
T
Claude 15350d1fa4 Show the uConsole's F11 log in the web operational log (1.3.169)
The Remote Crew "Einsatzprotokoll" only ever carried a few browser alerts
(damage, threat, mission end, proposals) and so looked empty. Every station
now gets its side's F11 log: the frigate's event feed for the frigate's
stations, the crewed boat's log for the submarine's, numbered once by the
bridge, with time stamp and category tag, up to 200 entries like F11.
Unchanged logs are not re-encoded; the browser keeps rows already shown.
The open log drawer has a fixed height, so a long log scrolls inside it
instead of pushing the chart away. On the uConsole, F11 now opens the
boat log on the submarine side too (with wheel scrolling).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018n9X2Pm9CMpZA5WVJik2Es
2026-10-03 05:13:24 +00:00

42 lines
1.8 KiB
Python

"""F11 on the submarine side opens the boat log, as it does on the frigate."""
import pygame
from src.core.game import Game
def test_f11_on_the_submarine_side_shows_the_boat_log(monkeypatch):
game = Game(seed=913, start_menu=False, audio_enabled=False, language="en")
try:
game.local_side = "uboot"
boat = game.claim_opfor_sub()
boat.notice(game.sim_t, "sonar", "Boat log line", stamp="08:05")
game.handle_event(pygame.event.Event(pygame.KEYDOWN, key=pygame.K_F11, mod=0,
unicode=""))
assert game.feed_overlay_open
shown = {}
def overlay(entries=None, telemetry=None):
shown["entries"] = [(entry.stamp, entry.text) for entry in entries]
shown["telemetry"] = [row[0] for row in telemetry]
monkeypatch.setattr(game, "draw_feed_overlay", overlay)
game._draw()
assert shown["entries"][-1] == ("08:05", "Boat log line")
assert shown["telemetry"][0] == "uboot.telemetry.course_speed"
monkeypatch.undo()
game._draw() # the real overlay draws without error
for index in range(40):
boat.notice(game.sim_t, "navigation", f"Line {index}", stamp="08:06")
game._draw()
# The headless window is the canvas: the wheel over the log scrolls it.
center = game.feed_overlay_rect().center
assert game._window_to_canvas(center) == center
game.handle_event(pygame.event.Event(pygame.MOUSEWHEEL, x=0, y=1, pos=center))
assert game.feed_overlay_scroll > 0
game.handle_event(pygame.event.Event(pygame.KEYDOWN, key=pygame.K_F11, mod=0,
unicode=""))
assert not game.feed_overlay_open
finally:
game.audio.shutdown()