mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-06-09 14:48:50 +02:00
feat(plot_base): plot_base, image and heatmap widget adopted to property-toolbar sync
This commit is contained in:
@@ -834,6 +834,24 @@ def test_device_properties_property_changed_signal(heatmap_widget):
|
||||
mock_handler.assert_any_call("x_device_name", "samx")
|
||||
|
||||
|
||||
def test_auto_emit_syncs_heatmap_toolbar_actions(heatmap_widget):
|
||||
from unittest.mock import Mock
|
||||
|
||||
fft_action = heatmap_widget.toolbar.components.get_action("image_processing_fft").action
|
||||
log_action = heatmap_widget.toolbar.components.get_action("image_processing_log").action
|
||||
|
||||
mock_handler = Mock()
|
||||
heatmap_widget.property_changed.connect(mock_handler)
|
||||
|
||||
heatmap_widget.fft = True
|
||||
heatmap_widget.log = True
|
||||
|
||||
assert fft_action.isChecked()
|
||||
assert log_action.isChecked()
|
||||
mock_handler.assert_any_call("fft", True)
|
||||
mock_handler.assert_any_call("log", True)
|
||||
|
||||
|
||||
def test_device_entry_validation_with_invalid_device(heatmap_widget):
|
||||
"""Test that invalid device names are handled gracefully."""
|
||||
# Try to set invalid device name
|
||||
|
||||
@@ -249,6 +249,31 @@ def test_toolbar_actions_presence(qtbot, mocked_client):
|
||||
assert bec_image_view.toolbar.components.exists("image_dim_combo")
|
||||
|
||||
|
||||
def test_auto_emit_syncs_image_toolbar_actions(qtbot, mocked_client):
|
||||
from unittest.mock import Mock
|
||||
|
||||
bec_image_view = create_widget(qtbot, Image, client=mocked_client)
|
||||
fft_action = bec_image_view.toolbar.components.get_action("image_processing_fft").action
|
||||
log_action = bec_image_view.toolbar.components.get_action("image_processing_log").action
|
||||
transpose_action = bec_image_view.toolbar.components.get_action(
|
||||
"image_processing_transpose"
|
||||
).action
|
||||
|
||||
mock_handler = Mock()
|
||||
bec_image_view.property_changed.connect(mock_handler)
|
||||
|
||||
bec_image_view.fft = True
|
||||
bec_image_view.log = True
|
||||
bec_image_view.transpose = True
|
||||
|
||||
assert fft_action.isChecked()
|
||||
assert log_action.isChecked()
|
||||
assert transpose_action.isChecked()
|
||||
mock_handler.assert_any_call("fft", True)
|
||||
mock_handler.assert_any_call("log", True)
|
||||
mock_handler.assert_any_call("transpose", True)
|
||||
|
||||
|
||||
def test_image_processing_fft_toggle(qtbot, mocked_client):
|
||||
bec_image_view = create_widget(qtbot, Image, client=mocked_client)
|
||||
bec_image_view.fft = True
|
||||
|
||||
Reference in New Issue
Block a user