2016-03-02 22:16:58 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
"""tests for the text printing function
|
|
|
|
|
|
|
|
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
|
|
|
|
:organization: `python-escpos <https://github.com/python-escpos>`_
|
|
|
|
:copyright: Copyright (c) 2016 `python-escpos <https://github.com/python-escpos>`_
|
|
|
|
:license: GNU GPL v3
|
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from __future__ import division
|
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-08-25 15:30:20 +00:00
|
|
|
from escpos.printer import Dummy
|
2016-03-02 22:16:58 +00:00
|
|
|
|
2016-04-02 13:29:51 +00:00
|
|
|
|
2016-03-02 22:16:58 +00:00
|
|
|
def test_function_text_dies_ist_ein_test_lf():
|
|
|
|
"""test the text printing function with simple string and compare output"""
|
2016-08-30 11:08:23 +00:00
|
|
|
instance = Dummy()
|
2016-03-02 22:16:58 +00:00
|
|
|
instance.text('Dies ist ein Test.\n')
|
2016-08-30 11:20:42 +00:00
|
|
|
assert instance.output == b'Dies ist ein Test.\n'
|
2016-08-25 15:30:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_block_text():
|
|
|
|
printer = Dummy()
|
|
|
|
printer.block_text(
|
|
|
|
"All the presidents men were eating falafel for breakfast.", font='a')
|
|
|
|
assert printer.output == \
|
2016-08-30 11:20:42 +00:00
|
|
|
b'All the presidents men were eating falafel\nfor breakfast.'
|