1
0
Fork 0
forked from wry/wry
wry/src/it/tests/t0015_scroll_partial.rs

54 lines
1.4 KiB
Rust

use {
crate::{
it::{test_error::TestResult, testrun::TestRun},
tree::ToplevelNodeBase,
},
std::rc::Rc,
};
testcase!();
async fn test(run: Rc<TestRun>) -> TestResult {
let ds = run.create_default_setup().await?;
ds.mouse.rel(1.0, 1.0);
let client = run.create_client().await?;
let dss = client.get_default_seat().await?;
let w_mono1 = client.create_window().await?;
w_mono1.map2().await?;
let w_mono2 = client.create_window().await?;
w_mono2.map2().await?;
run.cfg.set_mono(ds.seat.id(), true)?;
client.sync().await;
let container = w_mono2.tl.container_parent()?;
let pos = container.tl_data().pos.get();
let (tab_x, tab_y) = {
let tab_bar = container.tab_bar.borrow();
let Some(tab_bar) = tab_bar.as_ref() else {
bail!("no tab bar");
};
let w_mono1_title = &tab_bar.entries[0];
(
pos.x1() + w_mono1_title.x.get() + w_mono1_title.width.get() / 2,
pos.y1() + tab_bar.height / 2,
)
};
ds.mouse.abs(&ds.connector, tab_x as f64, tab_y as f64);
client.sync().await;
let enters = dss.kb.enter.expect()?;
ds.mouse.scroll_px(-14);
client.sync().await;
tassert!(enters.next().is_err());
ds.mouse.scroll_px(-1);
client.sync().await;
tassert!(enters.next().is_ok());
Ok(())
}