def test_integration_fit_upscale_one_side_smaller(self): """ INTEGRATION: Fit, upscale, one side smaller """ img = self.files['vertical'] # 248x768 filename = img['file'] target_size = '300x500' mode = Resizer.RESIZE_TO_FIT upscale = True self.prepare_uploads() src = os.path.join(self.upload_path, filename) result = Resizer.auto_crop_img(src, target_size, mode, upscale) self.assertEquals(161, result.size[0]) self.assertEquals(500, result.size[1])
def test_integration_fill_upscale_original_bigger(self): """ Fill, upscale, original bigger """ img = self.files['vertical'] # 248x768 filename = img['file'] target_size = '200x300' mode = Resizer.RESIZE_TO_FILL upscale = True self.prepare_uploads() src = os.path.join(self.upload_path, filename) result = Resizer.auto_crop_img(src, target_size, mode, upscale) self.assertEquals(200, result.size[0]) self.assertEquals(300, result.size[1])
def test_integration_fit_no_upscale_bigger_original(self): """ INTEGRATION: Fit, no upscale, original bigger""" img = self.files['vertical'] # 248x768 filename = img['file'] target_size = '200x300' mode = Resizer.RESIZE_TO_FIT upscale = False self.prepare_uploads() src = os.path.join(self.upload_path, filename) result = Resizer.auto_crop_img(src, target_size, mode, upscale) self.assertEquals(96, result.size[0]) self.assertEquals(300, result.size[1])
def test_integration_fill_no_upscale_one_side_smaller(self): """ Fill, no upscale, one side smaller """ img = self.files['vertical'] # 248x768 filename = img['file'] target_size = '150x900' mode = Resizer.RESIZE_TO_FILL upscale = False self.prepare_uploads() src = os.path.join(self.upload_path, filename) result = Resizer.auto_crop_img(src, target_size, mode, upscale) self.assertEquals(150, result.size[0]) self.assertEquals(768, result.size[1])