Merge pull request #241 from thmasq/main

Split keyboard_focus_stack test into global and visible variants
This commit is contained in:
Ottatop 2024-05-21 11:25:03 -05:00 committed by GitHub
commit 4095abadf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -318,6 +318,7 @@ mod output {
}
mod handle {
use pinnacle::window::window_state::WindowId;
use pinnacle_api::output::Transform;
use super::*;
@ -361,7 +362,6 @@ mod output {
})
}
// FIXME: split this into keyboard_focus_stack and keyboard_focus_stack_visible tests
#[tokio::main]
#[self::test]
async fn keyboard_focus_stack() -> anyhow::Result<()> {
@ -400,6 +400,59 @@ mod output {
assert!(focus_stack[2].id() == 2);
assert!(focus_stack[3].id() == 3);
assert!(focus_stack[4].id() == 4);
})?;
// Terminate all windows related to this test
run_rust(|api| {
api.tag.get("1").unwrap().switch_to();
let focus_stack = api.output.get_focused().unwrap().keyboard_focus_stack();
focus_stack[0].close();
focus_stack[1].close();
focus_stack[2].close();
focus_stack[3].close();
focus_stack[4].close();
api.tag.remove(api.tag.get_all());
WindowId::reset();
})?;
Ok(())
})
}
#[tokio::main]
#[self::test]
async fn keyboard_focus_stack_visible() -> anyhow::Result<()> {
test_api(|_sender| {
setup_rust(|api| {
api.output.setup([
OutputSetup::new_with_matcher(|_| true).with_tags(["1", "2", "3"])
]);
});
sleep_secs(1);
run_rust(|api| {
api.tag.get("1").unwrap().switch_to();
api.process.spawn(["foot"]);
api.process.spawn(["foot"]);
api.process.spawn(["foot"]);
})?;
sleep_secs(1);
run_rust(|api| {
api.tag.get("2").unwrap().switch_to();
api.process.spawn(["foot"]);
api.process.spawn(["foot"]);
})?;
sleep_secs(1);
run_rust(|api| {
api.tag.get("1").unwrap().switch_to();
let focus_stack = api
.output
@ -423,6 +476,22 @@ mod output {
assert!(focus_stack[1].id() == 4);
})?;
// Terminate all windows related to this test
run_rust(|api| {
api.tag.get("1").unwrap().switch_to();
let focus_stack = api.output.get_focused().unwrap().keyboard_focus_stack();
focus_stack[0].close();
focus_stack[1].close();
focus_stack[2].close();
focus_stack[3].close();
focus_stack[4].close();
api.tag.remove(api.tag.get_all());
WindowId::reset();
})?;
Ok(())
})
}