1
0
Fork 0
forked from wry/wry

it: test toplevel drag

This commit is contained in:
Julian Orth 2024-04-03 16:52:31 +02:00
parent d4f49bf947
commit 660fa92659
11 changed files with 182 additions and 4 deletions

View file

@ -42,7 +42,8 @@ async fn test(run: Rc<TestRun>) -> Result<(), TestError> {
client.sync().await;
let enter = enter.next()?;
seat.pointer.set_cursor(enter.serial, &surface, 0, 0)?;
seat.pointer
.set_cursor(enter.serial, Some(&surface), 0, 0)?;
client.compare_screenshot("1", true).await?;

View file

@ -0,0 +1,44 @@
use {
crate::{
ifs::wl_seat::BTN_LEFT,
it::{
test_error::{TestErrorExt, TestResult},
testrun::TestRun,
},
},
std::rc::Rc,
};
testcase!();
async fn test(run: Rc<TestRun>) -> TestResult {
let ds = run.create_default_setup().await?;
let client = run.create_client().await?;
let drag_manager = client.registry.get_drag_manager().await?;
let seat = client.get_default_seat().await?;
let source = client.data_device_manager.create_data_source()?;
let dev = client.data_device_manager.get_data_device(&seat.seat)?;
let drag = drag_manager.get_xdg_toplevel_drag(&source)?;
let win = client.create_window().await?;
win.set_color(255, 255, 0, 255);
win.map2().await?;
let button = seat.pointer.button.expect()?;
let click = ds.mouse.click(BTN_LEFT);
client.sync().await;
let serial = button.next().with_context(|| "button")?.serial;
seat.pointer.set_cursor(serial, None, 0, 0)?;
drag.attach(&win.tl, 100, 100)?;
source.set_actions(1)?;
dev.start_drag(&source, &win.surface, None, serial)?;
client.sync().await;
client.compare_screenshot("1", true).await?;
drop(click);
client.sync().await;
client.compare_screenshot("2", true).await?;
Ok(())
}

Binary file not shown.

Binary file not shown.