Use NoopTextSystem during tests (#28607)

This should allow tests to be more similar across platforms.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-04-11 16:26:41 -06:00 committed by GitHub
parent 97a9a5de10
commit 5994ac5cec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 97 additions and 54 deletions

View file

@ -1742,7 +1742,6 @@ pub mod tests {
}
}
#[cfg(target_os = "macos")]
#[gpui::test(retries = 5)]
async fn test_soft_wraps(cx: &mut gpui::TestAppContext) {
cx.background_executor
@ -1760,7 +1759,7 @@ pub mod tests {
editor.update(cx, |editor, _cx| editor.text_layout_details(window));
let font_size = px(12.0);
let wrap_width = Some(px(64.));
let wrap_width = Some(px(96.));
let text = "one two three four five\nsix seven eight";
let buffer = MultiBuffer::build_simple(text, cx);
@ -2411,8 +2410,6 @@ pub mod tests {
}
}
// todo(linux) fails due to pixel differences in text rendering
#[cfg(target_os = "macos")]
#[gpui::test]
async fn test_chunks_with_soft_wrapping(cx: &mut gpui::TestAppContext) {
cx.background_executor

View file

@ -2277,7 +2277,6 @@ mod tests {
}
}
#[cfg(target_os = "macos")]
#[gpui::test]
fn test_blocks_on_wrapped_lines(cx: &mut gpui::TestAppContext) {
cx.update(init_test);
@ -2292,7 +2291,7 @@ mod tests {
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
let (_, wraps_snapshot) = cx.update(|cx| {
WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), Some(px(60.)), cx)
WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), Some(px(90.)), cx)
});
let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1);

View file

@ -1316,8 +1316,6 @@ fn test_move_cursor(cx: &mut TestAppContext) {
});
}
// TODO: Re-enable this test
#[cfg(target_os = "macos")]
#[gpui::test]
fn test_move_cursor_multibyte(cx: &mut TestAppContext) {
init_test(cx, |_| {});

View file

@ -6638,7 +6638,7 @@ impl Element for EditorElement {
}
};
if editor.set_wrap_width(wrap_width, cx) {
if editor.set_wrap_width(wrap_width.map(|w| w.ceil()), cx) {
editor.snapshot(window, cx)
} else {
snapshot