Skip to content

Commit

Permalink
Added test case for issue #12
Browse files Browse the repository at this point in the history
  • Loading branch information
heuer committed Nov 27, 2023
1 parent 718c811 commit 1694319
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""\
Nox test runner configuration.
"""
import sys
import os
import re
from functools import partial
Expand All @@ -16,7 +17,7 @@
import nox

_PY_VERSIONS = ('3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3')
_PY_DEFAULT_VERSION = '3.11'
_PY_DEFAULT_VERSION = sys.version[:4]
nox.options.sessions = ['test-{}'.format(_PY_DEFAULT_VERSION), 'test-pypy3']


Expand Down
1 change: 1 addition & 0 deletions requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
pytest
pyzbar~=0.1.8
cairosvg
setuptools
21 changes: 19 additions & 2 deletions tests/test_to_artistic.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- Lars Heuer - Semagia <http://www.semagia.com/>.
# Copyright (c) 2016 - 2023 -- Lars Heuer - Semagia <http://www.semagia.com/>.
# All rights reserved.
#
# License: BSD License
#
"""\
Tests against QRCode.to_artistic
"""
from __future__ import absolute_import
import os
import io
import tempfile
Expand Down Expand Up @@ -169,6 +168,24 @@ def test_issue_11():
os.remove(fn)


def test_issue_12():
# https://github.com/heuer/qrcode-artistic/pull/12
content = 'Penny Lane'
out = io.BytesIO()
img_src = _img_src('animated.gif')
org_img = Image.open(img_src)
assert org_img.is_animated
assert org_img.n_frames > 1
qr = segno.make_qr(content)
assert qr
qr.to_artistic(img_src, out, kind='gif')
out.seek(0)
res_img = Image.open(out)
assert res_img.is_animated
assert org_img.n_frames == res_img.n_frames
assert org_img.info.get('loop', 0) == res_img.info.get('loop', 0)


@pytest.mark.skipif(_PYTHON2, reason='Requires Python >= 3.6')
def test_svg_to_png():
content = "Ring my friend I said you'd call"
Expand Down

0 comments on commit 1694319

Please sign in to comment.