test(monitor): remove nonexistent workspace

Created a test for moving a workspace that doesn't exist. The test
attempts to remove a workspace that doesn't exist and checks to ensure
the removed_workspace variable is None.
This commit is contained in:
Jerry Kingsbury
2025-05-02 17:10:32 -05:00
committed by LGUG2Z
parent 70f561e6ac
commit 53c38e157f

View File

@@ -631,6 +631,25 @@ mod tests {
assert_eq!(m.workspaces().len(), 0);
}
#[test]
fn test_remove_nonexistent_workspace() {
let mut m = Monitor::new(
0,
Rect::default(),
Rect::default(),
"TestMonitor".to_string(),
"TestDevice".to_string(),
"TestDeviceID".to_string(),
Some("TestMonitorID".to_string()),
);
// Try to remove a workspace that doesn't exist
let removed_workspace = m.remove_workspace_by_idx(1);
// Should return None since there is no workspace at index 1
assert!(removed_workspace.is_none());
}
#[test]
fn test_focus_workspace() {
let mut m = Monitor::new(