Exemplo n.º 1
0
 def test_diffed_imgs_unequal_bounds(self):
     """Do not detect changes outside comparison bounds."""
     for img in imgs.get_imgs():
         diff_img = img.crop(box=(0, 0, 50, 50))
         diff_color = imgs.sub_from_color(img.color, 20)
         img.putpixel(xy=(60, 60), value=diff_color)
         differences = list(analyse.diffed_imgs(img, diff_img))
         self.assertEqual(0, len(differences))
Exemplo n.º 2
0
 def test_diffed_imgs_unequal_bounds(self):
     """Do not detect changes outside comparison bounds."""
     for img in imgs.get_imgs():
         diff_img = img.crop(box=(0, 0, 50, 50))
         diff_color = imgs.sub_from_color(img.color, 20)
         img.putpixel(xy=(60, 60), value=diff_color)
         differences = list(analyse.diffed_imgs(img, diff_img))
         self.assertEqual(0, len(differences))
Exemplo n.º 3
0
 def test_diffed_imgs(self):
     """Introduce one difference and check if it gets detected."""
     DIFF_POS = (50, 50)
     for img in imgs.get_imgs():
         diff_color = imgs.sub_from_color(img.color, 20)
         diff_img = img.copy()
         diff_img.putpixel(DIFF_POS, diff_color)
         differences = list(analyse.diffed_imgs(img, diff_img))
         self.assertEqual(1, len(differences))
         pos, img_pixel, diff_img_pixel = differences[0]
         self.assertEqual(DIFF_POS, pos)
         self.assertEqual(diff_color, diff_img_pixel)
         self.assertEqual(img.color, img_pixel)
Exemplo n.º 4
0
 def test_diffed_imgs(self):
     """Introduce one difference and check if it gets detected."""
     DIFF_POS = (50, 50)
     for img in imgs.get_imgs():
         diff_color = imgs.sub_from_color(img.color, 20)
         diff_img = img.copy()
         diff_img.putpixel(DIFF_POS, diff_color)
         differences = list(analyse.diffed_imgs(img, diff_img))
         self.assertEqual(1, len(differences))
         pos, img_pixel, diff_img_pixel = differences[0]
         self.assertEqual(DIFF_POS, pos)
         self.assertEqual(diff_color, diff_img_pixel)
         self.assertEqual(img.color, img_pixel)
Exemplo n.º 5
0
 def test_diffed_imgs_equal_imgs(self):
     """Don't yield a difference on two equal images."""
     for img in imgs.get_imgs():
         differences = list(analyse.diffed_imgs(img, img.copy()))
         self.assertEqual(0, len(differences))
Exemplo n.º 6
0
 def test_diffed_imgs_equal_imgs(self):
     """Don't yield a difference on two equal images."""
     for img in imgs.get_imgs():
         differences = list(analyse.diffed_imgs(img, img.copy()))
         self.assertEqual(0, len(differences))