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

fix(image_roi): position can be set from rpc

This commit is contained in:
2025-05-21 17:56:54 +02:00
committed by Jan Wyzula
parent 7a531c17d6
commit 41b7ca8e64
3 changed files with 58 additions and 0 deletions

View File

@ -188,3 +188,20 @@ def test_roi_controller_get_roi_methods(qtbot, mocked_client):
assert controller.get_roi(1) == r2
assert controller.get_roi(99) is None
assert controller.get_roi_by_name("notfound") is None
def test_roi_set_position(bec_image_widget_with_roi):
"""Test that set_position updates the ROI position and coordinates."""
widget, roi, _ = bec_image_widget_with_roi
# Save original coordinates
orig_coords = roi.get_coordinates(typed=False)
# Move ROI by a known offset
roi.set_position(10, 15)
new_coords = roi.get_coordinates(typed=False)
# The new position should reflect the set_position call
assert new_coords != orig_coords
# The first coordinate should match the new position
if hasattr(roi, "pos"):
pos = roi.pos()
assert int(pos.x()) == 10
assert int(pos.y()) == 15