Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Make Window::on_next_frame work in tests

Max Brunsfeldf2faa70f7362
diff --git a/crates/gpui2/src/platform/mac/display_linker.rs b/crates/gpui2/src/platform/mac/display_linker.rs
index b63cf24e268..d8f5a675a58 100644
--- a/crates/gpui2/src/platform/mac/display_linker.rs
+++ b/crates/gpui2/src/platform/mac/display_linker.rs
@@ -7,6 +7,7 @@ use std::{
use crate::DisplayId;
use collections::HashMap;
use parking_lot::Mutex;
+pub use sys::CVSMPTETime as SmtpeTime;
pub use sys::CVTimeStamp as VideoTimestamp;
pub(crate) struct MacDisplayLinker {
@@ -153,7 +154,7 @@ mod sys {
kCVTimeStampTopField | kCVTimeStampBottomField;
#[repr(C)]
- #[derive(Clone, Copy)]
+ #[derive(Clone, Copy, Default)]
pub struct CVSMPTETime {
pub subframes: i16,
pub subframe_divisor: i16,
diff --git a/crates/gpui2/src/platform/test/platform.rs b/crates/gpui2/src/platform/test/platform.rs
index fa4b6e18c58..2cbc228c72b 100644
--- a/crates/gpui2/src/platform/test/platform.rs
+++ b/crates/gpui2/src/platform/test/platform.rs
@@ -147,18 +147,25 @@ impl Platform for TestPlatform {
fn set_display_link_output_callback(
&self,
_display_id: DisplayId,
- _callback: Box<dyn FnMut(&crate::VideoTimestamp, &crate::VideoTimestamp) + Send>,
+ mut callback: Box<dyn FnMut(&crate::VideoTimestamp, &crate::VideoTimestamp) + Send>,
) {
- unimplemented!()
- }
-
- fn start_display_link(&self, _display_id: DisplayId) {
- unimplemented!()
- }
-
- fn stop_display_link(&self, _display_id: DisplayId) {
- unimplemented!()
- }
+ let timestamp = crate::VideoTimestamp {
+ version: 0,
+ video_time_scale: 0,
+ video_time: 0,
+ host_time: 0,
+ rate_scalar: 0.0,
+ video_refresh_period: 0,
+ smpte_time: crate::SmtpeTime::default(),
+ flags: 0,
+ reserved: 0,
+ };
+ callback(&timestamp, &timestamp)
+ }
+
+ fn start_display_link(&self, _display_id: DisplayId) {}
+
+ fn stop_display_link(&self, _display_id: DisplayId) {}
fn open_url(&self, _url: &str) {
unimplemented!()