mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-24 18:31:22 +01:00
test(wm): cycle windows in an empty container
Created a test to test cycling windows in an empty container. The test ensures that when attempting to cycle windows in an empty container it will push out an error.
This commit is contained in:
@@ -4880,6 +4880,44 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cycle_nonexistent_windows() {
|
||||
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 return an error when trying to cycle through windows in an empty container
|
||||
let result = wm.cycle_container_window_in_direction(CycleDirection::Next);
|
||||
assert!(
|
||||
result.is_err(),
|
||||
"Expected an error when cycling through windows in an empty container"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cycle_container_window_index_in_direction() {
|
||||
let (mut wm, _context) = setup_window_manager();
|
||||
|
||||
Reference in New Issue
Block a user