From b7f14415d82f1f077b928ea60799cc3f7aa2f574 Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 23 Jun 2014 22:51:31 +0300 Subject: [PATCH] Constants are now ALL CAPS --- Tests/test_imagedraw.py | 80 ++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py index ccd78e4e2..996c45e79 100644 --- a/Tests/test_imagedraw.py +++ b/Tests/test_imagedraw.py @@ -7,21 +7,21 @@ from PIL import ImageDraw import sys # Image size -w, h = 100, 100 +W, H = 100, 100 # Bounding box points -x0 = int(w / 4) -x1 = int(x0 * 3) -y0 = int(h / 4) -y1 = int(x0 * 3) +X0 = int(W / 4) +X1 = int(X0 * 3) +Y0 = int(H / 4) +Y1 = int(X0 * 3) # Two kinds of bounding box -bbox1 = [(x0, y0), (x1, y1)] -bbox2 = [x0, y0, x1, y1] +BBOX1 = [(X0, Y0), (X1, Y1)] +BBOX2 = [X0, Y0, X1, Y1] # Two kinds of coordinate sequences -points1 = [(10, 10), (20, 40), (30, 30)] -points2 = [10, 10, 20, 40, 30, 30] +POINTS1 = [(10, 10), (20, 40), (30, 30)] +POINTS2 = [10, 10, 20, 40, 30, 30] class TestImageDraw(PillowTestCase): @@ -47,7 +47,7 @@ class TestImageDraw(PillowTestCase): def helper_arc(self, bbox): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -60,15 +60,15 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_arc.png")) def test_arc1(self): - self.helper_arc(bbox1) + self.helper_arc(BBOX1) def test_arc2(self): - self.helper_arc(bbox2) + self.helper_arc(BBOX2) def test_bitmap(self): # Arrange small = Image.open("Tests/images/pil123rgba.png").resize((50, 50)) - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -81,7 +81,7 @@ class TestImageDraw(PillowTestCase): def helper_chord(self, bbox): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -93,14 +93,14 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_chord.png")) def test_chord1(self): - self.helper_chord(bbox1) + self.helper_chord(BBOX1) def test_chord2(self): - self.helper_chord(bbox2) + self.helper_chord(BBOX2) def helper_ellipse(self, bbox): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -112,14 +112,14 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_ellipse.png")) def test_ellipse1(self): - self.helper_ellipse(bbox1) + self.helper_ellipse(BBOX1) def test_ellipse2(self): - self.helper_ellipse(bbox2) + self.helper_ellipse(BBOX2) def helper_line(self, points): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -131,14 +131,14 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_line.png")) def test_line1(self): - self.helper_line(points1) + self.helper_line(POINTS1) def test_line2(self): - self.helper_line(points2) + self.helper_line(POINTS2) def helper_pieslice(self, bbox): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -150,14 +150,14 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_pieslice.png")) def test_pieslice1(self): - self.helper_pieslice(bbox1) + self.helper_pieslice(BBOX1) def test_pieslice2(self): - self.helper_pieslice(bbox2) + self.helper_pieslice(BBOX2) def helper_point(self, points): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -169,14 +169,14 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_point.png")) def test_point1(self): - self.helper_point(points1) + self.helper_point(POINTS1) def test_point2(self): - self.helper_point(points2) + self.helper_point(POINTS2) def helper_polygon(self, points): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -188,14 +188,14 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_polygon.png")) def test_polygon1(self): - self.helper_polygon(points1) + self.helper_polygon(POINTS1) def test_polygon2(self): - self.helper_polygon(points2) + self.helper_polygon(POINTS2) def helper_rectangle(self, bbox): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) # Act @@ -207,17 +207,17 @@ class TestImageDraw(PillowTestCase): im, Image.open("Tests/images/imagedraw_rectangle.png")) def test_rectangle1(self): - self.helper_rectangle(bbox1) + self.helper_rectangle(BBOX1) def test_rectangle2(self): - self.helper_rectangle(bbox2) + self.helper_rectangle(BBOX2) def test_floodfill(self): # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) - draw.rectangle(bbox2, outline="yellow", fill="green") - centre_point = (int(w/2), int(h/2)) + draw.rectangle(BBOX2, outline="yellow", fill="green") + centre_point = (int(W/2), int(H/2)) # Act ImageDraw.floodfill(im, centre_point, ImageColor.getrgb("red")) @@ -233,10 +233,10 @@ class TestImageDraw(PillowTestCase): # floodfill() is experimental # Arrange - im = Image.new("RGB", (w, h)) + im = Image.new("RGB", (W, H)) draw = ImageDraw.Draw(im) - draw.rectangle(bbox2, outline="yellow", fill="green") - centre_point = (int(w/2), int(h/2)) + draw.rectangle(BBOX2, outline="yellow", fill="green") + centre_point = (int(W/2), int(H/2)) # Act ImageDraw.floodfill(