Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 747a780

Browse files
committed
Added a test for BboxImage with inverted corners.
1 parent 9a7991d commit 747a780

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

Binary file not shown.
19.2 KB
Loading

lib/matplotlib/tests/test_image.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import numpy as np
77

88
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
9+
from matplotlib.image import BboxImage, imread
10+
from matplotlib.transforms import Bbox
911
from matplotlib import rcParams
1012
import matplotlib.pyplot as plt
1113
from nose.tools import assert_raises
@@ -315,6 +317,24 @@ def test_rasterize_dpi():
315317
rcParams['savefig.dpi'] = 10
316318

317319

320+
@image_comparison(baseline_images=['bbox_image_inverted'],
321+
extensions=['png', 'pdf'])
322+
def test_bbox_image_inverted():
323+
# This is just used to produce an image to feed to BboxImage
324+
fig = plt.figure()
325+
axes = fig.add_subplot(111)
326+
axes.plot([1, 2, 3])
327+
328+
im_buffer = io.BytesIO()
329+
fig.savefig(im_buffer)
330+
im_buffer.seek(0)
331+
image = imread(im_buffer)
332+
333+
bbox_im = BboxImage(Bbox([[100, 100], [0, 0]]))
334+
bbox_im.set_data(image)
335+
axes.add_artist(bbox_im)
336+
337+
318338
if __name__=='__main__':
319339
import nose
320340
nose.runmodule(argv=['-s','--with-doctest'], exit=False)

0 commit comments

Comments
 (0)