1
0
Fork 0
forked from wry/wry

it: track whether objects have been deleted

This commit is contained in:
Julian Orth 2022-05-03 15:54:32 +02:00
parent cdab4d4cad
commit 6af9d909b8
22 changed files with 167 additions and 45 deletions

View file

@ -1,7 +1,9 @@
use {
crate::{
it::{
test_error::TestError, test_ifs::test_surface::TestSurface, test_object::TestObject,
test_error::TestError,
test_ifs::test_surface::TestSurface,
test_object::{Deleted, TestObject},
test_transport::TestTransport,
},
wire::{wl_compositor::CreateSurface, WlCompositorId},
@ -12,11 +14,13 @@ use {
pub struct TestCompositor {
pub id: WlCompositorId,
pub tran: Rc<TestTransport>,
pub deleted: Deleted,
}
impl TestCompositor {
pub async fn create_surface(&self) -> Result<Rc<TestSurface>, TestError> {
let id = self.tran.id();
self.deleted.check()?;
self.tran.send(CreateSurface {
self_id: self.id,
id,
@ -29,6 +33,7 @@ impl TestCompositor {
tran: self.tran.clone(),
server,
destroyed: Cell::new(false),
deleted: Default::default(),
});
self.tran.add_obj(surface.clone())?;
Ok(surface)