Skip to content

Commit

Permalink
test Xtightvnc (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
ponty committed Sep 18, 2023
1 parent 8368c41 commit ef00c94
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y tigervnc-standalone-server xserver-xephyr gnumeric x11-utils
sudo apt-get install -y tigervnc-standalone-server tightvncserver xserver-xephyr gnumeric x11-utils
- name: Install MacOS dependencies
if: startsWith(matrix.os, 'macos')
run: |
Expand Down
81 changes: 50 additions & 31 deletions tests/test_xvnc.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,66 @@
import tempfile
from pathlib import Path

from tutil import has_xvnc, rfbport, worker
from tutil import has_xvnc, has_xtightvnc, has_xtigervnc, rfbport, worker
from vncdotool import api

from pyvirtualdisplay import Display
from pyvirtualdisplay.xvnc import XvncDisplay
from pyvirtualdisplay import xvnc

if has_xvnc():

def test_xvnc():
with tempfile.TemporaryDirectory() as temp_dir:
vnc_png = Path(temp_dir) / "vnc.png"
password = "123456"
passwd_file = Path(temp_dir) / "pwd.txt"
vncpasswd_generated = b"\x49\x40\x15\xf9\xa3\x5e\x8b\x22"
passwd_file.write_bytes(vncpasswd_generated)

if worker() == 0:
with Display(backend="xvnc"):
with api.connect("localhost:0") as client:
client.timeout = 1
client.captureScreen(vnc_png)
with XvncDisplay():
with api.connect("localhost:0") as client:
client.timeout = 1
client.captureScreen(vnc_png)

sconnect = "localhost:%s" % (rfbport() - 5900)
with Display(backend="xvnc", rfbport=rfbport()):
with api.connect(sconnect) as client:
client.timeout = 1
client.captureScreen(vnc_png)
with XvncDisplay(rfbport=rfbport()):
with api.connect(sconnect) as client:
client.timeout = 1
client.captureScreen(vnc_png)
check_xvnc()


if has_xtightvnc():

def test_xvnc_tight():
xvnc.PROGRAM = "Xtightvnc"
check_xvnc()

with Display(backend="xvnc", rfbport=rfbport(), rfbauth=passwd_file):
with api.connect(sconnect, password=password) as client:

if has_xtigervnc():

def test_xvnc_tiger():
xvnc.PROGRAM = "Xtigervnc"
check_xvnc()


def check_xvnc():
with tempfile.TemporaryDirectory() as temp_dir:
vnc_png = Path(temp_dir) / "vnc.png"
password = "123456"
passwd_file = Path(temp_dir) / "pwd.txt"
vncpasswd_generated = b"\x49\x40\x15\xf9\xa3\x5e\x8b\x22"
passwd_file.write_bytes(vncpasswd_generated)

if worker() == 0:
with Display(backend="xvnc"):
with api.connect("localhost:0") as client:
client.timeout = 1
client.captureScreen(vnc_png)
with XvncDisplay(rfbport=rfbport(), rfbauth=passwd_file):
with api.connect(sconnect, password=password) as client:
with XvncDisplay():
with api.connect("localhost:0") as client:
client.timeout = 1
client.captureScreen(vnc_png)

sconnect = "localhost:%s" % (rfbport() - 5900)
with Display(backend="xvnc", rfbport=rfbport()):
with api.connect(sconnect) as client:
client.timeout = 1
client.captureScreen(vnc_png)
with XvncDisplay(rfbport=rfbport()):
with api.connect(sconnect) as client:
client.timeout = 1
client.captureScreen(vnc_png)

with Display(backend="xvnc", rfbport=rfbport(), rfbauth=passwd_file):
with api.connect(sconnect, password=password) as client:
client.timeout = 1
client.captureScreen(vnc_png)
with XvncDisplay(rfbport=rfbport(), rfbauth=passwd_file):
with api.connect(sconnect, password=password) as client:
client.timeout = 1
client.captureScreen(vnc_png)
6 changes: 6 additions & 0 deletions tests/tutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def has_displayfd():
def has_xvnc():
return prog_check(["Xvnc", "-help"])

def has_xtightvnc():
return prog_check(["Xtightvnc", "-version"])

def has_xtigervnc():
return prog_check(["Xtigervnc", "-help"])


def worker():
w = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant/debian10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sudo apt-get install -y mc python3-pip xvfb
# sudo apt-get install -y libjpeg-dev zlib1g-dev

# project dependencies
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server tightvncserver

# test dependencies
sudo apt-get install -y gnumeric
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant/debian11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sudo apt-get install -y mc python3-pip xvfb
# sudo apt-get install -y libjpeg-dev zlib1g-dev

# project dependencies
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server tightvncserver

# test dependencies
sudo apt-get install -y gnumeric
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant/ubuntu1804.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sudo apt-get install -y mc python3-pip xvfb
# sudo apt-get install -y libjpeg-dev zlib1g-dev

# project dependencies
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server tightvncserver

# test dependencies
sudo apt-get install -y gnumeric
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant/ubuntu2004.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sudo apt-get install -y mc python3-pip xvfb
# sudo apt-get install -y libjpeg-dev zlib1g-dev

# project dependencies
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server tightvncserver

# test dependencies
sudo apt-get install -y gnumeric
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant/ubuntu2204.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sudo apt-get install -y mc python3-pip xvfb
# sudo apt-get install -y libjpeg-dev zlib1g-dev

# project dependencies
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server
sudo apt-get install -y xvfb xserver-xephyr tigervnc-standalone-server tightvncserver

# test dependencies
sudo apt-get install -y gnumeric
Expand Down

0 comments on commit ef00c94

Please sign in to comment.