mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-05 12:24:25 +01:00
Support: a QR code of buymeacoffee.com/zquu1xu570 in the uConsole main menu (src/ui/support.py, rows generated offline by tools/gen_support_qr.py), a small link on the Remote Crew pairing, lobby and settings screens and the web-host admin page (never inside #operations), .github/FUNDING.yml and a badge and Support section in both READMEs. Guides: the reference chapter lists 31 kn, VDS +/-4 deg and a VDS glossary entry and how a solo browser picks the submarine; the READMEs list the VDS keys and the mission editor's actual runtime subset (the DE README gets its missing 1.3.1 paragraph and current versions); the co-op, protocol and web-host guides cover the solo side choice, the seven submarine roles, sonar_set_vds_depth and the admin shutdown; help strings say submarine crew 1-7 and that a lowered VDS listens in parallel. Manual, shortcuts and manual PDFs regenerated. Saves stay v23. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AS36Eg72iLviiSVbCUVNAi
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""The support link: a valid QR code, drawn in the main menu only."""
|
|
|
|
import pygame
|
|
import pytest
|
|
|
|
from src.core import config
|
|
from src.core.game import Game
|
|
from src.ui import support
|
|
|
|
|
|
def _finder(rows, top, left):
|
|
block = [rows[top + y][left:left + 7] for y in range(7)]
|
|
return block == ["1111111", "1000001", "1011101", "1011101",
|
|
"1011101", "1000001", "1111111"]
|
|
|
|
|
|
def test_qr_rows_form_a_version_3_code_with_three_finder_patterns():
|
|
rows = support.QR_ROWS
|
|
assert len(rows) == 29 and all(len(row) == 29 and set(row) <= {"0", "1"} for row in rows)
|
|
assert _finder(rows, 0, 0) and _finder(rows, 0, 22) and _finder(rows, 22, 0)
|
|
assert support.SUPPORT_URL == "https://" + support.SUPPORT_SHORT
|
|
|
|
|
|
def test_support_corner_stays_on_the_canvas():
|
|
surface = pygame.Surface((config.SCREEN_W, config.SCREEN_H))
|
|
rect = support.draw_support_corner(surface, config.SCREEN_W - 24, 600,
|
|
(255, 255, 255), (128, 128, 128))
|
|
assert surface.get_rect().contains(rect)
|
|
assert support.qr_surface(3).get_width() == (29 + 4) * 3
|
|
|
|
|
|
@pytest.fixture
|
|
def game():
|
|
return Game(seed=4242, start_menu=False, audio_enabled=False, language="en")
|
|
|
|
|
|
def test_main_menu_draws_the_support_code_and_missions_do_not(game, monkeypatch):
|
|
calls = []
|
|
monkeypatch.setattr("src.core.game_draw.draw_support_corner",
|
|
lambda *args, **kwargs: calls.append(args))
|
|
game.draw()
|
|
assert calls == []
|
|
game.in_menu = True
|
|
game.main_menu = True
|
|
game.draw()
|
|
assert len(calls) == 1
|