mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 22:35:08 +00:00
fix: address CodeRabbit review on #580
- Preview fallbacks (SSE stream and /display/current) use logical_size({})
(128x32, the shared default) instead of a hard-coded 128x64.
- display_geometry treats a non-mapping display/hardware block as missing,
so a malformed config.json falls back to defaults instead of raising
AttributeError (which turned the Starlark render into an HTTP 500).
- Docs: the static update interval falls back manifest -> plugin config
-> 60s, in both the API reference and the architecture spec.
Not taken: validating double_sided copies against chain_length/parallel.
An orientation Rotate: or U-mapper pixel mapper decides which axis panels
lie on, so the counts would reject working setups (the existing
vertical-split test is one).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,13 @@ def test_disabled_double_sided_is_ignored():
|
||||
assert logical_size(cfg) == (256, 32)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('display', ['oops', ['a'], 1, {'hardware': 'oops'},
|
||||
{'hardware': ['a']}])
|
||||
def test_non_mapping_display_config_uses_the_defaults(display):
|
||||
assert physical_size({'display': display}) == (128, 32)
|
||||
assert logical_size({'display': display}) == (128, 32)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def display_client(monkeypatch):
|
||||
from web_interface.blueprints.api_v3 import api_v3
|
||||
@@ -103,6 +110,15 @@ def test_display_current_defaults_chain_length_like_display_manager(display_clie
|
||||
assert (data['width'], data['height']) == (64 * DEFAULT_CHAIN_LENGTH, 32)
|
||||
|
||||
|
||||
def test_display_current_falls_back_to_the_shared_default(display_client):
|
||||
client, config_manager = display_client
|
||||
config_manager.load_config.side_effect = ValueError('unreadable')
|
||||
|
||||
data = client.get('/api/v3/display/current').get_json()['data']
|
||||
|
||||
assert (data['width'], data['height']) == logical_size({}) == (128, 32)
|
||||
|
||||
|
||||
def test_preview_callers_do_not_rederive_the_size():
|
||||
"""Every preview/size caller goes through display_geometry, so none of
|
||||
them can drift back to a private chain_length default."""
|
||||
|
||||
Reference in New Issue
Block a user