1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-08-24 09:03:34 +00:00

apply fixes, mainly to whitespace ( patch by @patkan in #128 )

This commit is contained in:
Michael Billington
2016-04-13 21:27:51 +10:00
parent 44c79eaf11
commit a0d8689141
5 changed files with 40 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ converted to ESC/POS column & raster formats.
from escpos.image import EscposImage
def test_image_black():
"""
Test rendering solid black image
@@ -17,6 +18,7 @@ def test_image_black():
for img_format in ['png', 'jpg', 'gif']:
_load_and_check_img('canvas_black.' + img_format, 1, 1, b'\x80', [b'\x80'])
def test_image_black_transparent():
"""
Test rendering black/transparent image
@@ -24,6 +26,7 @@ def test_image_black_transparent():
for img_format in ['png', 'gif']:
_load_and_check_img('black_transparent.' + img_format, 2, 2, b'\xc0\x00', [b'\x80\x80'])
def test_image_black_white():
"""
Test rendering black/white image
@@ -31,6 +34,7 @@ def test_image_black_white():
for img_format in ['png', 'jpg', 'gif']:
_load_and_check_img('black_white.' + img_format, 2, 2, b'\xc0\x00', [b'\x80\x80'])
def test_image_white():
"""
Test rendering solid white image
@@ -38,11 +42,12 @@ def test_image_white():
for img_format in ['png', 'jpg', 'gif']:
_load_and_check_img('canvas_white.' + img_format, 1, 1, b'\x00', [b'\x00'])
def _load_and_check_img(filename, width_expected, height_expected, raster_format_expected, column_format_expected):
"""
Load an image, and test whether raster & column formatted output, sizes, etc match expectations.
"""
im = EscposImage('test/resources/' + filename)
im = EscposImage('test/resources/' + filename)
assert(im.width == width_expected)
assert(im.height == height_expected)
assert(im.to_raster_format() == raster_format_expected)