feat(map): add batch export and adjust layout alignment
- Implement synchronous offscreen wafer map PNG rendering and CSV summary. - Add "Batch Export" button to file browser sidebar. - Adjust trend pane bottom spacer to align with About button when visible. - Fix type check errors and add pytest coverage for batch export.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import json
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
import pygui.backend.controllers.session_controller as session_controller_module
|
||||
from pygui.backend.controllers.session_controller import SessionController
|
||||
from pygui.backend.models.frame import Frame
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -194,3 +197,31 @@ def test_export_segment_bad_index(qapp, controller, tmp_path):
|
||||
controller.segmentExported.connect(exported)
|
||||
controller.exportSegment(99)
|
||||
assert exported.call_args[0][0]["success"] is False
|
||||
|
||||
|
||||
def test_reset_live_trend_sets_start_time_and_emits_reset(controller, monkeypatch):
|
||||
monkeypatch.setattr(session_controller_module.time, "monotonic", lambda: 100.0)
|
||||
|
||||
reset_seen = MagicMock()
|
||||
controller.trendReset.connect(reset_seen)
|
||||
controller._reset_live_trend()
|
||||
|
||||
assert controller._stream_start_time == 100.0
|
||||
assert reset_seen.called
|
||||
|
||||
|
||||
def test_on_live_frame_emits_trend_delta_with_elapsed_seconds(controller, monkeypatch):
|
||||
controller._stream_start_time = 100.0
|
||||
monkeypatch.setattr(session_controller_module.time, "monotonic", lambda: 102.5)
|
||||
|
||||
delta_seen = MagicMock()
|
||||
controller.trendDelta.connect(delta_seen)
|
||||
|
||||
frame = Frame(seq=1, time=102.5, values=[10.0, 20.0, 30.0])
|
||||
controller._on_live_frame(frame)
|
||||
|
||||
payload = json.loads(delta_seen.call_args[0][0])
|
||||
assert len(payload) == 1
|
||||
elapsed, avg = payload[0]
|
||||
assert elapsed == pytest.approx(2.5)
|
||||
assert avg == pytest.approx(20.0)
|
||||
|
||||
Reference in New Issue
Block a user