예제 #1
0
 def test_negative_offset(self):
     sub_img = create_image((150, 150), color=[100, 120, 130, 140])
     img = SubImageSource(sub_img,
                          size=(100, 100),
                          offset=(-50, 0),
                          image_opts=ImageOptions()).as_image()
     eq_(img.getcolors(), [(100 * 100, (100, 120, 130, 140))])
예제 #2
0
 def test_larger(self):
     sub_img = create_image((150, 150), color=[100, 120, 130, 140])
     img = SubImageSource(sub_img,
                          size=(100, 100),
                          offset=(0, 0),
                          image_opts=ImageOptions()).as_image()
     assert img.getcolors() == [(100 * 100, (100, 120, 130, 140))]
예제 #3
0
 def test_outside(self):
     sub_img = create_image((50, 50), color=[100, 120, 130, 140])
     img = SubImageSource(
         sub_img,
         size=(100, 100),
         offset=(200, 0),
         image_opts=ImageOptions(transparent=True)).as_image()
     eq_(img.getcolors(), [(100 * 100, (255, 255, 255, 0))])
예제 #4
0
 def test_overlap_right(self):
     sub_img = create_image((50, 50), color=[100, 120, 130, 140])
     img = SubImageSource(
         sub_img,
         size=(100, 100),
         offset=(75, 25),
         image_opts=ImageOptions(transparent=True)).as_image()
     eq_(sorted(img.getcolors()),
         [(25 * 50, (100, 120, 130, 140)),
          (100 * 100 - 25 * 50, (255, 255, 255, 0))])
예제 #5
0
 def test_outside(self):
     sub_img = create_image((50, 50), color=[100, 120, 130, 140])
     img = SubImageSource(sub_img, size=(100, 100), offset=(200, 0), image_opts=ImageOptions(transparent=True)).as_image()
     eq_(img.getcolors(), [(100*100, (255, 255, 255, 0))])
예제 #6
0
 def test_overlap_right(self):
     sub_img = create_image((50, 50), color=[100, 120, 130, 140])
     img = SubImageSource(sub_img, size=(100, 100), offset=(75, 25), image_opts=ImageOptions(transparent=True)).as_image()
     eq_(sorted(img.getcolors()), [(25*50, (100, 120, 130, 140)), (100*100-25*50, (255, 255, 255, 0))])
예제 #7
0
 def test_negative_offset(self):
     sub_img = create_image((150, 150), color=[100, 120, 130, 140])
     img = SubImageSource(sub_img, size=(100, 100), offset=(-50, 0), image_opts=ImageOptions()).as_image()
     eq_(img.getcolors(), [(100*100, (100, 120, 130, 140))])