Skip to content

Commit a5d0f03

Browse files
authored
Merge pull request #118 from ruaridhg/slice_hist_2D3Dtest
Adding 2D and 3D tests for histogram and slice widgets
2 parents fe24d4f + eced030 commit a5d0f03

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed
Loading
Loading
Loading
Loading

src/napari_matplotlib/tests/test_histogram.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66

77

88
@pytest.mark.mpl_image_compare
9-
def test_example_q_widget(make_napari_viewer, astronaut_data):
9+
def test_histogram_2D(make_napari_viewer, astronaut_data):
1010
# Smoke test adding a histogram widget
1111
viewer = make_napari_viewer()
1212
viewer.add_image(astronaut_data[0], **astronaut_data[1])
1313
fig = HistogramWidget(viewer).figure
1414
# Need to return a copy, as original figure is too eagerley garbage
1515
# collected by the widget
1616
return deepcopy(fig)
17+
18+
19+
@pytest.mark.mpl_image_compare
20+
def test_histogram_3D(make_napari_viewer, brain_data):
21+
# Smoke test adding a histogram widget
22+
viewer = make_napari_viewer()
23+
viewer.add_image(brain_data[0], **brain_data[1])
24+
fig = HistogramWidget(viewer).figure
25+
# Need to return a copy, as original figure is too eagerley garbage
26+
# collected by the widget
27+
return deepcopy(fig)

src/napari_matplotlib/tests/test_slice.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@
66

77

88
@pytest.mark.mpl_image_compare
9-
def test_slice(make_napari_viewer, brain_data):
9+
def test_slice_3D(make_napari_viewer, brain_data):
1010
viewer = make_napari_viewer()
1111
viewer.add_image(brain_data[0], **brain_data[1])
1212
fig = SliceWidget(viewer).figure
1313
# Need to return a copy, as original figure is too eagerley garbage
1414
# collected by the widget
1515
return deepcopy(fig)
16+
17+
18+
@pytest.mark.mpl_image_compare
19+
def test_slice_2D(make_napari_viewer, astronaut_data):
20+
viewer = make_napari_viewer()
21+
viewer.add_image(astronaut_data[0], **astronaut_data[1])
22+
fig = SliceWidget(viewer).figure
23+
# Need to return a copy, as original figure is too eagerley garbage
24+
# collected by the widget
25+
return deepcopy(fig)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy