2014-09-05 14:03:56 +04:00
|
|
|
from helper import unittest, PillowTestCase, hopper
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestImageOffset(PillowTestCase):
|
2013-07-01 02:42:19 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_offset(self):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-09-05 14:03:56 +04:00
|
|
|
im1 = hopper()
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im2 = self.assert_warning(DeprecationWarning, lambda: im1.offset(10))
|
|
|
|
self.assertEqual(im1.getpixel((0, 0)), im2.getpixel((10, 10)))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im2 = self.assert_warning(
|
|
|
|
DeprecationWarning, lambda: im1.offset(10, 20))
|
|
|
|
self.assertEqual(im1.getpixel((0, 0)), im2.getpixel((10, 20)))
|
|
|
|
|
|
|
|
im2 = self.assert_warning(
|
|
|
|
DeprecationWarning, lambda: im1.offset(20, 20))
|
|
|
|
self.assertEqual(im1.getpixel((0, 0)), im2.getpixel((20, 20)))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|
|
|
|
|
|
|
|
# End of file
|