Skip to content

Commit

Permalink
TST: added viz test for channel specific annotations
Browse files Browse the repository at this point in the history
I could not figure out how to find the y coordinates of the
FillBetweenItems. So this only tests that the FillBetweenItems, i.e. the shaded rectangles around each channel in annotation["ch_names"], match the number of channel names in the annot["ch_names"] key
  • Loading branch information
scott-huberty committed Sep 27, 2023
1 parent 5d425f3 commit 2a7b249
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mne_qt_browser/tests/test_pg_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,24 @@ def test_annotations_interactions(raw_orig, pg_backend):
fig.msg_box.close()


def test_ch_specific_annot(raw_orig):
"""Test plotting channel specific annotations."""
from mne import Annotations
from pyqtgraph.graphicsItems.FillBetweenItem import FillBetweenItem

ch_names = ["MEG 0133", "MEG 0142", "MEG 0143", "MEG 0423"]
annots = Annotations([1], [2], "some_chs", ch_names=[ch_names])
raw_orig.set_annotations(annots)
fig = raw_orig.plot()
fig.test_mode = True
# one item for each channel in a channel specific annot
rects = [item for item in fig.mne.plt.items if isinstance(item, FillBetweenItem)]
assert len(rects) == 4
fig.close()




def test_pg_settings_dialog(raw_orig, pg_backend):
"""Test Settings Dialog toggle on/off for pyqtgraph-backend."""
fig = raw_orig.plot()
Expand Down

0 comments on commit 2a7b249

Please sign in to comment.