Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ testing =
napari[pyqt5]
pytest
pytest-cov
pytest-mpl
pytest-qt
tox
pytest-xvfb;sys_platform == 'linux'
Expand Down
1 change: 1 addition & 0 deletions src/napari_matplotlib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):

self.viewer = napari_viewer
self.canvas = FigureCanvas()
self.canvas.widget = self

self.canvas.figure.patch.set_facecolor("none")
self.canvas.figure.set_layout_engine("constrained")
Expand Down
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/napari_matplotlib/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pytest
from skimage import data


@pytest.fixture(
Expand All @@ -11,3 +12,8 @@
)
def image_data(request):
return np.ones(request.param[0]), request.param[1]


@pytest.fixture
def astronaut_data():
return data.astronaut(), {"rgb": True}
10 changes: 7 additions & 3 deletions src/napari_matplotlib/tests/test_histogram.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import pytest

from napari_matplotlib import HistogramWidget


def test_example_q_widget(make_napari_viewer, image_data):
@pytest.mark.mpl_image_compare
def test_example_q_widget(make_napari_viewer, astronaut_data):
# Smoke test adding a histogram widget
viewer = make_napari_viewer()
viewer.add_image(image_data[0], **image_data[1])
HistogramWidget(viewer)
viewer.add_image(astronaut_data[0], **astronaut_data[1])
fig = HistogramWidget(viewer).figure
return fig
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ python =

[testenv]
extras = testing
commands = python -m pytest -v --color=yes --cov=napari_matplotlib --cov-report=xml
commands = python -m pytest --mpl -v --color=yes --cov=napari_matplotlib --cov-report=xml