Skip to content

Commit 31313c6

Browse files
committed
TST : minimal tests of legend.facecolor and legend.edegcolor
1 parent 3a82088 commit 31313c6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/matplotlib/tests/test_rcparams.py

+20
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import warnings
1010

1111
import matplotlib as mpl
12+
import matplotlib.pyplot as plt
1213
from matplotlib.tests import assert_str_equal
1314
from matplotlib.testing.decorators import cleanup, knownfailureif
1415
from nose.tools import assert_true, assert_raises, assert_equal
@@ -180,6 +181,25 @@ def test_Bug_2543_newer_python():
180181
with mpl.rc_context():
181182
mpl.rcParams['svg.fonttype'] = True
182183

184+
185+
@cleanup
186+
def test_legend_facecolor():
187+
with mpl.rc_context({'legend.facecolor': 'r'}):
188+
_, ax = plt.subplots()
189+
ax.plot(range(3), label='test')
190+
leg = ax.legend()
191+
assert_equal(leg.legendPatch.get_facecolor(), (1, 0, 0, 1))
192+
193+
194+
@cleanup
195+
def test_legend_edgecolor():
196+
with mpl.rc_context({'legend.edgecolor': 'r'}):
197+
_, ax = plt.subplots()
198+
ax.plot(range(3), label='test')
199+
leg = ax.legend()
200+
assert_equal(leg.legendPatch.get_edgecolor(), (1, 0, 0, 1))
201+
202+
183203
def test_Issue_1713():
184204
utf32_be = os.path.join(os.path.dirname(__file__),
185205
'test_utf32_be_rcparams.rc')

0 commit comments

Comments
 (0)