Просмотр исходного кода

Handle unsupported display deferrals in the HLE test

(cherry picked from commit efe102edac86f365a9951f3c92228413cbee8e46)
EatCodeSleep2 2 дней назад
Родитель
Сommit
3f497dafc1
1 измененных файлов с 9 добавлено и 6 удалено
  1. 9 6
      crates/victory-hle/src/modules/display.rs

+ 9 - 6
crates/victory-hle/src/modules/display.rs

@@ -185,11 +185,14 @@ mod tests {
         type Acquire = extern "system" fn(This, *mut *mut c_void) -> HRESULT;
         type Close = extern "system" fn(This, *mut c_void);
         let mut handle = std::ptr::null_mut();
-        assert_eq!(
-            method::<Acquire>(&SHELL_OBJECT, 0x20)(&SHELL_OBJECT, &mut handle),
-            S_OK
-        );
-        assert!(!handle.is_null());
-        method::<Close>(&SHELL_OBJECT, 0x28)(&SHELL_OBJECT, handle);
+        match method::<Acquire>(&SHELL_OBJECT, 0x20)(&SHELL_OBJECT, &mut handle) {
+            S_OK => {
+                assert!(!handle.is_null());
+                method::<Close>(&SHELL_OBJECT, 0x28)(&SHELL_OBJECT, handle);
+            }
+            // Windows can reject display power requests on some hosts.
+            NOT_SUPPORTED => assert!(handle.is_null()),
+            hr => panic!("unexpected display deferral HRESULT {:#010x}", hr as u32),
+        }
     }
 }