Add deterministic TestDispatcher

Co-Authored-By: Conrad Irwin <conrad@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-10-25 17:33:16 +02:00
parent 437d147935
commit 3566d920c5
10 changed files with 372 additions and 198 deletions

View file

@ -1,7 +1,7 @@
mod keystroke;
#[cfg(target_os = "macos")]
mod mac;
#[cfg(any(test, feature = "test"))]
#[cfg(any(test, feature = "test-support"))]
mod test;
use crate::{
@ -30,7 +30,7 @@ use std::{
pub use keystroke::*;
#[cfg(target_os = "macos")]
pub use mac::*;
#[cfg(any(test, feature = "test"))]
#[cfg(any(test, feature = "test-support"))]
pub use test::*;
pub use time::UtcOffset;
@ -161,6 +161,9 @@ pub trait PlatformDispatcher: Send + Sync {
fn dispatch(&self, runnable: Runnable);
fn dispatch_on_main_thread(&self, runnable: Runnable);
fn dispatch_after(&self, duration: Duration, runnable: Runnable);
fn poll(&self) -> bool;
#[cfg(any(test, feature = "test-support"))]
fn advance_clock(&self, duration: Duration);
}
pub trait PlatformTextSystem: Send + Sync {