34 lines
814 B
Rust
34 lines
814 B
Rust
use {
|
|
crate::{
|
|
it::{test_error::TestError, test_object::TestObject, test_transport::TestTransport},
|
|
wire::{wp_linux_drm_syncobj_timeline_v1::*, WpLinuxDrmSyncobjTimelineV1Id},
|
|
},
|
|
std::{cell::Cell, rc::Rc},
|
|
};
|
|
|
|
pub struct TestSyncobjTimeline {
|
|
pub id: WpLinuxDrmSyncobjTimelineV1Id,
|
|
pub tran: Rc<TestTransport>,
|
|
pub destroyed: Cell<bool>,
|
|
}
|
|
|
|
impl TestSyncobjTimeline {
|
|
pub fn destroy(&self) -> Result<(), TestError> {
|
|
if !self.destroyed.replace(true) {
|
|
self.tran.send(Destroy { self_id: self.id })?;
|
|
}
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
impl Drop for TestSyncobjTimeline {
|
|
fn drop(&mut self) {
|
|
let _ = self.destroy();
|
|
}
|
|
}
|
|
|
|
test_object! {
|
|
TestSyncobjTimeline, WpLinuxDrmSyncobjTimelineV1;
|
|
}
|
|
|
|
impl TestObject for TestSyncobjTimeline {}
|