1
0
Fork 0
forked from wry/wry

wayland: implement alpha_modifier_v1

This commit is contained in:
Julian Orth 2024-03-18 19:18:30 +01:00
parent 131f0481e8
commit ff54a8ab96
37 changed files with 655 additions and 89 deletions

View file

@ -0,0 +1,56 @@
use {
crate::{
it::{test_error::TestResult, testrun::TestRun},
theme::Color,
},
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 win = client.create_window().await?;
win.set_color(255, 0, 0, 255);
win.map2().await?;
macro_rules! create_surface {
($buf:expr, $x:expr, $y:expr) => {{
let ss = client.comp.create_surface().await?;
let vp = client.viewporter.get_viewport(&ss)?;
vp.set_destination(100, 100)?;
ss.attach($buf.id)?;
ss.commit()?;
let alpha = client
.registry
.get_alpha_modifier()
.await?
.get_surface(&ss)?;
let sub = client.sub.get_subsurface(ss.id, win.surface.id).await?;
sub.set_desync()?;
sub.set_position($x, $y)?;
win.surface.commit()?;
(ss, alpha)
}};
}
let buf1 = client.spbm.create_buffer(Color::from_rgb(0, 255, 0))?;
let (ss1, alpha1) = create_surface!(&buf1, 0, 0);
let buf2 = client.shm.create_buffer(1, 1)?;
buf2.fill(Color::from_rgb(0, 255, 0));
let (ss2, alpha2) = create_surface!(&buf2.buffer, 100, 0);
client.compare_screenshot("1", false).await?;
alpha1.set_multiplier(0.5)?;
ss1.commit()?;
alpha2.set_multiplier(0.5)?;
ss2.commit()?;
client.compare_screenshot("2", false).await?;
Ok(())
}

Binary file not shown.

Binary file not shown.