0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

fix: change default colormap to plasma

This commit is contained in:
2025-04-23 17:52:22 +02:00
parent 3709cdc866
commit 074bbbc166
17 changed files with 32 additions and 34 deletions

View File

@ -16,10 +16,10 @@ def test_color_map_widget_init(color_map_widget):
"""Test that the widget initializes correctly."""
assert color_map_widget is not None
assert isinstance(color_map_widget, BECColorMapWidget)
assert color_map_widget.colormap == "magma"
assert color_map_widget.colormap == "plasma"
assert isinstance(color_map_widget.button, ColorMapButton)
# Check that the button has the correct initial colormap
assert color_map_widget.button.colorMap().name == "magma"
assert color_map_widget.button.colorMap().name == "plasma"
def test_color_map_widget_set_valid_colormap(color_map_widget):
@ -44,7 +44,7 @@ def test_color_map_widget_set_invalid_colormap(color_map_widget):
def test_color_map_widget_signal_emitted(color_map_widget, qtbot):
"""Test that the signal is emitted when the colormap changes."""
new_cmap = "plasma"
new_cmap = "magma"
with qtbot.waitSignal(color_map_widget.colormap_changed_signal, timeout=1000) as blocker:
color_map_widget.colormap = new_cmap
assert blocker.signal_triggered
@ -58,7 +58,7 @@ def test_color_map_widget_signal_not_emitted_for_invalid_colormap(color_map_widg
with qtbot.assertNotEmitted(color_map_widget.colormap_changed_signal):
color_map_widget.colormap = invalid_cmap
# The colormap should remain unchanged
assert color_map_widget.colormap == "magma"
assert color_map_widget.colormap == "plasma"
def test_color_map_widget_resize(color_map_widget):

View File

@ -142,7 +142,7 @@ def curve_tree_fixture(qtbot, mocked_client_with_dap):
Creates a CurveTree widget referencing a mocked or real Waveform.
"""
wf = create_widget(qtbot, Waveform, client=mocked_client_with_dap)
wf.color_palette = "magma"
wf.color_palette = "plasma"
curve_tree = create_widget(qtbot, CurveTree, parent=None, waveform=wf)
return curve_tree, wf
@ -154,7 +154,7 @@ def test_curve_tree_init(curve_tree_fixture):
"""
curve_tree, wf = curve_tree_fixture
assert curve_tree.waveform == wf
assert curve_tree.color_palette == "magma"
assert curve_tree.color_palette == "plasma"
assert curve_tree.tree.columnCount() == 7
assert "add" in curve_tree.toolbar.widgets

View File

@ -13,7 +13,7 @@ from tests.unit_tests.conftest import create_widget
def test_initialization_defaults(qtbot, mocked_client):
bec_image_view = create_widget(qtbot, Image, client=mocked_client)
assert bec_image_view.color_map == "magma"
assert bec_image_view.color_map == "plasma"
assert bec_image_view.autorange is True
assert bec_image_view.autorange_mode == "mean"
assert bec_image_view.config.lock_aspect_ratio is True

View File

@ -25,7 +25,7 @@ def test_multiwaveform_initialization(qtbot, mocked_client):
assert len(mw.plot_item.curves) == 0
# Multiwaveform specific
assert mw.monitor is None
assert mw.color_palette == "magma"
assert mw.color_palette == "plasma"
assert mw.max_trace == 200
assert mw.flush_buffer is False
assert mw.highlight_last_curve is True
@ -50,7 +50,7 @@ def test_multiwaveform_set_properties(qtbot, mocked_client):
mw = create_widget(qtbot, MultiWaveform, client=mocked_client)
# Default checks
assert mw.color_palette == "magma"
assert mw.color_palette == "plasma"
assert mw.max_trace == 200
assert mw.flush_buffer is False
assert mw.highlight_last_curve is True
@ -162,7 +162,7 @@ def test_multiwaveform_set_colormap(qtbot, mocked_client):
mw.on_monitor_1d_update(msg_data, metadata={"scan_id": "scan_1"})
# Default color_palette is "magma"
assert mw.color_palette == "magma"
assert mw.color_palette == "plasma"
# Now change to a new colormap
mw.color_palette = "viridis"
assert mw.color_palette == "viridis"

View File

@ -40,7 +40,7 @@ def test_scatter_waveform_plot(qtbot, mocked_client):
def test_scatter_waveform_color_map(qtbot, mocked_client):
swf = create_widget(qtbot, ScatterWaveform, client=mocked_client)
assert swf.color_map == "magma"
assert swf.color_map == "plasma"
swf.color_map = "plasma"
assert swf.color_map == "plasma"

View File

@ -180,8 +180,8 @@ def test_color_palette_update(qtbot, mocked_client):
curve = wf.plot(x=[1, 2, 3], y=[4, 5, 6], label="test_curve")
original_color = curve.config.color
# Change to a different valid palette
wf.color_palette = "plasma"
assert wf.config.color_palette == "plasma"
wf.color_palette = "magma"
assert wf.config.color_palette == "magma"
# After updating the palette, the curve's color should be re-generated.
assert curve.config.color != original_color