mirror of
https://github.com/python-escpos/python-escpos
synced 2025-09-13 09:09:58 +00:00
First attempt at centering images and QRs (#250)
This was tested on ZJ-5890 with success. By default centering is deactivated for backward compatibility. Trying to center a QR code in native mode will raise an exception as we do not know ATM if the native rendering is centered by default or not. * Added basic tests for center feature * Check image size before centering
This commit is contained in:

committed by
Patrick Kanzler

parent
50c627fbb0
commit
b648cfd67f
@@ -13,6 +13,7 @@ from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
|
||||
from escpos.printer import Dummy
|
||||
@@ -30,3 +31,12 @@ def test_type_of_object_passed_to_image_function(img_function):
|
||||
d.qr("LoremIpsum")
|
||||
args, kwargs = img_function.call_args
|
||||
assert isinstance(args[0], Image.Image)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def instance():
|
||||
return Dummy()
|
||||
|
||||
|
||||
def test_center(instance):
|
||||
instance.qr("LoremIpsum", center=True)
|
||||
|
Reference in New Issue
Block a user