예제 #1
0
    def test_success_horizontal_with_start_from_point(self):
        crop = CropFilter(start=[100, 100], size=[800, 600])

        image_png = copy(self.image_png)
        image_png = crop.apply(image_png)
        self.assertTupleEqual((800, 400), image_png.size)

        image_jpg = copy(self.image_jpg)
        image_jpg = crop.apply(image_jpg)
        self.assertTupleEqual((800, 400), image_jpg.size)

        image_tif = copy(self.image_tif)
        image_tif = crop.apply(image_tif)
        self.assertTupleEqual((800, 400), image_tif.size)

        image_bmp = copy(self.image_bmp)
        image_bmp = crop.apply(image_bmp)
        self.assertTupleEqual((800, 400), image_bmp.size)
예제 #2
0
    def test_error_with_out_of_range(self):
        crop = CropFilter(start=[1000, 1000], size=[1500, 1000])

        image_png = copy(self.image_png)
        image_png = crop.apply(image_png)
        self.assertTupleEqual((1000, 500), image_png.size)

        image_jpg = copy(self.image_jpg)
        image_jpg = crop.apply(image_jpg)
        self.assertTupleEqual((1000, 500), image_jpg.size)

        image_tif = copy(self.image_tif)
        image_tif = crop.apply(image_tif)
        self.assertTupleEqual((1000, 500), image_tif.size)

        image_bmp = copy(self.image_bmp)
        image_bmp = crop.apply(image_bmp)
        self.assertTupleEqual((1000, 500), image_bmp.size)
예제 #3
0
    def test_success_with_oversize(self):
        crop = CropFilter(start=[0, 0], size=[1500, 1000])

        image_png = copy(self.image_png)
        image_png = crop.apply(image_png)
        self.assertTupleEqual((1000, 500), image_png.size)

        image_jpg = copy(self.image_jpg)
        image_jpg = crop.apply(image_jpg)
        self.assertTupleEqual((1000, 500), image_jpg.size)

        image_tif = copy(self.image_tif)
        image_tif = crop.apply(image_tif)
        self.assertTupleEqual((1000, 500), image_tif.size)

        image_bmp = copy(self.image_bmp)
        image_bmp = crop.apply(image_bmp)
        self.assertTupleEqual((1000, 500), image_bmp.size)
예제 #4
0
    def test_success_horizontal_with_start_from_point(self):
        crop = CropFilter(start=[100, 100], size=[800, 600])

        image_png = copy(self.image_png)
        image_png = crop.apply(image_png)
        self.assertTupleEqual((800, 400), image_png.size)

        image_jpg = copy(self.image_jpg)
        image_jpg = crop.apply(image_jpg)
        self.assertTupleEqual((800, 400), image_jpg.size)

        image_tif = copy(self.image_tif)
        image_tif = crop.apply(image_tif)
        self.assertTupleEqual((800, 400), image_tif.size)

        image_bmp = copy(self.image_bmp)
        image_bmp = crop.apply(image_bmp)
        self.assertTupleEqual((800, 400), image_bmp.size)
예제 #5
0
    def test_error_with_out_of_range(self):
        crop = CropFilter(start=[1000, 1000], size=[1500, 1000])

        image_png = copy(self.image_png)
        image_png = crop.apply(image_png)
        self.assertTupleEqual((1000, 500), image_png.size)

        image_jpg = copy(self.image_jpg)
        image_jpg = crop.apply(image_jpg)
        self.assertTupleEqual((1000, 500), image_jpg.size)

        image_tif = copy(self.image_tif)
        image_tif = crop.apply(image_tif)
        self.assertTupleEqual((1000, 500), image_tif.size)

        image_bmp = copy(self.image_bmp)
        image_bmp = crop.apply(image_bmp)
        self.assertTupleEqual((1000, 500), image_bmp.size)
예제 #6
0
    def test_success_with_oversize(self):
        crop = CropFilter(start=[0, 0], size=[1500, 1000])

        image_png = copy(self.image_png)
        image_png = crop.apply(image_png)
        self.assertTupleEqual((1000, 500), image_png.size)

        image_jpg = copy(self.image_jpg)
        image_jpg = crop.apply(image_jpg)
        self.assertTupleEqual((1000, 500), image_jpg.size)

        image_tif = copy(self.image_tif)
        image_tif = crop.apply(image_tif)
        self.assertTupleEqual((1000, 500), image_tif.size)

        image_bmp = copy(self.image_bmp)
        image_bmp = crop.apply(image_bmp)
        self.assertTupleEqual((1000, 500), image_bmp.size)
예제 #7
0
 def test_wrong_resource_type(self):
     crop = CropFilter(start=[0, 0], size=[800, 600])
     with self.assertRaises(ValueError):
         crop.apply("string")
예제 #8
0
 def test_wrong_resource_type(self):
     crop = CropFilter(start=[0, 0], size=[800, 600])
     with self.assertRaises(ValueError):
         crop.apply('string')