it: use single-pixel buffer instead of shm
This commit is contained in:
parent
aaed003ec8
commit
f562f887f0
17 changed files with 280 additions and 76 deletions
48
src/it/test_ifs/test_buffer.rs
Normal file
48
src/it/test_ifs/test_buffer.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{
|
||||
test_error::TestError, test_object::TestObject, test_transport::TestTransport,
|
||||
testrun::ParseFull,
|
||||
},
|
||||
utils::buffd::MsgParser,
|
||||
wire::{wl_buffer::*, WlBufferId},
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct TestBuffer {
|
||||
pub id: WlBufferId,
|
||||
pub tran: Rc<TestTransport>,
|
||||
pub released: Cell<bool>,
|
||||
pub destroyed: Cell<bool>,
|
||||
}
|
||||
|
||||
impl TestBuffer {
|
||||
pub fn destroy(&self) -> Result<(), TestError> {
|
||||
if self.destroyed.replace(true) {
|
||||
return Ok(());
|
||||
}
|
||||
self.tran.send(Destroy { self_id: self.id })?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_release(&self, parser: MsgParser<'_, '_>) -> Result<(), TestError> {
|
||||
let _ev = Release::parse_full(parser)?;
|
||||
self.released.set(true);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestBuffer {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestBuffer, WlBuffer;
|
||||
|
||||
RELEASE => handle_release,
|
||||
}
|
||||
|
||||
impl TestObject for TestBuffer {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue