test(wm): float nonexistent window

Created a test to test trying to float a nonexistent window. The test
ensures that we receive an error when trying to float a window in an
empty container
This commit is contained in:
Jerry Kingsbury
2025-05-28 16:51:18 -05:00
committed by LGUG2Z
parent c76846ac63
commit f68a709f1d

View File

@@ -5548,6 +5548,40 @@ mod tests {
}
}
#[test]
fn test_float_nonexistent_window() {
let (mut wm, _context) = setup_window_manager();
{
let mut m = monitor::new(
0,
Rect::default(),
Rect::default(),
"TestMonitor".to_string(),
"TestDevice".to_string(),
"TestDeviceID".to_string(),
Some("TestMonitorID".to_string()),
);
// Add another workspace
let new_workspace_index = m.new_workspace_idx();
m.focus_workspace(new_workspace_index).unwrap();
// Should have 2 workspaces
assert_eq!(m.workspaces().len(), 2);
// Add monitor to window manager
wm.monitors_mut().push_back(m);
}
// Should return an error when trying to float a non-existent window
let result = wm.float_window();
assert!(
result.is_err(),
"Expected an error when trying to float a non-existent window"
);
}
#[test]
fn test_maximize_and_unmaximize_window() {
let (mut wm, _context) = setup_window_manager();