autocommit 2022-05-01 21:44:09 CEST
This commit is contained in:
parent
cca3850800
commit
04580c4aeb
38 changed files with 815 additions and 124 deletions
36
src/it/test_ifs/test_screenshot.rs
Normal file
36
src/it/test_ifs/test_screenshot.rs
Normal 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 {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue