adapt behavior of cups printer to match other implementations
This commit is contained in:
parent
5c5acff16c
commit
b634354c99
@ -205,9 +205,9 @@ class CupsPrinter(Escpos):
|
|||||||
"""
|
"""
|
||||||
printer = self.printers.get(self.printer_name, {})
|
printer = self.printers.get(self.printer_name, {})
|
||||||
state = printer.get("printer-state")
|
state = printer.get("printer-state")
|
||||||
if not state:
|
if not state or state in [4, 5]:
|
||||||
return b""
|
return b"8" # offline
|
||||||
return bytes((state,))
|
return b"0" # online
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
"""Close CUPS connection.
|
"""Close CUPS connection.
|
||||||
|
@ -170,7 +170,7 @@ def test_read_no_device(cupsprinter) -> None:
|
|||||||
"""
|
"""
|
||||||
GIVEN a cups printer object
|
GIVEN a cups printer object
|
||||||
WHEN device is None
|
WHEN device is None
|
||||||
THEN check the return value is b''
|
THEN check the return value is b'8'
|
||||||
"""
|
"""
|
||||||
cupsprinter.device = None
|
cupsprinter.device = None
|
||||||
assert cupsprinter._read() == b""
|
assert cupsprinter._read() == b"8"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user