Skip to content

Commit 5aaf043

Browse files
committed
FIX: Dont reuse by default
1 parent 2cf1d73 commit 5aaf043

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

surfer/tests/test_viz.py

+13
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ def test_image(tmpdir):
9090
brain.close()
9191

9292

93+
@requires_fsaverage()
94+
def test_brain_separate():
95+
"""Test that Brain does not reuse existing figures by default."""
96+
_set_backend('auto')
97+
brain = Brain(*std_args)
98+
assert brain.brain_matrix.size == 1
99+
brain_2 = Brain(*std_args)
100+
assert brain_2.brain_matrix.size == 1
101+
assert brain._figures[0][0] is not brain_2._figures[0][0]
102+
brain_3 = Brain(*std_args, figure=brain._figures[0][0])
103+
assert brain._figures[0][0] is brain_3._figures[0][0]
104+
105+
93106
@requires_fsaverage()
94107
def test_brains():
95108
"""Test plotting of Brain with different arguments."""

surfer/viz.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def _make_viewer(figure, n_row, n_col, title, scene_size, offscreen,
217217
# Triage: don't make TraitsUI if we don't have to
218218
if n_row == 1 and n_col == 1:
219219
with warnings.catch_warnings(record=True): # traits
220-
figure = mlab.figure(title, size=(w, h))
221-
mlab.clf(figure)
220+
figure = mlab.figure(size=(w, h))
221+
figure.name = title # should set the figure title
222222
figures = [[figure]]
223223
_v = None
224224
else:

0 commit comments

Comments
 (0)