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

@ -0,0 +1,36 @@
use {
crate::{
it::{test_error::TestError, test_object::TestObject, testrun::ParseFull},
utils::buffd::MsgParser,
wire::{jay_screenshot::*, JayScreenshotId},
},
std::cell::Cell,
};
pub struct TestJayScreenshot {
pub id: JayScreenshotId,
pub result: Cell<Option<Result<Dmabuf, String>>>,
}
impl TestJayScreenshot {
fn handle_dmabuf(&self, parser: MsgParser<'_, '_>) -> Result<(), TestError> {
let ev = Dmabuf::parse_full(parser)?;
self.result.set(Some(Ok(ev)));
Ok(())
}
fn handle_error(&self, parser: MsgParser<'_, '_>) -> Result<(), TestError> {
let ev = Error::parse_full(parser)?;
self.result.set(Some(Err(ev.msg.to_string())));
Ok(())
}
}
test_object! {
TestJayScreenshot, JayScreenshot;
DMABUF => handle_dmabuf,
ERROR => handle_error,
}
impl TestObject for TestJayScreenshot {}