Skip to content

Commit

Permalink
adapt tests to view refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Dec 19, 2023
1 parent 1df0ce1 commit 4aedb5e
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tests/test_integration/test_brainrender_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ def test_double_click_on_locally_available_atlas_row(
brainrender_widget, mocker, qtbot, expected_atlas_name
):
"""Check for a few local low-res atlases that double-clicking them
on the atlas table view calls the expected atlas representation function.
on the atlas viewer view calls the expected atlas representation function.
"""
add_atlas_to_viewer_mock = mocker.patch(
"brainrender_napari.brainrender_widget"
".NapariAtlasRepresentation.add_to_viewer"
)
with qtbot.waitSignal(
brainrender_widget.atlas_table_view.add_atlas_requested
brainrender_widget.atlas_viewer_view.add_atlas_requested
):
brainrender_widget.atlas_table_view.add_atlas_requested.emit(
brainrender_widget.atlas_viewer_view.add_atlas_requested.emit(
expected_atlas_name
)
add_atlas_to_viewer_mock.assert_called_once()
Expand All @@ -70,7 +70,7 @@ def test_structure_row_double_clicked(brainrender_widget, mocker):
"brainrender_napari.brainrender_widget"
".NapariAtlasRepresentation.add_structure_to_viewer"
)
brainrender_widget.atlas_table_view.selectRow(
brainrender_widget.atlas_viewer_view.selectRow(
4
) # allen_mouse_100um is in row 4

Expand All @@ -79,22 +79,22 @@ def test_structure_row_double_clicked(brainrender_widget, mocker):


def test_add_additional_reference_selected(brainrender_widget, mocker):
"""Checks that when the atlas table view requests an additional
"""Checks that when the atlas viewer view requests an additional
reference, the NapariAtlasRepresentation function is called in
the expected way."""
add_additional_reference_mock = mocker.patch(
"brainrender_napari.brainrender_widget"
".NapariAtlasRepresentation.add_additional_reference"
)
brainrender_widget.atlas_table_view.selectRow(
brainrender_widget.atlas_viewer_view.selectRow(
5
) # mpin_zfish_1um is in row 5
assert (
brainrender_widget.atlas_table_view.selected_atlas_name()
brainrender_widget.atlas_viewer_view.selected_atlas_name()
== "mpin_zfish_1um"
)
additional_reference_name = "GAD1b"
brainrender_widget.atlas_table_view.additional_reference_requested.emit(
brainrender_widget.atlas_viewer_view.additional_reference_requested.emit(
additional_reference_name
)
add_additional_reference_mock.assert_called_once_with(
Expand All @@ -106,7 +106,7 @@ def test_show_structures_checkbox(brainrender_widget, mocker):
structure_view_refresh_mock = mocker.patch(
"brainrender_napari.brainrender_widget.StructureView.refresh"
)
brainrender_widget.atlas_table_view.selectRow(
brainrender_widget.atlas_viewer_view.selectRow(
0
) # example_mouse_100um is in row 0
structure_view_refresh_mock.assert_called_with(
Expand Down Expand Up @@ -135,10 +135,9 @@ def test_structure_view_tooltip(brainrender_widget):
)


def test_atlas_table_view_tooltip(brainrender_widget):
def test_atlas_viewer_view_tooltip(brainrender_widget):
for expected_keyword in [
"double-click",
"download",
"add",
"annotations",
"reference",
Expand All @@ -147,5 +146,5 @@ def test_atlas_table_view_tooltip(brainrender_widget):
]:
assert (
expected_keyword
in brainrender_widget.atlas_table_group.toolTip().lower()
in brainrender_widget.atlas_viewer_group.toolTip().lower()
)

0 comments on commit 4aedb5e

Please sign in to comment.