def test_static_Bitmap_resize_with_save(static_png) -> None: """Testing Bitmap ``resize`` method with ``save`` flag for static png.""" new_size = (10, 10) bmp = Bitmap(static_png, (10, 10)) assert bmp.x_hot == 10 assert bmp.y_hot == 10 is_return = bmp.resize(size=new_size, save=True) assert is_return is None assert bmp.x_hot == 5 assert bmp.y_hot == 5 with Image.open(static_png) as i: assert i.size == new_size
def test_animated_Bitmap_resize_with_save(animated_png) -> None: """Testing Bitmap ``resize`` method with ``save`` flag for animated png.""" new_size = (10, 10) bmp = Bitmap(animated_png, (10, 10)) assert bmp.x_hot == 10 assert bmp.y_hot == 10 is_return = bmp.resize(size=new_size, save=True) assert is_return is None assert bmp.x_hot == 5 assert bmp.y_hot == 5 for frame in animated_png: with Image.open(frame) as i: assert i.size == new_size
def test_animated_Bitmap_resize_without_save(animated_png) -> None: """Testing Bitmap ``resize`` method without ``save`` flag for animated png.""" new_size = (10, 10) bmp = Bitmap(animated_png, (10, 10)) assert bmp.x_hot == 10 assert bmp.y_hot == 10 return_images = bmp.resize(size=new_size, save=False) assert return_images is not None assert isinstance(return_images, list) assert bmp.x_hot == 10 assert bmp.y_hot == 10 for image in return_images: assert image.size == new_size
def test_static_Bitmap_resize_without_save(static_png) -> None: """Testing Bitmap ``resize`` method without ``save`` flag for static png.""" new_size = (10, 10) bmp = Bitmap(static_png, (10, 10)) assert bmp.x_hot == 10 assert bmp.y_hot == 10 return_image = bmp.resize(size=new_size, save=False) assert return_image is not None assert bmp.x_hot == 10 assert bmp.y_hot == 10 assert isinstance(return_image, Image.Image) assert return_image.size == new_size