1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
from tutil import has_xvnc, rfbport
from pyvirtualdisplay import Display
def test_with_xvfb():
with Display(size=(800, 600)) as vd:
assert vd.is_alive()
assert vd._backend == "xvfb"
# assert vd.return_code == 0
assert not vd.is_alive()
with Display(visible=False, size=(800, 600)) as vd:
assert vd.is_alive()
assert vd._backend == "xvfb"
# assert vd.return_code == 0
assert not vd.is_alive()
with Display(backend="xvfb", size=(800, 600)) as vd:
assert vd.is_alive()
assert vd._backend == "xvfb"
# assert vd.return_code == 0
assert not vd.is_alive()
def test_with_xephyr():
with Display() as vd:
with Display(visible=True, size=(800, 600)) as vd:
assert vd.is_alive()
assert vd._backend == "xephyr"
# assert vd.return_code == 0
assert not vd.is_alive()
with Display(backend="xephyr", size=(800, 600)) as vd:
assert vd.is_alive()
assert vd._backend == "xephyr"
# assert vd.return_code == 0
assert not vd.is_alive()
if has_xvnc():
def test_with_xvnc():
with Display(backend="xvnc", size=(800, 600), rfbport=rfbport()) as vd:
assert vd.is_alive()
assert vd._backend == "xvnc"
# assert vd.return_code == 0
assert not vd.is_alive()
def test_dpi():
with Display(backend="xvfb", size=(800, 600), dpi=99) as vd:
assert vd.is_alive()
# assert vd.return_code == 0
assert not vd.is_alive()
|