Files
uconsole_asw_game/tests/test_event_feed_and_help.py
T
db9979andClaude Opus 5.5 5bcb880e6f German umlauts, banner language, own weapons on the OPZ chart
- German catalog: 648 entries move from ae/oe/ue/ss transliteration to
  real umlauts and sharp s (Brücke, zurück, Größe, außerhalb); genuine
  sequences (Feuer, neue, Quelle, Frequenz, aktuell), English words and
  {placeholders} stay. The translator also resolves the old ASCII
  spellings of code literals, in both languages.
- The whole draw pass runs in the game's translation scope: the flash
  banner in the top bar was rendered by the process-wide English
  translator while the game ran in German.
- OPZ shows own commanded weapons: torpedoes from ship, helicopter or
  ASROC (T<n>), ASROC and ESSM on the native chart, and the same torpedo/
  ASROC/Nixie rows in the web OPZ own_assets (strict client schema).
- Commander capture accepts the unpainted sonar and helicopter
  waterfalls (headless virtual time does not run their animation clock);
  web and native screenshots, manual (MD/PDF) and shortcut sheet are
  regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 18:22:55 +02:00

78 lines
2.7 KiB
Python

"""Regression coverage for persistent notices and station command help."""
from src.core import config
from src.core.game import Game
from src.core.help import get_help
from src.core.i18n import localize, message
from src.core.station import Station
def _help_keys(station):
_intro, controls, _notes, _tactics = get_help(station, lambda key: key)
return {key: action for key, action in controls}
def test_every_emitted_feed_category_has_a_visible_tag():
assert "opz" in config.FEED_CATEGORIES
assert all(tag != "?" for _color, tag in config.FEED_CATEGORIES.values())
def test_mission_result_is_retained_in_event_feed():
game = Game(seed=9191, start_menu=False)
game.feed.clear()
game._end_mission(False, message("end.reason.time_limit"))
assert localize(game.feed.entries[-1].text, game.tr) == game.tr(
"runtime.mission.lost")
assert game.feed.entries[-1].category == "mission"
def test_every_radio_message_is_mirrored_to_the_event_feed():
game = Game(seed=9292, start_menu=False)
game.feed.clear()
game.messages.clear()
notice = message("runtime.hq.threat_unknown")
game.hq_msg(notice)
assert game.messages[-1][1] is notice
assert game.feed.entries[-1].text is notice
assert game.feed.entries[-1].category == "funk"
def test_context_help_covers_new_station_commands():
sonar = _help_keys(Station.SONAR)
assert sonar["Shift+C"] == "help.control.display_palette"
assert sonar["Ctrl+I / Ctrl+O"] == "help.control.display_black"
weapons = _help_keys(Station.WEAPONS)
assert weapons["F"] == "help.control.flak_release"
opz = _help_keys(Station.OPZ)
assert opz["Shift+F"] == "help.control.opz_filter"
assert opz["J"] == "help.control.opz_track_id"
assert opz["I"] == "help.control.ciws_release"
assert opz["Enter"] == "help.control.confirm_live_engage"
helicopter = _help_keys(Station.HELICOPTER)
assert helicopter["G / Shift+G"] == "help.control.helo_contact_release"
eloka = _help_keys(Station.ELOKA)
for key in ("F / Shift+F / B", "J", "Shift+J", "A", "M"):
assert key in eloka
def test_flash_banner_follows_game_language(monkeypatch):
from src.core.game import Game
from src.core.i18n import localize, message
from src.ui import layout
game = Game(seed=5, start_menu=False, audio_enabled=False, language="de")
shown = []
original = layout.blit_block
monkeypatch.setattr(layout, "blit_block", lambda surface, text, *args, **kwargs: (
shown.append(localize(text)), original(surface, text, *args, **kwargs))[1])
game.flash(message("runtime.contacts.none"), 5.0)
game.draw()
assert "Keine Kontakte" in shown and "No contacts" not in shown