Skip to content

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

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Added 3D test for test_histogram and 2D and 3D test images
  • Loading branch information
ruaridhg committed May 17, 2023
commit e594799cbba821c74aace25e55e80991df5873bf
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)