it: add fifo test
This commit is contained in:
parent
f45cbed53b
commit
73bf4465e2
9 changed files with 264 additions and 3 deletions
76
src/it/test_ifs/test_fifo_manager.rs
Normal file
76
src/it/test_ifs/test_fifo_manager.rs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{
|
||||
test_error::TestError, test_ifs::test_surface::TestSurface, test_object::TestObject,
|
||||
test_transport::TestTransport,
|
||||
},
|
||||
wire::{WpFifoManagerV1Id, WpFifoV1Id, wp_fifo_manager_v1::*, wp_fifo_v1},
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct TestFifoManager {
|
||||
pub id: WpFifoManagerV1Id,
|
||||
pub tran: Rc<TestTransport>,
|
||||
}
|
||||
|
||||
pub struct TestFifo {
|
||||
pub id: WpFifoV1Id,
|
||||
pub tran: Rc<TestTransport>,
|
||||
}
|
||||
|
||||
impl TestFifoManager {
|
||||
pub fn new(tran: &Rc<TestTransport>) -> Self {
|
||||
Self {
|
||||
id: tran.id(),
|
||||
tran: tran.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_fifo(&self, surface: &TestSurface) -> Result<Rc<TestFifo>, TestError> {
|
||||
let obj = Rc::new(TestFifo {
|
||||
id: self.tran.id(),
|
||||
tran: self.tran.clone(),
|
||||
});
|
||||
self.tran.send(GetFifo {
|
||||
self_id: self.id,
|
||||
id: obj.id,
|
||||
surface: surface.id,
|
||||
})?;
|
||||
self.tran.add_obj(obj.clone())?;
|
||||
Ok(obj)
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
pub fn destroy(&self) -> Result<(), TestError> {
|
||||
self.tran.send(Destroy { self_id: self.id })?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl TestFifo {
|
||||
pub fn set_barrier(&self) -> Result<(), TestError> {
|
||||
self.tran.send(wp_fifo_v1::SetBarrier { self_id: self.id })
|
||||
}
|
||||
|
||||
pub fn wait_barrier(&self) -> Result<(), TestError> {
|
||||
self.tran.send(wp_fifo_v1::WaitBarrier { self_id: self.id })
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
pub fn destroy(&self) -> Result<(), TestError> {
|
||||
self.tran.send(wp_fifo_v1::Destroy { self_id: self.id })?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestFifoManager, WpFifoManagerV1;
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestFifo, WpFifoV1;
|
||||
}
|
||||
|
||||
impl TestObject for TestFifoManager {}
|
||||
impl TestObject for TestFifo {}
|
||||
|
|
@ -11,6 +11,7 @@ use {
|
|||
test_data_control_manager::TestDataControlManager,
|
||||
test_data_device_manager::TestDataDeviceManager, test_dmabuf::TestDmabuf,
|
||||
test_ext_foreign_toplevel_list::TestExtForeignToplevelList,
|
||||
test_fifo_manager::TestFifoManager,
|
||||
test_input_method_manager::TestInputMethodManager,
|
||||
test_jay_compositor::TestJayCompositor, test_shm::TestShm,
|
||||
test_single_pixel_buffer_manager::TestSinglePixelBufferManager,
|
||||
|
|
@ -60,6 +61,7 @@ pub struct TestRegistrySingletons {
|
|||
pub zwp_input_method_manager_v2: u32,
|
||||
pub zwp_text_input_manager_v3: u32,
|
||||
pub wl_fixes: u32,
|
||||
pub wp_fifo_manager_v1: u32,
|
||||
}
|
||||
|
||||
pub struct TestRegistry {
|
||||
|
|
@ -88,6 +90,7 @@ pub struct TestRegistry {
|
|||
pub input_method_manager: CloneCell<Option<Rc<TestInputMethodManager>>>,
|
||||
pub text_input_manager: CloneCell<Option<Rc<TestTextInputManager>>>,
|
||||
pub wl_fixes: CloneCell<Option<Rc<TestWlFixes>>>,
|
||||
pub fifo_manager: CloneCell<Option<Rc<TestFifoManager>>>,
|
||||
pub seats: CopyHashMap<GlobalName, Rc<WlSeatGlobal>>,
|
||||
}
|
||||
|
||||
|
|
@ -160,6 +163,7 @@ impl TestRegistry {
|
|||
zwp_input_method_manager_v2,
|
||||
zwp_text_input_manager_v3,
|
||||
wl_fixes,
|
||||
wp_fifo_manager_v1,
|
||||
};
|
||||
self.singletons.set(Some(singletons.clone()));
|
||||
Ok(singletons)
|
||||
|
|
@ -276,6 +280,13 @@ impl TestRegistry {
|
|||
TestTextInputManager
|
||||
);
|
||||
create_singleton!(get_wl_fixes, wl_fixes, wl_fixes, 1, TestWlFixes);
|
||||
create_singleton!(
|
||||
get_fifo_manager,
|
||||
fifo_manager,
|
||||
wp_fifo_manager_v1,
|
||||
1,
|
||||
TestFifoManager
|
||||
);
|
||||
|
||||
pub fn bind<O: TestObject>(
|
||||
&self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue