From d4a350cd79e07578356f99276aaa9b662b4593b7 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 15 May 2017 18:04:33 +0300 Subject: [PATCH] Test chord in RGB and L modes --- Tests/images/imagedraw_chord.png | Bin 326 -> 0 bytes Tests/images/imagedraw_chord_RGB.png | Bin 0 -> 324 bytes Tests/test_imagedraw.py | 17 ++++++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 Tests/images/imagedraw_chord.png create mode 100644 Tests/images/imagedraw_chord_RGB.png diff --git a/Tests/images/imagedraw_chord.png b/Tests/images/imagedraw_chord.png deleted file mode 100644 index db3b35310235b1c7ab6e368d08f3bf89b9836777..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^DImUz33VYkl1=nX|dqBVT;otL=PqD@Cub z;$2<(Q7d|t+$rnTn(Kcp*>>*yf#>4CDh^JY@$Oe#xmVO0!f&cvEFGQ N0Z&&ymvv4FO#l*njdTD2 diff --git a/Tests/images/imagedraw_chord_RGB.png b/Tests/images/imagedraw_chord_RGB.png new file mode 100644 index 0000000000000000000000000000000000000000..af6fc766007870d6dd75c4e0b673415af90459a1 GIT binary patch literal 324 zcmeAS@N?(olHy`uVBq!ia0vp^DImiL4E4Qefit@`FJTWf4%EDt3lk&SPw>2k|{! L{an^LB{Ts5P4tBx literal 0 HcmV?d00001 diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py index 11e990bcb..66a92b01d 100644 --- a/Tests/test_imagedraw.py +++ b/Tests/test_imagedraw.py @@ -94,10 +94,11 @@ class TestImageDraw(PillowTestCase): self.assert_image_equal( im, Image.open("Tests/images/imagedraw_bitmap.png")) - def helper_chord(self, bbox, start, end): + def helper_chord(self, mode, bbox, start, end): # Arrange - im = Image.new("RGB", (W, H)) + im = Image.new(mode, (W, H)) draw = ImageDraw.Draw(im) + expected = "Tests/images/imagedraw_chord_{}.png".format(mode) # Act draw.chord(bbox, start, end, fill="red", outline="yellow") @@ -105,15 +106,17 @@ class TestImageDraw(PillowTestCase): # Assert self.assert_image_similar( - im, Image.open("Tests/images/imagedraw_chord.png"), 1) + im, Image.open(expected), 1) def test_chord1(self): - self.helper_chord(BBOX1, 0, 180) - self.helper_chord(BBOX1, 0.5, 180.4) + for mode in ["RGB", "L"]: + self.helper_chord(mode, BBOX1, 0, 180) + self.helper_chord(mode, BBOX1, 0.5, 180.4) def test_chord2(self): - self.helper_chord(BBOX2, 0, 180) - self.helper_chord(BBOX2, 0.5, 180.4) + for mode in ["RGB", "L"]: + self.helper_chord(mode, BBOX2, 0, 180) + self.helper_chord(mode, BBOX2, 0.5, 180.4) def helper_ellipse(self, bbox): # Arrange