test(wm): toggle monocle on nonexistent container

Created a test to test toggle monocle when a container doesn't exist in
the monitor. The test ensures that we receive an error when attempting
to call toggle monocle when a monitor doesn't contain a container.
This commit is contained in:
Jerry Kingsbury
2025-06-03 17:10:46 -05:00
committed by LGUG2Z
parent aae9338f66
commit 7e87e83189

View File

@@ -5905,6 +5905,34 @@ mod tests {
}
}
#[test]
fn test_toggle_monocle_nonexistent_container() {
let (mut wm, _context) = setup_window_manager();
{
// Create a monitor
let m = monitor::new(
0,
Rect::default(),
Rect::default(),
"TestMonitor".to_string(),
"TestDevice".to_string(),
"TestDeviceID".to_string(),
Some("TestMonitorID".to_string()),
);
// Add monitor to the window manager
wm.monitors_mut().push_back(m);
}
// Should return an error when trying to toggle monocle on a non-existent container
let result = wm.toggle_monocle();
assert!(
result.is_err(),
"Expected an error when trying to toggle monocle on a non-existent container"
);
}
#[test]
fn test_ensure_named_workspace_for_monitor() {
let (mut wm, _context) = setup_window_manager();