1
0
Fork 0
forked from wry/wry

autocommit 2022-05-01 21:44:09 CEST

This commit is contained in:
Julian Orth 2022-05-01 21:44:09 +02:00
parent cca3850800
commit 04580c4aeb
38 changed files with 815 additions and 124 deletions

View file

@ -1,10 +1,12 @@
use {
crate::{
cli::screenshot::buf_to_qoi,
client::Client,
it::{
test_error::TestError,
test_ifs::{
test_compositor::TestCompositor, test_jay_compositor::TestJayCompositor,
test_registry::TestRegistry, test_shm::TestShm,
test_registry::TestRegistry, test_shm::TestShm, test_xdg_base::TestXdgWmBase,
},
test_transport::TestTransport,
testrun::TestRun,
@ -16,19 +18,32 @@ use {
pub struct TestClient {
pub run: Rc<TestRun>,
pub server: Rc<Client>,
pub transport: Rc<TestTransport>,
pub tran: Rc<TestTransport>,
pub registry: Rc<TestRegistry>,
pub jc: Rc<TestJayCompositor>,
pub comp: Rc<TestCompositor>,
pub shm: Rc<TestShm>,
pub xdg: Rc<TestXdgWmBase>,
}
impl TestClient {
pub fn error(&self, msg: &str) {
self.transport.error(msg)
self.tran.error(msg)
}
pub async fn sync(self: &Rc<Self>) {
self.transport.sync().await
self.tran.sync().await
}
pub async fn take_screenshot(&self) -> Result<Vec<u8>, TestError> {
let dmabuf = self.jc.take_screenshot().await?;
let qoi = buf_to_qoi(&dmabuf);
Ok(qoi)
}
}
impl Drop for TestClient {
fn drop(&mut self) {
self.tran.kill();
}
}