From 5fda1a803aa0337dd42760c7dd45a37de7c768c9 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sat, 31 Dec 2016 19:30:26 +0000 Subject: [PATCH] Added resample target test --- Tests/test_image_rotate.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/test_image_rotate.py b/Tests/test_image_rotate.py index 865544350..5bf2e15ee 100644 --- a/Tests/test_image_rotate.py +++ b/Tests/test_image_rotate.py @@ -32,6 +32,19 @@ class TestImageRotate(PillowTestCase): im = Image.new('RGB',(0,0)) self.rotate(im, im.mode, angle) + def test_resample(self): + # >>> im = Image.open('Tests/images/hopper.ppm') + # >>> im = im.rotate(45, resample=Image.BICUBIC, expand=True) + # >>> im.save('Tests/images/hopper_45.png') + + target = Image.open('Tests/images/hopper_45.png') + for (resample, epsilon) in ((Image.NEAREST, 10), + (Image.BILINEAR, 5), + (Image.BICUBIC, 0)): + im = hopper() + im = im.rotate(45, resample=resample, expand=True) + self.assert_image_similar(im, target, epsilon) + def test_center(self): im = hopper() self.rotate(im, im.mode, 45, center=(0, 0))