mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-29 04:40:04 -04:00
winit-appkit: fix tests on systems without MonitorId(1)
Use `CGMainDisplayID` instead of `1` to make tests pass on systems without `MonitorId(1)`.
This commit is contained in:
@@ -352,8 +352,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uuid_stable() {
|
fn uuid_stable() {
|
||||||
let handle_a = MonitorHandle::new(1).unwrap();
|
let primary_id = CGMainDisplayID();
|
||||||
let handle_b = MonitorHandle::new(1).unwrap();
|
|
||||||
|
let handle_a = MonitorHandle::new(primary_id).unwrap();
|
||||||
|
let handle_b = MonitorHandle::new(primary_id).unwrap();
|
||||||
assert_eq!(handle_a, handle_b);
|
assert_eq!(handle_a, handle_b);
|
||||||
assert_eq!(handle_a.display_id(), handle_b.display_id());
|
assert_eq!(handle_a.display_id(), handle_b.display_id());
|
||||||
assert_eq!(handle_a.uuid(), handle_b.uuid());
|
assert_eq!(handle_a.uuid(), handle_b.uuid());
|
||||||
@@ -368,8 +370,10 @@ mod tests {
|
|||||||
/// Test the MonitorHandle::new fallback.
|
/// Test the MonitorHandle::new fallback.
|
||||||
#[test]
|
#[test]
|
||||||
fn monitorhandle_from_zero() {
|
fn monitorhandle_from_zero() {
|
||||||
|
let primary_id = CGMainDisplayID();
|
||||||
|
|
||||||
let handle0 = MonitorHandle::new(0).unwrap();
|
let handle0 = MonitorHandle::new(0).unwrap();
|
||||||
let handle1 = MonitorHandle::new(1).unwrap();
|
let handle1 = MonitorHandle::new(primary_id).unwrap();
|
||||||
assert_eq!(handle0, handle1);
|
assert_eq!(handle0, handle1);
|
||||||
assert_eq!(handle0.display_id(), handle1.display_id());
|
assert_eq!(handle0.display_id(), handle1.display_id());
|
||||||
assert_eq!(handle0.uuid(), handle1.uuid());
|
assert_eq!(handle0.uuid(), handle1.uuid());
|
||||||
|
|||||||
Reference in New Issue
Block a user