Created
October 15, 2012 06:05
-
-
Save justinrosenthal/3891016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIN_W = 100 | |
MIN_H = 100 | |
MAX_W = 300 | |
MAX_H = 300 | |
def test_50x50(self): | |
resize, crop = self.gen.transforms(50, 50) | |
self.assertIsNone(resize) | |
self.assertIsNone(crop) | |
def test_100x100(self): | |
resize, crop = self.gen.transforms(100, 100) | |
self.assertIsNone(resize) | |
self.assertIsNone(crop) | |
def test_200x200(self): | |
resize, crop = self.gen.transforms(200, 200) | |
self.assertIsNone(resize) | |
self.assertIsNone(crop) | |
def test_300x300(self): | |
resize, crop = self.gen.transforms(300, 300) | |
self.assertIsNone(resize) | |
self.assertIsNone(crop) | |
def test_300x10(self): | |
resize, crop = self.gen.transforms(300, 10) | |
self.assertIsNone(resize) | |
self.assertIsNone(crop) | |
def test_10x300(self): | |
resize, crop = self.gen.transforms(10, 300) | |
self.assertIsNone(resize) | |
self.assertIsNone(crop) | |
def test_1000x1000(self): | |
resize, crop = self.gen.transforms(1000, 1000) | |
self.assertEqual(resize, (MAX_W, MAX_H)) | |
self.assertIsNone(crop) | |
def test_1000x500(self): | |
resize, crop = self.gen.transforms(1000, 500) | |
self.assertEqual(resize, (MAX_W, MAX_H / 2)) | |
self.assertIsNone(crop) | |
def test_500x1000(self): | |
resize, crop = self.gen.transforms(500, 1000) | |
self.assertEqual(resize, (MAX_W / 2, MAX_H)) | |
self.assertIsNone(crop) | |
def test_350x10(self): | |
resize, crop = self.gen.transforms(350, 10) | |
self.assertIsNone(resize) | |
self.assertEqual(crop, ((350 - MAX_W) / 2, 0, MAX_W, 10)) | |
def test_10x350(self): | |
resize, crop = self.gen.transforms(10, 350) | |
self.assertIsNone(resize) | |
self.assertEqual(crop, (0, (350 - MAX_H) / 2, 10, MAX_H)) | |
def test_3000x300(self): | |
resize, crop = self.gen.transforms(3000, 300) | |
self.assertEqual(resize, (MIN_H * 10, MIN_H)) | |
self.assertEqual(crop, (((MIN_H * 10) - MAX_W) / 2, 0, MAX_W, MIN_H)) | |
def test_300x3000(self): | |
resize, crop = self.gen.transforms(300, 3000) | |
self.assertEqual(resize, (MIN_W, MIN_W * 10)) | |
self.assertEqual(crop, (0, ((MIN_W * 10) - MAX_H) / 2, MIN_W, MAX_H)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment