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

Skip to content

Commit 6edf6bc

Browse files
committed
test_compare_images: Added two new test cases, testing a whole-image and sub-image 1-pixel offset.
1 parent 62a548d commit 6edf6bc

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

223 KB
Loading
223 KB
Loading

lib/matplotlib/tests/test_compare_images.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ def test_image_compare_basic():
4646
# Now test with no tolerance.
4747
image_comparison_expect_rms(im1, im2, tol=0, expect_rms=2.99949)
4848

49+
def test_image_compare_1px_offset():
50+
"""Test comparison with an image that is shifted by 1px in the X axis."""
51+
im1 = 'cosine_peak-nn-img.png'
52+
im2 = 'cosine_peak-nn-img-1px-offset.png'
53+
image_comparison_expect_rms(im1, im2, tol=0, expect_rms=22.04263)
54+
55+
def test_image_compare_title_1px_offset():
56+
"""Test comparison with an image with the title shifted by 1px in the X
57+
axis."""
58+
im1 = 'cosine_peak-nn-img.png'
59+
im2 = 'cosine_peak-nn-img-title-1px-offset.png'
60+
image_comparison_expect_rms(im1, im2, tol=0, expect_rms=13.77513)
61+
4962
def test_image_compare_scrambled():
5063
"""Test comparison of an image and the same image scrambled."""
5164
# This expects the images to compare completely different, with a very large

0 commit comments

Comments
 (0)