voelin-media: run the X11 capture test only on a test display

The test maps windows, moves the pointer and captures the screen of
whatever DISPLAY names. On a desktop session (XWayland included) a plain
`cargo test` therefore ran it on the user's real screen. Take the display
from VOELIN_X11_TEST_DISPLAY instead, as the X11 hotkey test of
voelin-platform already does and as CI sets it under xvfb-run, so the
test only ever runs on a display made for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 17:50:24 +03:00
1 parent b8a111df1f
commit a9a12bb4db
2 files changed
+9 -6

No files matched your search

+7 -4
View File
@@ -2,8 +2,10 @@
//! (MIT-SHM and GetImage), checks pixels, and sends a window capture through
//! VP8 and back.
//!
//! Needs `DISPLAY` (e.g. `Xvfb :101 -screen 0 1280x720x24 & DISPLAY=:101
//! cargo test -p voelin-media --test x11_capture`); skipped without it.
//! Needs a test X server in `VOELIN_X11_TEST_DISPLAY`, never the desktop's
//! `DISPLAY` (it maps windows and moves the pointer): e.g. `xvfb-run -a bash
//! -c 'VOELIN_X11_TEST_DISPLAY=$DISPLAY cargo test -p voelin-media --test
//! x11_capture'`, as CI does; skipped without it.
#![cfg(all(target_os = "linux", feature = "x11", feature = "vpx"))]
use std::time::Duration;
@@ -150,8 +152,9 @@ async fn check_monitor(capture: &mut X11Capture, scene: &Scene) {
#[tokio::test(flavor = "multi_thread")]
async fn x11_capture_end_to_end() {
let Some(display) = std::env::var("DISPLAY").ok().filter(|d| !d.is_empty()) else {
eprintln!("skipped: DISPLAY is not set");
let Some(display) = std::env::var("VOELIN_X11_TEST_DISPLAY").ok().filter(|d| !d.is_empty())
else {
eprintln!("skipped: VOELIN_X11_TEST_DISPLAY is not set");
return;
};
let scene = Scene::create(&display);