diff --git a/slicereg/gui/view_models/slice.py b/slicereg/gui/view_models/slice.py index f6b8f08..5523d89 100644 --- a/slicereg/gui/view_models/slice.py +++ b/slicereg/gui/view_models/slice.py @@ -39,7 +39,9 @@ def on_left_mouse_drag(self, x1: int, y1: int, x2: int, y2: int): scaled_dx = (x2 - x1) * scale scaled_dy = (y2 - y1) * scale self._model.move_section(x=scaled_dx, z=scaled_dy) - self._model.select_coord(i=x2, j=y2) + + def on_mouse_move(self, x: int, y: int): + self._model.select_coord(i=x, j=y) def on_right_mouse_drag(self, x1: int, y1: int, x2: int, y2: int): scale = 1. diff --git a/tests/integration_tests/test_image_coords.py b/tests/integration_tests/test_image_coords.py index d7f86e8..0fbb0a5 100644 --- a/tests/integration_tests/test_image_coords.py +++ b/tests/integration_tests/test_image_coords.py @@ -9,13 +9,13 @@ def test_impl(): @given("I have loaded a section") -def step_impl(model: AppModel): - model.load_section("myfile.ome.tiff") +def step_impl(sidebar): + sidebar.submit_load_section_from_file("myfile.ome.tiff") @when("I indicate a section image coordinate") -def step_impl(model: AppModel): - model.select_coord(i=1, j=2) +def step_impl(slice_view): + slice_view.on_mouse_move(x=1, y=2) @then("the coordinate's 2D position and 3D position should appear") diff --git a/tests/integration_tests/test_list_bgatlases.py b/tests/integration_tests/test_list_bgatlases.py index 5dc1916..48aef0b 100644 --- a/tests/integration_tests/test_list_bgatlases.py +++ b/tests/integration_tests/test_list_bgatlases.py @@ -1,7 +1,5 @@ from pytest_bdd import scenario, when, then -from slicereg.gui.app_model import AppModel - @scenario("features/load_atlas.feature", "List Available Brainglobe Atlases") def test_outlined(): @@ -9,10 +7,10 @@ def test_outlined(): @when("I refresh the brainglobe atlas list") -def step_impl(model: AppModel): - model.list_bgatlases() +def step_impl(sidebar): + sidebar.click_update_bgatlas_list_button() @then("I see a list of bg-atlasapi's available atlases.") -def step_impl(model: AppModel, bg_atlases): - assert model.bgatlas_names == bg_atlases +def step_impl(sidebar, bg_atlases): + sidebar.bgatlas_names == bg_atlases diff --git a/tests/integration_tests/test_load_brainglobe_atlas.py b/tests/integration_tests/test_load_brainglobe_atlas.py index 80f564a..524c888 100644 --- a/tests/integration_tests/test_load_brainglobe_atlas.py +++ b/tests/integration_tests/test_load_brainglobe_atlas.py @@ -10,8 +10,9 @@ def test_outlined(): @when("I load the 25um allen mouse atlas") -def load_atlas(model: AppModel): - model.load_bgatlas('allen_mouse_25um') +def load_atlas(sidebar): + sidebar.change_bgatlas_selection_dropdown('allen_mouse_25um') + sidebar.click_load_bgatlas_button() @then("a 3D volume of the 25um allen reference atlas is loaded.") diff --git a/tests/integration_tests/test_load_imio_atlas.py b/tests/integration_tests/test_load_imio_atlas.py index 0e04f29..6364a59 100644 --- a/tests/integration_tests/test_load_imio_atlas.py +++ b/tests/integration_tests/test_load_imio_atlas.py @@ -7,8 +7,9 @@ def test_outlined(): @when("I load the mock.tiff atlas with 10um resolution") -def load_atlas(model): - model.load_atlas_from_file(filename='mock.tiff', resolution_um=10) +def load_atlas(sidebar): + sidebar.update_resolution_textbox(text="10") + sidebar.submit_load_atlas_from_file(filename='mock.tiff') @then("a 3D volume of the atlas appears onscreen") diff --git a/tests/integration_tests/test_load_slice_file.py b/tests/integration_tests/test_load_slice_file.py index ac4d178..fc0a8f4 100644 --- a/tests/integration_tests/test_load_slice_file.py +++ b/tests/integration_tests/test_load_slice_file.py @@ -21,13 +21,15 @@ def no_sections_loaded(model: AppModel): @given("An atlas has been loaded") -def atlas_is_loaded(model: AppModel): +def atlas_is_loaded(sidebar, model): + sidebar.change_bgatlas_selection_dropdown("allen_mouse_25um") + sidebar.click_load_bgatlas_button() assert model.atlas_volume is not None @when("I load the file") -def load_file(model: AppModel, filename: str): - model.load_section(filename=filename) +def load_file(sidebar, filename: str): + sidebar.submit_load_section_from_file(filename=filename) @then("I should see the slice image onscreen in 3D")