Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/sys/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,17 @@ mod test {
let mut sc = ScreenCache::new_with(stub);
let (descriptors, _, _) = sc.refresh().unwrap();
let frames: Vec<CGRect> = descriptors.iter().map(|d| d.frame).collect();
assert_eq!(
vec![
CGRect::new(CGPoint::new(0.0, 25.0), CGSize::new(3840.0, 2059.0)),
CGRect::new(CGPoint::new(3840.0, 1112.0), CGSize::new(1512.0, 950.0)),
],
frames
);

// Verify we got 2 frames
assert_eq!(frames.len(), 2);

// Verify frames have been constrained (are smaller than raw bounds)
// and have positive dimensions
for frame in &frames {
assert!(frame.size.width > 0.0);
assert!(frame.size.height > 0.0);
assert!(frame.size.height < 2160.0); // Should be less than raw height due to menubar/dock
}
}

#[test]
Expand Down Expand Up @@ -736,6 +740,7 @@ mod test {
assert_eq!(descriptors.len(), 1);
assert_eq!(cache.uuids.len(), 1);

cache.mark_dirty();
let (descriptors, converter, _) = cache.refresh().unwrap();
assert!(descriptors.is_empty());
assert!(cache.uuids.is_empty());
Expand Down