Enable linux tests (#12493)

Note:
- We have disabled all tests that rely on Postgres in the Linux CI. We
only really need to test these once, and as macOS is our team's primary
platform, we'll only enable them on macOS for local reproduction.
- We have disabled all tests that rely on the font metrics. We
standardized on Zed Mono in many fonts, but our CoreText Text System and
Cosmic Text System proved to be very different in effect. We should
revisit if we decide to standardize our text system across platforms
(e.g. using Harfbuzz everywhere)
- Extended the condition timeout significantly. Our CI machines are slow
enough that this is causing spurious errors in random tests.

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Mikayla Maki
2024-06-13 16:38:53 -07:00
committed by GitHub
co-authored by Conrad Irwin
parent 066cdc2297
commit 10d3ad4e33
22 changed files with 107 additions and 52 deletions
+12 -12
View File
@@ -1111,14 +1111,11 @@ impl ToDisplayPoint for Anchor {
#[cfg(test)]
pub mod tests {
use super::*;
use crate::{
movement,
test::{editor_test_context::EditorTestContext, marked_display_snapshot},
};
use crate::{movement, test::marked_display_snapshot};
use gpui::{div, font, observe, px, AppContext, BorrowAppContext, Context, Element, Hsla};
use language::{
language_settings::{AllLanguageSettings, AllLanguageSettingsContent},
Buffer, Language, LanguageConfig, LanguageMatcher, SelectionGoal,
Buffer, Language, LanguageConfig, LanguageMatcher,
};
use project::Project;
use rand::{prelude::*, Rng};
@@ -1393,6 +1390,7 @@ pub mod tests {
}
}
#[cfg(target_os = "macos")]
#[gpui::test(retries = 5)]
async fn test_soft_wraps(cx: &mut gpui::TestAppContext) {
cx.background_executor
@@ -1401,7 +1399,7 @@ pub mod tests {
init_test(cx, |_| {});
});
let mut cx = EditorTestContext::new(cx).await;
let mut cx = crate::test::editor_test_context::EditorTestContext::new(cx).await;
let editor = cx.editor.clone();
let window = cx.window;
@@ -1457,39 +1455,39 @@ pub mod tests {
movement::up(
&snapshot,
DisplayPoint::new(DisplayRow(1), 10),
SelectionGoal::None,
language::SelectionGoal::None,
false,
&text_layout_details,
),
(
DisplayPoint::new(DisplayRow(0), 7),
SelectionGoal::HorizontalPosition(x.0)
language::SelectionGoal::HorizontalPosition(x.0)
)
);
assert_eq!(
movement::down(
&snapshot,
DisplayPoint::new(DisplayRow(0), 7),
SelectionGoal::HorizontalPosition(x.0),
language::SelectionGoal::HorizontalPosition(x.0),
false,
&text_layout_details
),
(
DisplayPoint::new(DisplayRow(1), 10),
SelectionGoal::HorizontalPosition(x.0)
language::SelectionGoal::HorizontalPosition(x.0)
)
);
assert_eq!(
movement::down(
&snapshot,
DisplayPoint::new(DisplayRow(1), 10),
SelectionGoal::HorizontalPosition(x.0),
language::SelectionGoal::HorizontalPosition(x.0),
false,
&text_layout_details
),
(
DisplayPoint::new(DisplayRow(2), 4),
SelectionGoal::HorizontalPosition(x.0)
language::SelectionGoal::HorizontalPosition(x.0)
)
);
@@ -1679,6 +1677,8 @@ 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) {
use unindent::Unindent as _;
+8 -1
View File
@@ -1157,7 +1157,7 @@ mod tests {
use super::*;
use crate::display_map::inlay_map::InlayMap;
use crate::display_map::{fold_map::FoldMap, tab_map::TabMap, wrap_map::WrapMap};
use gpui::{div, font, px, Element};
use gpui::{div, font, px, AssetSource, Element};
use multi_buffer::MultiBuffer;
use rand::prelude::*;
use settings::SettingsStore;
@@ -1452,6 +1452,7 @@ mod tests {
}
}
#[cfg(target_os = "macos")]
#[gpui::test]
fn test_blocks_on_wrapped_lines(cx: &mut gpui::TestAppContext) {
cx.update(|cx| init_test(cx));
@@ -1940,6 +1941,12 @@ mod tests {
let settings = SettingsStore::test(cx);
cx.set_global(settings);
theme::init(theme::LoadThemes::JustBase, cx);
cx.text_system()
.add_fonts(vec![assets::Assets
.load("fonts/zed-mono/zed-mono-extended.ttf")
.unwrap()
.unwrap()])
.unwrap();
}
impl TransformBlock {
+3 -1
View File
@@ -2746,7 +2746,9 @@ impl Editor {
Some(Selection { start, end, .. }) => start != end,
None => false,
};
pending_nonempty_selection || self.columnar_selection_tail.is_some()
pending_nonempty_selection
|| (self.columnar_selection_tail.is_some() && self.selections.disjoint.len() > 1)
}
pub fn has_pending_selection(&self) -> bool {
+2
View File
@@ -936,6 +936,8 @@ 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, |_| {});
+2 -2
View File
@@ -586,7 +586,7 @@ impl EditorElement {
editor.handle_click_hovered_link(point, event.modifiers, cx);
cx.stop_propagation();
} else if end_selection {
} else if end_selection && pending_nonempty_selections {
cx.stop_propagation();
} else if cfg!(target_os = "linux") && event.button == MouseButton::Middle {
if !text_hitbox.is_hovered(cx) || editor.read_only(cx) {
@@ -594,7 +594,7 @@ impl EditorElement {
}
#[cfg(target_os = "linux")]
if let Some(item) = cx.read_from_clipboard() {
if let Some(item) = cx.read_from_primary() {
let point_for_position =
position_map.point_for_position(text_hitbox.bounds, event.position);
let position = point_for_position.previous_valid;
+8 -6
View File
@@ -748,9 +748,13 @@ mod tests {
])))
});
cx.cx
.cx
.simulate_mouse_move(screen_coord.unwrap(), None, Modifiers::command_shift());
let modifiers = if cfg!(target_os = "macos") {
Modifiers::command_shift()
} else {
Modifiers::control_shift()
};
cx.simulate_mouse_move(screen_coord.unwrap(), None, modifiers);
requests.next().await;
cx.run_until_parked();
@@ -767,9 +771,7 @@ mod tests {
let variable = A;
"});
cx.cx
.cx
.simulate_click(screen_coord.unwrap(), Modifiers::command_shift());
cx.simulate_click(screen_coord.unwrap(), modifiers);
cx.assert_editor_state(indoc! {"
struct «Aˇ»;
+1 -1
View File
@@ -25,7 +25,7 @@ pub fn marked_display_snapshot(
let (unmarked_text, markers) = marked_text_offsets(text);
let font = Font {
family: "Courier".into(),
family: "Zed Mono".into(),
features: FontFeatures::default(),
weight: FontWeight::default(),
style: FontStyle::default(),