forked from genewildish/Mainline
feat(display): add reuse flag to Display protocol
- Add reuse parameter to Display.init() for all backends - PygameDisplay: reuse existing SDL window via class-level flag - TerminalDisplay: skip re-init when reuse=True - WebSocketDisplay: skip server start when reuse=True - SixelDisplay, KittyDisplay, NullDisplay: ignore reuse (not applicable) - MultiDisplay: pass reuse to child displays - Update benchmark.py to reuse pygame display for effect benchmarks - Add test_websocket_e2e.py with e2e marker - Register e2e marker in pyproject.toml
This commit is contained in:
@@ -155,8 +155,8 @@ class TestMultiDisplay:
|
||||
|
||||
assert multi.width == 120
|
||||
assert multi.height == 40
|
||||
mock_display1.init.assert_called_once_with(120, 40)
|
||||
mock_display2.init.assert_called_once_with(120, 40)
|
||||
mock_display1.init.assert_called_once_with(120, 40, reuse=False)
|
||||
mock_display2.init.assert_called_once_with(120, 40, reuse=False)
|
||||
|
||||
def test_show_forwards_to_all_displays(self):
|
||||
"""show forwards buffer to all displays."""
|
||||
@@ -199,3 +199,12 @@ class TestMultiDisplay:
|
||||
multi.show(["test"])
|
||||
multi.clear()
|
||||
multi.cleanup()
|
||||
|
||||
def test_init_with_reuse(self):
|
||||
"""init passes reuse flag to child displays."""
|
||||
mock_display = MagicMock()
|
||||
multi = MultiDisplay([mock_display])
|
||||
|
||||
multi.init(80, 24, reuse=True)
|
||||
|
||||
mock_display.init.assert_called_once_with(80, 24, reuse=True)
|
||||
|
||||
Reference in New Issue
Block a user