mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-11-24 10:08:06 +01:00
refactor(round_frame): replace RoundedFrame with theme-styled QFrame
This commit is contained in:
1 parent
e5e1bb1386
commit
4afaf20e34
8 files changed
+37
-199
No files matched your search
@@ -292,6 +292,14 @@ def test_main_label_point_size_uniform(bec_launch_window):
|
||||
assert len(point_sizes) == 1, f"Non-uniform main-label point sizes: {point_sizes}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("theme", ["light", "dark"])
|
||||
def test_launch_window_theme_update(bec_launch_window, theme):
|
||||
"""A theme change on the launcher must not log a slot error."""
|
||||
with mock.patch("bec_widgets.utils.error_popups.logger") as error_logger:
|
||||
bec_launch_window._update_theme(theme)
|
||||
error_logger.error.assert_not_called()
|
||||
|
||||
|
||||
def test_launch_window_cleanup_deregisters_registry_callback(bec_launch_window):
|
||||
"""The turn-off-the-lights callback must not survive the launcher's cleanup:
|
||||
a later registry broadcast would call into a dying window (shutdown scenario)."""
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import pyqtgraph as pg
|
||||
import pytest
|
||||
|
||||
from bec_widgets.utils.round_frame import RoundedFrame
|
||||
|
||||
|
||||
def cleanup_pyqtgraph(plot_widget):
|
||||
item = plot_widget.getPlotItem()
|
||||
item.vb.menu.close()
|
||||
item.vb.menu.deleteLater()
|
||||
item.ctrlMenu.close()
|
||||
item.ctrlMenu.deleteLater()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def basic_rounded_frame(qtbot):
|
||||
frame = RoundedFrame()
|
||||
qtbot.addWidget(frame)
|
||||
qtbot.waitExposed(frame)
|
||||
yield frame
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def plot_rounded_frame(qtbot):
|
||||
plot_widget = pg.PlotWidget()
|
||||
plot_widget.plot([0, 1, 2], [2, 1, 0])
|
||||
frame = RoundedFrame(content_widget=plot_widget)
|
||||
qtbot.addWidget(frame)
|
||||
qtbot.waitExposed(frame)
|
||||
yield frame
|
||||
cleanup_pyqtgraph(plot_widget)
|
||||
|
||||
|
||||
def test_basic_rounded_frame_initialization(basic_rounded_frame):
|
||||
assert basic_rounded_frame.radius == 10
|
||||
assert basic_rounded_frame.content_widget is None
|
||||
assert basic_rounded_frame.background_color is None
|
||||
|
||||
|
||||
def test_set_radius(basic_rounded_frame):
|
||||
basic_rounded_frame.radius = 20
|
||||
assert basic_rounded_frame.radius == 20
|
||||
|
||||
|
||||
def test_apply_plot_widget_style(plot_rounded_frame):
|
||||
# Verify that a PlotWidget can have its style applied
|
||||
plot_rounded_frame.apply_plot_widget_style(border="1px solid red")
|
||||
|
||||
# Ensure style application did not break anything
|
||||
assert plot_rounded_frame.content_widget is not None
|
||||
assert isinstance(plot_rounded_frame.content_widget, pg.PlotWidget)
|
||||
Reference in new issue
Block a user