1
0
Fork 0
forked from wry/wry

it: test dnd focus change on drop

This commit is contained in:
Julian Orth 2024-04-02 16:52:32 +02:00
parent a39031d4f9
commit c6b34550d8
16 changed files with 421 additions and 9 deletions

View file

@ -0,0 +1,57 @@
use {
crate::{
it::{
test_error::TestResult, test_object::TestObject, test_transport::TestTransport,
testrun::ParseFull,
},
utils::buffd::MsgParser,
wire::{wl_data_offer::*, WlDataOfferId},
},
std::{cell::Cell, rc::Rc},
};
pub struct TestDataOffer {
pub id: WlDataOfferId,
pub tran: Rc<TestTransport>,
pub destroyed: Cell<bool>,
}
impl TestDataOffer {
pub fn destroy(&self) -> TestResult {
if !self.destroyed.replace(true) {
self.tran.send(Destroy { self_id: self.id })?;
}
Ok(())
}
fn handle_offer(&self, parser: MsgParser<'_, '_>) -> TestResult {
let _ev = Offer::parse_full(parser)?;
Ok(())
}
fn handle_source_actions(&self, parser: MsgParser<'_, '_>) -> TestResult {
let _ev = SourceActions::parse_full(parser)?;
Ok(())
}
fn handle_action(&self, parser: MsgParser<'_, '_>) -> TestResult {
let _ev = Action::parse_full(parser)?;
Ok(())
}
}
impl Drop for TestDataOffer {
fn drop(&mut self) {
let _ = self.destroy();
}
}
test_object! {
TestDataOffer, WlDataOffer;
OFFER => handle_offer,
SOURCE_ACTIONS => handle_source_actions,
ACTION => handle_action,
}
impl TestObject for TestDataOffer {}