Exemple #1
0
    def test_full(self):
        data = image_encoding.html_to_png('')

        image = Image.open(data)
        image = image_encoding.crop_384(image)
        image = image_encoding.convert_to_1bit(image)

        n_bytes, _ = image_encoding.rle_from_bw(image)
        self.assertEquals(n_bytes, 3072)
Exemple #2
0
    def test_full(self):
        data = image_encoding.html_to_png('')

        image = Image.open(data)
        image = image_encoding.crop_384(image)
        image = image_encoding.threshold(image)

        n_bytes, _ = image_encoding.rle_from_bw(image)
        self.assertEquals(n_bytes, 3072)
    def _check_html(self, name, html):
        print('Cheking fixture named: %s' % name)

        with TemporaryDirectory() as tmpdir:
            data = image_encoding.html_to_png(html)
            image = Image.open(data)

            temp_file_name = os.path.join(tmpdir, '%s.png' % name)
            image.save(temp_file_name, format='PNG')
            self.assertMatchSnapshot(FileSnapshot(temp_file_name), name)
    def test_full(self):
        data = image_encoding.html_to_png(
            '<html><body style="margin: 0px; height: 10px;"></body></html>')

        image = Image.open(data)
        image = image_encoding.crop_384(image)
        image = image_encoding.convert_to_1bit(image)

        n_bytes, _ = image_encoding.rle_from_bw(image)
        self.assertEquals(n_bytes, 3840)
Exemple #5
0
 def _test_normal_text(self):
     data = image_encoding.html_to_png('')
     image = Image.open(data)
     self.assertEquals(image.size[0], 384)
Exemple #6
0
 def _test_rle(self):
     data = image_encoding.html_to_png('')
     image = Image.open(data)
     n_bytes, _ = image_encoding.rle_image(data)
     self.assertEquals(n_bytes, 3072)
Exemple #7
0
 def _test_normal_height(self):
     data = image_encoding.html_to_png(
         '<html><body style="margin: 0px; height: 100px;"></body></html>')
     image = Image.open(data)
     self.assertEquals(image.size[1], 100)
Exemple #8
0
 def _test_normal_text(self):
     data = image_encoding.html_to_png('')
     image = Image.open(data)
     self.assertEquals(image.size[0], 384)
Exemple #9
0
 def _test_rle(self):
     data = image_encoding.html_to_png('')
     image = Image.open(data)
     n_bytes, _ = image_encoding.rle_image(data)
     self.assertEquals(n_bytes, 3072)
Exemple #10
0
 def _test_normal_height(self):
     data = image_encoding.html_to_png(
         '<html><body style="margin: 0px; height: 100px;"></body></html>')
     image = Image.open(data)
     self.assertEquals(image.size[1], 100)