feat(map): add min/max highlighting toggle and live safeguards

- Add "Highlight Min/Max" option to ReadoutPanel showing peak rings.
- Reset to review mode and blank wafer map when switching away from map tab.
- Disable hover highlights and sensor dialog triggers during live stream.
- Lower trendPane height and add top margin headroom for tick labels.
- Add test coverage for blanking states, toggle overrides, and interactions.
This commit is contained in:
jack
2026-07-10 16:28:55 -07:00
parent 034f13b717
commit 25fa7507ce
9 changed files with 103 additions and 13 deletions
+23
View File
@@ -53,6 +53,29 @@ def test_pause_stop_timer(controller):
controller.stop()
assert controller.frameIndex == 0
def test_leaving_live_mode_blanks_wafer_map(controller):
"""Stopping a live session (tab switch → setMode) must not leave stale
sensor values on the wafer map — it should read as blank."""
frame_signal = MagicMock()
controller.frameUpdated.connect(frame_signal)
controller.setMode("live")
controller._on_live_frame(Frame(seq=1, time=0.0, values=[100.0] * 22))
assert controller.sensorValues, "sanity: live frame should populate the map"
controller.setMode("review")
assert controller.sensorValues == []
assert controller.stats == {}
assert frame_signal.called, "QML needs frameUpdated to repaint blank"
def test_leaving_live_mode_stops_stream(controller):
controller.setMode("live")
controller.setMode("review")
assert controller._reader is None
assert not controller._repaint_timer.isActive()
def test_compare_files_integration(controller):
# Mock the comparisonResult signal
mock_slot = MagicMock()
+30
View File
@@ -161,6 +161,36 @@ def test_export_image_highlights_hottest_and_coldest(tmp_path):
assert "#5b9df5" in found # coldest ring (sensorLow)
def test_show_extremes_toggle_gates_peak_rings(tmp_path):
"""showExtremes (Display setting) hides the hot/cold rings when off.
Same pixel probe as the highlight test: with rings off, no high/low
colored pixels should appear anywhere."""
from PySide6.QtGui import QImage
from pygui.backend.visualization.wafer_map_item import WaferMapItem
item = WaferMapItem()
assert item.showExtremes is True # rings on by default
item.setWidth(200)
item.setHeight(200)
item.sensors = [
{"label": "1", "x": -50.0, "y": 0.0},
{"label": "2", "x": 0.0, "y": 0.0},
{"label": "3", "x": 50.0, "y": 0.0},
]
item.values = [10.0, 20.0, 30.0]
item.showExtremes = False
out = tmp_path / "wafer.png"
assert item.export_image(str(out)) is True
img = QImage(str(out))
found = {img.pixelColor(x, y).name()
for y in range(img.height()) for x in range(img.width())}
assert "#ef4444" not in found
assert "#5b9df5" not in found
def test_readout_text_full_stats():
"""Export footer readout carries every READOUT stat with sensor indices.