it: test cursor-shape protocol
This commit is contained in:
parent
9c8131e145
commit
6448a14fb1
10 changed files with 154 additions and 2 deletions
38
src/it/test_ifs/test_cursor_shape_device.rs
Normal file
38
src/it/test_ifs/test_cursor_shape_device.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{test_error::TestResult, test_object::TestObject, test_transport::TestTransport},
|
||||
wire::{wp_cursor_shape_device_v1::*, WpCursorShapeDeviceV1Id},
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct TestCursorShapeDevice {
|
||||
pub id: WpCursorShapeDeviceV1Id,
|
||||
pub tran: Rc<TestTransport>,
|
||||
pub destroyed: Cell<bool>,
|
||||
}
|
||||
|
||||
impl TestCursorShapeDevice {
|
||||
#[allow(dead_code)]
|
||||
pub fn destroy(&self) -> TestResult {
|
||||
if !self.destroyed.replace(true) {
|
||||
self.tran.send(Destroy { self_id: self.id })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_shape(&self, serial: u32, shape: u32) -> TestResult {
|
||||
self.tran.send(SetShape {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
shape,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestCursorShapeDevice, WpCursorShapeDeviceV1;
|
||||
}
|
||||
|
||||
impl TestObject for TestCursorShapeDevice {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue