it: test subsurface positioning
This commit is contained in:
parent
fd027d9a5a
commit
cbf539cbcc
17 changed files with 291 additions and 9 deletions
68
src/it/test_ifs/test_subsurface.rs
Normal file
68
src/it/test_ifs/test_subsurface.rs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
use {
|
||||
crate::{
|
||||
ifs::wl_surface::wl_subsurface::WlSubsurface,
|
||||
it::{test_error::TestError, test_object::TestObject, test_transport::TestTransport},
|
||||
wire::{wl_subsurface::*, WlSubsurfaceId, WlSurfaceId},
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct TestSubsurface {
|
||||
pub id: WlSubsurfaceId,
|
||||
pub tran: Rc<TestTransport>,
|
||||
pub destroyed: Cell<bool>,
|
||||
pub server: Rc<WlSubsurface>,
|
||||
}
|
||||
|
||||
impl TestSubsurface {
|
||||
pub fn destroy(&self) -> Result<(), TestError> {
|
||||
if !self.destroyed.replace(true) {
|
||||
self.tran.send(Destroy { self_id: self.id })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_position(&self, x: i32, y: i32) -> Result<(), TestError> {
|
||||
self.tran.send(SetPosition {
|
||||
self_id: self.id,
|
||||
x,
|
||||
y,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn place_above(&self, surface: WlSurfaceId) -> Result<(), TestError> {
|
||||
self.tran.send(PlaceAbove {
|
||||
self_id: self.id,
|
||||
sibling: surface,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn place_below(&self, surface: WlSurfaceId) -> Result<(), TestError> {
|
||||
self.tran.send(PlaceBelow {
|
||||
self_id: self.id,
|
||||
sibling: surface,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_sync(&self) -> Result<(), TestError> {
|
||||
self.tran.send(SetSync { self_id: self.id })
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_desync(&self) -> Result<(), TestError> {
|
||||
self.tran.send(SetDesync { self_id: self.id })
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestSubsurface {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestSubsurface, WlSubsurface;
|
||||
}
|
||||
|
||||
impl TestObject for TestSubsurface {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue