platform.rs

  1use crate::{DisplayId, Executor, Platform, PlatformTextSystem, TestDispatcher};
  2use rand::prelude::*;
  3use std::sync::Arc;
  4
  5pub struct TestPlatform {
  6    executor: Executor,
  7}
  8
  9impl TestPlatform {
 10    pub fn new(seed: u64) -> Self {
 11        let rng = StdRng::seed_from_u64(seed);
 12        TestPlatform {
 13            executor: Executor::new(Arc::new(TestDispatcher::new(rng))),
 14        }
 15    }
 16}
 17
 18// todo!("implement out what our tests needed in GPUI 1")
 19impl Platform for TestPlatform {
 20    fn executor(&self) -> Executor {
 21        self.executor.clone()
 22    }
 23
 24    fn text_system(&self) -> Arc<dyn PlatformTextSystem> {
 25        Arc::new(crate::platform::mac::MacTextSystem::new())
 26    }
 27
 28    fn run(&self, _on_finish_launching: Box<dyn FnOnce()>) {
 29        unimplemented!()
 30    }
 31
 32    fn quit(&self) {
 33        unimplemented!()
 34    }
 35
 36    fn restart(&self) {
 37        unimplemented!()
 38    }
 39
 40    fn activate(&self, _ignoring_other_apps: bool) {
 41        unimplemented!()
 42    }
 43
 44    fn hide(&self) {
 45        unimplemented!()
 46    }
 47
 48    fn hide_other_apps(&self) {
 49        unimplemented!()
 50    }
 51
 52    fn unhide_other_apps(&self) {
 53        unimplemented!()
 54    }
 55
 56    fn displays(&self) -> Vec<std::rc::Rc<dyn crate::PlatformDisplay>> {
 57        unimplemented!()
 58    }
 59
 60    fn display(&self, _id: DisplayId) -> Option<std::rc::Rc<dyn crate::PlatformDisplay>> {
 61        unimplemented!()
 62    }
 63
 64    fn main_window(&self) -> Option<crate::AnyWindowHandle> {
 65        unimplemented!()
 66    }
 67
 68    fn open_window(
 69        &self,
 70        _handle: crate::AnyWindowHandle,
 71        _options: crate::WindowOptions,
 72    ) -> Box<dyn crate::PlatformWindow> {
 73        unimplemented!()
 74    }
 75
 76    fn set_display_link_output_callback(
 77        &self,
 78        _display_id: DisplayId,
 79        _callback: Box<dyn FnMut(&crate::VideoTimestamp, &crate::VideoTimestamp)>,
 80    ) {
 81        unimplemented!()
 82    }
 83
 84    fn start_display_link(&self, _display_id: DisplayId) {
 85        unimplemented!()
 86    }
 87
 88    fn stop_display_link(&self, _display_id: DisplayId) {
 89        unimplemented!()
 90    }
 91
 92    fn open_url(&self, _url: &str) {
 93        unimplemented!()
 94    }
 95
 96    fn on_open_urls(&self, _callback: Box<dyn FnMut(Vec<String>)>) {
 97        unimplemented!()
 98    }
 99
100    fn prompt_for_paths(
101        &self,
102        _options: crate::PathPromptOptions,
103    ) -> futures::channel::oneshot::Receiver<Option<Vec<std::path::PathBuf>>> {
104        unimplemented!()
105    }
106
107    fn prompt_for_new_path(
108        &self,
109        _directory: &std::path::Path,
110    ) -> futures::channel::oneshot::Receiver<Option<std::path::PathBuf>> {
111        unimplemented!()
112    }
113
114    fn reveal_path(&self, _path: &std::path::Path) {
115        unimplemented!()
116    }
117
118    fn on_become_active(&self, _callback: Box<dyn FnMut()>) {
119        unimplemented!()
120    }
121
122    fn on_resign_active(&self, _callback: Box<dyn FnMut()>) {
123        unimplemented!()
124    }
125
126    fn on_quit(&self, _callback: Box<dyn FnMut()>) {
127        unimplemented!()
128    }
129
130    fn on_reopen(&self, _callback: Box<dyn FnMut()>) {
131        unimplemented!()
132    }
133
134    fn on_event(&self, _callback: Box<dyn FnMut(crate::InputEvent) -> bool>) {
135        unimplemented!()
136    }
137
138    fn os_name(&self) -> &'static str {
139        unimplemented!()
140    }
141
142    fn os_version(&self) -> anyhow::Result<crate::SemanticVersion> {
143        unimplemented!()
144    }
145
146    fn app_version(&self) -> anyhow::Result<crate::SemanticVersion> {
147        unimplemented!()
148    }
149
150    fn app_path(&self) -> anyhow::Result<std::path::PathBuf> {
151        unimplemented!()
152    }
153
154    fn local_timezone(&self) -> time::UtcOffset {
155        unimplemented!()
156    }
157
158    fn path_for_auxiliary_executable(&self, _name: &str) -> anyhow::Result<std::path::PathBuf> {
159        unimplemented!()
160    }
161
162    fn set_cursor_style(&self, _style: crate::CursorStyle) {
163        unimplemented!()
164    }
165
166    fn should_auto_hide_scrollbars(&self) -> bool {
167        unimplemented!()
168    }
169
170    fn write_to_clipboard(&self, _item: crate::ClipboardItem) {
171        unimplemented!()
172    }
173
174    fn read_from_clipboard(&self) -> Option<crate::ClipboardItem> {
175        unimplemented!()
176    }
177
178    fn write_credentials(
179        &self,
180        _url: &str,
181        _username: &str,
182        _password: &[u8],
183    ) -> anyhow::Result<()> {
184        unimplemented!()
185    }
186
187    fn read_credentials(&self, _url: &str) -> anyhow::Result<Option<(String, Vec<u8>)>> {
188        unimplemented!()
189    }
190
191    fn delete_credentials(&self, _url: &str) -> anyhow::Result<()> {
192        unimplemented!()
193    }
194}