it: test output transforms
This commit is contained in:
parent
c6b34550d8
commit
221a398abe
6 changed files with 49 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ use {
|
|||
},
|
||||
input::{InputDevice, Seat},
|
||||
keyboard::{Keymap, ModifiedKeySym},
|
||||
video::Connector,
|
||||
video::{Connector, Transform},
|
||||
Axis, Direction,
|
||||
},
|
||||
std::{cell::Cell, ops::Deref, ptr, rc::Rc},
|
||||
|
|
@ -260,6 +260,13 @@ impl TestConfig {
|
|||
scale,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_output_transform(&self, output: &OutputNode, transform: Transform) -> TestResult {
|
||||
self.send(ClientMessage::ConnectorSetTransform {
|
||||
connector: Connector(output.global.connector.connector.id().raw() as _),
|
||||
transform,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestConfig {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ impl TestCompositor {
|
|||
server,
|
||||
destroyed: Cell::new(false),
|
||||
preferred_buffer_scale: Rc::new(Default::default()),
|
||||
preferred_buffer_transform: Rc::new(Default::default()),
|
||||
});
|
||||
self.tran.add_obj(surface.clone())?;
|
||||
Ok(surface)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ pub struct TestSurface {
|
|||
pub server: Rc<WlSurface>,
|
||||
pub destroyed: Cell<bool>,
|
||||
pub preferred_buffer_scale: TEEH<i32>,
|
||||
pub preferred_buffer_transform: TEEH<u32>,
|
||||
}
|
||||
|
||||
impl TestSurface {
|
||||
|
|
@ -66,6 +67,15 @@ impl TestSurface {
|
|||
self.preferred_buffer_scale.push(ev.factor);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_preferred_buffer_transform(
|
||||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), TestError> {
|
||||
let ev = PreferredBufferTransform::parse_full(parser)?;
|
||||
self.preferred_buffer_transform.push(ev.transform);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestSurface {
|
||||
|
|
@ -80,6 +90,7 @@ test_object! {
|
|||
ENTER => handle_enter,
|
||||
LEAVE => handle_leave,
|
||||
PREFERRED_BUFFER_SCALE => handle_preferred_buffer_scale,
|
||||
PREFERRED_BUFFER_TRANSFORM => handle_preferred_buffer_transform,
|
||||
}
|
||||
|
||||
impl TestObject for TestSurface {}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ mod t0022_toplevel_suspended;
|
|||
mod t0023_xdg_activation;
|
||||
mod t0024_foreign_toplevel_list;
|
||||
mod t0025_dnd_focus_change;
|
||||
mod t0026_output_transform;
|
||||
|
||||
pub trait TestCase: Sync {
|
||||
fn name(&self) -> &'static str;
|
||||
|
|
@ -100,5 +101,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
|
|||
t0023_xdg_activation,
|
||||
t0024_foreign_toplevel_list,
|
||||
t0025_dnd_focus_change,
|
||||
t0026_output_transform,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
27
src/it/tests/t0026_output_transform.rs
Normal file
27
src/it/tests/t0026_output_transform.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use {
|
||||
crate::it::{test_error::TestResult, testrun::TestRun},
|
||||
jay_config::video::Transform,
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
testcase!();
|
||||
|
||||
async fn test(run: Rc<TestRun>) -> TestResult {
|
||||
let ds = run.create_default_setup().await?;
|
||||
|
||||
run.cfg
|
||||
.set_output_transform(&ds.output, Transform::FlipRotate90)?;
|
||||
|
||||
let client = run.create_client().await?;
|
||||
let win = client.create_window().await?;
|
||||
|
||||
let transform = win.surface.preferred_buffer_transform.expect()?;
|
||||
|
||||
win.map2().await?;
|
||||
|
||||
tassert_eq!(transform.next()?, 5);
|
||||
|
||||
client.compare_screenshot("1", false).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
BIN
src/it/tests/t0026_output_transform/screenshot_1.qoi
Normal file
BIN
src/it/tests/t0026_output_transform/screenshot_1.qoi
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue