Added tests for set/get focal point methods

pull/752/head
Karl Hobley 2014-10-26 14:18:34 +00:00 zatwierdzone przez Karl Hobley
rodzic 404615e1df
commit 4afdbaadca
1 zmienionych plików z 43 dodań i 0 usunięć

Wyświetl plik

@ -35,6 +35,49 @@ class TestImage(TestCase):
def test_get_rect(self):
self.assertTrue(self.image.get_rect(), Rect(0, 0, 640, 480))
def test_get_focal_point(self):
self.assertEqual(self.image.get_focal_point(), None)
# Add a focal point to the image
self.image.focal_point_x = 100
self.image.focal_point_y = 200
self.image.focal_point_width = 50
self.image.focal_point_height = 20
# Get it
self.assertEqual(self.image.get_focal_point(), Rect(75, 190, 125, 210))
def test_has_focal_point(self):
self.assertFalse(self.image.has_focal_point())
# Add a focal point to the image
self.image.focal_point_x = 100
self.image.focal_point_y = 200
self.image.focal_point_width = 50
self.image.focal_point_height = 20
self.assertTrue(self.image.has_focal_point())
def test_set_focal_point(self):
self.assertEqual(self.image.focal_point_x, None)
self.assertEqual(self.image.focal_point_y, None)
self.assertEqual(self.image.focal_point_width, None)
self.assertEqual(self.image.focal_point_height, None)
self.image.set_focal_point(Rect(100, 150, 200, 350))
self.assertEqual(self.image.focal_point_x, 150)
self.assertEqual(self.image.focal_point_y, 250)
self.assertEqual(self.image.focal_point_width, 100)
self.assertEqual(self.image.focal_point_height, 200)
self.image.set_focal_point(None)
self.assertEqual(self.image.focal_point_x, None)
self.assertEqual(self.image.focal_point_y, None)
self.assertEqual(self.image.focal_point_width, None)
self.assertEqual(self.image.focal_point_height, None)
class TestImagePermissions(TestCase):
def setUp(self):