コード例 #1
0
 def _init_display_emulated(self):
     """ Enumlate a screen : write to GIF instead of physical screen"""
     self._gif = ''.join(
         random.choices(string.ascii_uppercase + string.digits,
                        k=3)) + ".gif"
     self._display = gifanim(filename=self._gif,
                             duration=0.1,
                             max_frames=100,
                             mode="1")
コード例 #2
0
def test_gifanim_max_frames():
    reference = get_reference_image('anim.gif')
    img = Image.open(reference)
    with NamedTemporaryFile(suffix='.gif') as temp:
        fname = temp.name
        device = gifanim(256, 128, filename=fname, max_frames=1)

        with pytest.raises(SystemExit) as ex:
            device.display(img)
        assert str(ex.value) == '0'
コード例 #3
0
def test_gifanim_write():
    with NamedTemporaryFile(suffix='.gif') as temp:
        fname = temp.name
        device = gifanim(filename=fname)

        with canvas(device) as draw:
            baseline_data.primitives(device, draw)

        with canvas(device) as draw:
            draw.text((30, 10), text="Blipvert", fill="white")

        with canvas(device) as draw:
            baseline_data.primitives(device, draw)

        device.write_animation()
        assert_identical('anim.gif', fname)
コード例 #4
0
def test_gifanim_noimages():
    with NamedTemporaryFile(suffix='.gif') as temp:
        fname = temp.name
        device = gifanim(filename=fname)
        device.write_animation()
    assert not os.path.exists(fname)