Skip to content

Adding 2D and 3D tests for histogram and slice widgets #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion src/napari_matplotlib/tests/test_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@


@pytest.mark.mpl_image_compare
def test_example_q_widget(make_napari_viewer, astronaut_data):
def test_histogram_2D(make_napari_viewer, astronaut_data):
# Smoke test adding a histogram widget
viewer = make_napari_viewer()
viewer.add_image(astronaut_data[0], **astronaut_data[1])
fig = HistogramWidget(viewer).figure
# Need to return a copy, as original figure is too eagerley garbage
# collected by the widget
return deepcopy(fig)


@pytest.mark.mpl_image_compare
def test_histogram_3D(make_napari_viewer, brain_data):
# Smoke test adding a histogram widget
viewer = make_napari_viewer()
viewer.add_image(brain_data[0], **brain_data[1])
fig = HistogramWidget(viewer).figure
# Need to return a copy, as original figure is too eagerley garbage
# collected by the widget
return deepcopy(fig)
12 changes: 11 additions & 1 deletion src/napari_matplotlib/tests/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@


@pytest.mark.mpl_image_compare
def test_slice(make_napari_viewer, brain_data):
def test_slice_3D(make_napari_viewer, brain_data):
viewer = make_napari_viewer()
viewer.add_image(brain_data[0], **brain_data[1])
fig = SliceWidget(viewer).figure
# Need to return a copy, as original figure is too eagerley garbage
# collected by the widget
return deepcopy(fig)


@pytest.mark.mpl_image_compare
def test_slice_2D(make_napari_viewer, astronaut_data):
viewer = make_napari_viewer()
viewer.add_image(astronaut_data[0], **astronaut_data[1])
fig = SliceWidget(viewer).figure
# Need to return a copy, as original figure is too eagerley garbage
# collected by the widget
return deepcopy(fig)