mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-03-08 09:47:48 +01:00
fix(busy-loader): adjust busy loader and tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
from qtpy.QtWidgets import QLabel, QVBoxLayout, QWidget
|
||||
|
||||
@@ -68,6 +69,24 @@ def test_becwidget_set_busy_toggle_and_text(qtbot, widget_idle):
|
||||
qtbot.waitUntil(lambda: overlay.isHidden())
|
||||
|
||||
|
||||
def test_becwidget_busy_overlay_set_opacity(qtbot, widget_busy):
|
||||
overlay = getattr(widget_busy, "_busy_overlay")
|
||||
qtbot.waitUntil(lambda: overlay.isVisible())
|
||||
|
||||
# Default opacity is 0.7
|
||||
frame = getattr(overlay, "_frame", None)
|
||||
assert frame is not None
|
||||
sheet = frame.styleSheet()
|
||||
_, _, _, a = overlay.scrim_color.getRgb()
|
||||
assert np.isclose(a / 255, 0.35, atol=0.02)
|
||||
|
||||
# Change opacity
|
||||
overlay.set_opacity(0.7)
|
||||
qtbot.waitUntil(lambda: overlay.isVisible())
|
||||
_, _, _, a = overlay.scrim_color.getRgb()
|
||||
assert np.isclose(a / 255, 0.7, atol=0.02)
|
||||
|
||||
|
||||
def test_becwidget_overlay_tracks_resize(qtbot, widget_busy):
|
||||
overlay = getattr(widget_busy, "_busy_overlay")
|
||||
qtbot.waitUntil(lambda: overlay.geometry() == widget_busy.rect())
|
||||
|
||||
@@ -23,6 +23,7 @@ from bec_widgets.applications.views.device_manager_view.device_manager_dialogs.u
|
||||
ValidationSection,
|
||||
)
|
||||
from bec_widgets.applications.views.device_manager_view.device_manager_display_widget import (
|
||||
CustomBusyWidget,
|
||||
DeviceManagerDisplayWidget,
|
||||
)
|
||||
from bec_widgets.applications.views.device_manager_view.device_manager_view import (
|
||||
@@ -592,6 +593,14 @@ class TestDeviceManagerView:
|
||||
qtbot.waitExposed(widget)
|
||||
yield widget
|
||||
|
||||
@pytest.fixture
|
||||
def custom_busy(self, qtbot, mocked_client):
|
||||
"""Fixture for the custom busy widget of the DeviceManagerDisplayWidget."""
|
||||
widget = CustomBusyWidget(client=mocked_client)
|
||||
qtbot.addWidget(widget)
|
||||
qtbot.waitExposed(widget)
|
||||
yield widget
|
||||
|
||||
@pytest.fixture
|
||||
def device_configs(self, device_config: dict):
|
||||
"""Fixture for multiple device configurations."""
|
||||
|
||||
Reference in New Issue
Block a user