windows: Fix tests on Windows (#22616)

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla.c.maki@gmail.com>
This commit is contained in:
张小白 2025-02-05 22:30:09 +08:00 committed by GitHub
parent c252b5db16
commit 74c4dbd237
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 1540 additions and 856 deletions

View file

@ -1,12 +1,15 @@
pub mod editor_lsp_test_context;
pub mod editor_test_context;
use std::sync::LazyLock;
use crate::{
display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint},
DisplayPoint, Editor, EditorMode, FoldPlaceholder, MultiBuffer,
};
use gpui::{
AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels, Window,
font, AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels,
Window,
};
use project::Project;
use util::test::{marked_text_offsets, marked_text_ranges};
@ -19,6 +22,22 @@ fn init_logger() {
}
}
pub fn test_font() -> Font {
static TEST_FONT: LazyLock<Font> = LazyLock::new(|| {
#[cfg(not(target_os = "windows"))]
{
font("Helvetica")
}
#[cfg(target_os = "windows")]
{
font("Courier New")
}
});
TEST_FONT.clone()
}
// Returns a snapshot from text containing '|' character markers with the markers removed, and DisplayPoints for each one.
pub fn marked_display_snapshot(
text: &str,