mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-16 03:49:13 +00:00
fix(vegas): a static pause redraws its plugin for the whole pause
The pause called display(force_clear=True) once and slept out the duration, so a plugin that rotates its screens or animates (Fantasy Blitz's playlist) was frozen on its first frame. The pause now calls display() again at the rotation's rate: once a second, or the high-FPS interval for a plugin that declares needs_high_fps (or scrolls). Only the first call clears. A redraw that finds update() holding the plugin lock is skipped; the pause carries on. Interrupt checks and the watchdog beat still run every 0.1 s; a raise still ends the pause. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import logging
|
||||
import os
|
||||
import threading
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import MagicMock, call
|
||||
|
||||
os.environ.setdefault("EMULATOR", "true")
|
||||
|
||||
@@ -62,6 +62,7 @@ def _plugin(duration, plugin_id='clock-simple'):
|
||||
plugin = MagicMock()
|
||||
plugin.plugin_id = plugin_id
|
||||
plugin.get_display_duration.return_value = duration
|
||||
plugin.needs_high_fps = False
|
||||
return plugin
|
||||
|
||||
|
||||
@@ -104,7 +105,9 @@ class TestPauseLength:
|
||||
completed, lasted = _pause(_coord(plugin), plugin, clock)
|
||||
assert completed is True
|
||||
assert lasted == pytest.approx(30.0, abs=0.15)
|
||||
plugin.display.assert_called_once_with(force_clear=True)
|
||||
# Redrawn once a second; only the first draw clears.
|
||||
assert plugin.display.call_args_list[0] == call(force_clear=True)
|
||||
assert plugin.display.call_count == 30
|
||||
|
||||
@pytest.mark.parametrize('value', NOT_ABOVE_ZERO, ids=repr)
|
||||
def test_a_number_not_above_zero_pauses_for_15s(self, clock, value):
|
||||
|
||||
Reference in New Issue
Block a user