mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-24 01:28:39 +02:00
test(wm): remove nonexistent window from container
Created a test that tests removing a nonexistent window from a container. The test creates a monitor containing an empty container and attempts to remove a window from the container. The test ensures that the result is an error when calling remove_window_from_container.
This commit is contained in:
@@ -4773,6 +4773,44 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_remove_nonexistent_window_from_container() {
|
||||||
|
let (mut wm, _context) = setup_window_manager();
|
||||||
|
|
||||||
|
{
|
||||||
|
// Create a first monitor
|
||||||
|
let mut m = monitor::new(
|
||||||
|
0,
|
||||||
|
Rect::default(),
|
||||||
|
Rect::default(),
|
||||||
|
"TestMonitor1".to_string(),
|
||||||
|
"TestDevice1".to_string(),
|
||||||
|
"TestDeviceID1".to_string(),
|
||||||
|
Some("TestMonitorID1".to_string()),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create a container
|
||||||
|
let container = Container::default();
|
||||||
|
|
||||||
|
// Should have 3 windows in the container
|
||||||
|
assert_eq!(container.windows().len(), 0);
|
||||||
|
|
||||||
|
// Add the container to a workspace
|
||||||
|
let workspace = m.focused_workspace_mut().unwrap();
|
||||||
|
workspace.add_container_to_back(container);
|
||||||
|
|
||||||
|
// Add monitor to the window manager
|
||||||
|
wm.monitors_mut().push_back(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should receive an error when trying to remove a window from an empty container
|
||||||
|
let result = wm.remove_window_from_container();
|
||||||
|
assert!(
|
||||||
|
result.is_err(),
|
||||||
|
"Expected an error when trying to remove a window from an empty container"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn cycle_container_window_in_direction() {
|
fn cycle_container_window_in_direction() {
|
||||||
let (mut wm, _context) = setup_window_manager();
|
let (mut wm, _context) = setup_window_manager();
|
||||||
|
|||||||
Reference in New Issue
Block a user