Skip to content

Commit

Permalink
tests: rename "screenshare" to "source"
Browse files Browse the repository at this point in the history
It better matches the function, since "screenshare" service is not used
in the webcam service anymore.
  • Loading branch information
marmarek committed Oct 8, 2024
1 parent 65e79c9 commit e42578c
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/qvctests/integ.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
class TC_00_QVCTest(qubes.tests.extra.ExtraTestCase):
def setUp(self):
super(TC_00_QVCTest, self).setUp()
self.screenshare, self.view = self.create_vms(
["share", "view"])
self.screenshare.start()
if self.screenshare.run('which qubes-video-companion', wait=True) != 0:
self.source, self.view = self.create_vms(
["source", "view"])
self.source.start()
if self.source.run('which qubes-video-companion', wait=True) != 0:
self.skipTest('qubes-video-companion not installed')

def wait_for_video0(self, vm):
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_010_screenshare(self):
self.qrexec_policy('qvc.ScreenShare',
self.view.name,
'@default',
target=self.screenshare.name)
target=self.source.name)
p = self.view.run('qubes-video-companion screenshare',
passio_popen=True, passio_stderr=True)
# wait for device to appear, or a timeout
Expand All @@ -90,11 +90,11 @@ def test_010_screenshare(self):
p.returncode, *p.communicate()))

# capture in source:
source_image = self.capture_from_screen(self.screenshare)
source_image = self.capture_from_screen(self.source)
destination_image = self.capture_from_video(self.view)
diff = self.compare_images(source_image, destination_image)
self.assertLess(diff, 2.0)
self.click_stop(self.screenshare, 'screenshare')
self.click_stop(self.source, 'screenshare')
# wait for device to disappear, or a timeout
self.wait_for_video0_disconnect(self.view)
stdout, stderr = p.communicate()
Expand All @@ -109,22 +109,22 @@ def test_010_screenshare(self):
def test_020_webcam(self):
"""Webcam test
screenshare -> view (webcam)
source -> view (webcam)
"""
self.loop.run_until_complete(self.wait_for_session(self.screenshare))
self.loop.run_until_complete(self.wait_for_session(self.source))
self.view.start()
self.loop.run_until_complete(self.wait_for_session(self.view))
self.qrexec_policy('qvc.Webcam',
self.view.name,
'@default',
target=self.screenshare.name)
self.screenshare.run("modprobe v4l2loopback", user="root", wait=True)
p = self.screenshare.run(
target=self.source.name)
self.source.run("modprobe v4l2loopback", user="root", wait=True)
p = self.source.run(
"gst-launch-1.0 -q videotestsrc pattern=checkers-8"
" ! v4l2sink device=/dev/video0",
passio_popen=True, passio_stderr=True)
# wait for device to appear, or a timeout
self.wait_for_video0(self.screenshare)
self.wait_for_video0(self.source)
self.loop.run_until_complete(asyncio.sleep(3))
if p.returncode is not None:
self.fail("'gst-launch-1.0 videotestsrc' exited early ({}): {} {}".format(
Expand All @@ -137,13 +137,13 @@ def test_020_webcam(self):
self.fail("'qubes-video-companion webcam' exited early ({}): {} {}".format(
p2.returncode, *p2.communicate()))

source_image = self.capture_from_video(self.screenshare)
source_image = self.capture_from_video(self.source)
destination_image = self.capture_from_video(self.view)
diff = self.compare_images(source_image, destination_image)
self.assertLess(diff, 2.5)
self.click_stop(self.screenshare, 'webcam')
self.click_stop(self.source, 'webcam')
self.wait_for_video0_disconnect(self.view)
self.screenshare.run("pkill gst-launch-1.0", wait=True)
self.source.run("pkill gst-launch-1.0", wait=True)
stdout, stderr = p2.communicate()
if p2.returncode != 0:
self.fail("'qubes-video-companion webcam' failed ({}): {} {}".format(
Expand Down

0 comments on commit e42578c

Please sign in to comment.