Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_default_values():
instance = printer.Dummy()
instance.set()
expected_sequence = (
TXT_NORMAL, TXT_STYLE['size']['normal'], # Normal text size
TXT_STYLE['flip'][False], # Flip OFF
TXT_STYLE['smooth'][False], # Smooth OFF
TXT_STYLE['bold'][False], # Bold OFF
TXT_STYLE['underline'][0], # Underline OFF
SET_FONT(b'\x00'), # Default font
TXT_STYLE['align']['left'], # Align left
TXT_STYLE['invert'][False] # Inverted OFF
)
assert(instance.output == b''.join(expected_sequence))
def test_function_panel_button_off():
"""test the panel button function (disabling) by comparing output"""
instance = printer.Dummy()
instance.panel_buttons(False)
assert(instance.output == b'\x1B\x63\x35\x01')
def test_bit_image_transparent():
"""
Test printing black/transparent bit image (raster)
"""
instance = printer.Dummy()
instance.image('test/resources/black_transparent.png', impl="bitImageRaster")
assert(instance.output == b'\x1dv0\x00\x01\x00\x02\x00\xc0\x00')
def test_set_size_custom():
instance = printer.Dummy()
instance.set(custom_size=True, width=8, height=7)
expected_sequence = (
TXT_SIZE, # Custom text size, no normal reset
six.int2byte(TXT_STYLE['width'][8] + TXT_STYLE['height'][7]),
TXT_STYLE['flip'][False], # Flip OFF
TXT_STYLE['smooth'][False], # Smooth OFF
TXT_STYLE['bold'][False], # Bold OFF
TXT_STYLE['underline'][0], # Underline OFF
SET_FONT(b'\x00'), # Default font
TXT_STYLE['align']['left'], # Align left
TXT_STYLE['invert'][False] # Inverted OFF
)
assert (instance.output == b''.join(expected_sequence))
def instance():
return printer.Dummy()