mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 10:59:53 +00:00
Fix the tests
This commit is contained in:
parent
81e70905bb
commit
38da2a587a
2 changed files with 40 additions and 16 deletions
|
@ -1376,13 +1376,21 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let new_type_hint_part_hover_position = cx.update_editor(|editor, cx| {
|
let new_type_hint_part_hover_position = cx.update_editor(|editor, cx| {
|
||||||
let snapshot = editor.snapshot(cx);
|
let snapshot = editor.snapshot(cx);
|
||||||
|
let previous_valid = inlay_range.start.to_display_point(&snapshot);
|
||||||
|
let next_valid = inlay_range.end.to_display_point(&snapshot);
|
||||||
|
assert_eq!(previous_valid.row(), next_valid.row());
|
||||||
|
assert!(previous_valid.column() < next_valid.column());
|
||||||
|
let exact_unclipped = DisplayPoint::new(
|
||||||
|
previous_valid.row(),
|
||||||
|
previous_valid.column()
|
||||||
|
+ (entire_hint_label.find(new_type_label).unwrap() + new_type_label.len() / 2)
|
||||||
|
as u32,
|
||||||
|
);
|
||||||
PointForPosition {
|
PointForPosition {
|
||||||
previous_valid: inlay_range.start.to_display_point(&snapshot),
|
previous_valid,
|
||||||
next_valid: inlay_range.end.to_display_point(&snapshot),
|
next_valid,
|
||||||
exact_unclipped: inlay_range.end.to_display_point(&snapshot),
|
exact_unclipped,
|
||||||
column_overshoot_after_line_end: (entire_hint_label.find(new_type_label).unwrap()
|
column_overshoot_after_line_end: 0,
|
||||||
+ new_type_label.len() / 2)
|
|
||||||
as u32,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cx.update_editor(|editor, cx| {
|
cx.update_editor(|editor, cx| {
|
||||||
|
@ -1504,13 +1512,21 @@ mod tests {
|
||||||
|
|
||||||
let struct_hint_part_hover_position = cx.update_editor(|editor, cx| {
|
let struct_hint_part_hover_position = cx.update_editor(|editor, cx| {
|
||||||
let snapshot = editor.snapshot(cx);
|
let snapshot = editor.snapshot(cx);
|
||||||
|
let previous_valid = inlay_range.start.to_display_point(&snapshot);
|
||||||
|
let next_valid = inlay_range.end.to_display_point(&snapshot);
|
||||||
|
assert_eq!(previous_valid.row(), next_valid.row());
|
||||||
|
assert!(previous_valid.column() < next_valid.column());
|
||||||
|
let exact_unclipped = DisplayPoint::new(
|
||||||
|
previous_valid.row(),
|
||||||
|
previous_valid.column()
|
||||||
|
+ (entire_hint_label.find(struct_label).unwrap() + struct_label.len() / 2)
|
||||||
|
as u32,
|
||||||
|
);
|
||||||
PointForPosition {
|
PointForPosition {
|
||||||
previous_valid: inlay_range.start.to_display_point(&snapshot),
|
previous_valid,
|
||||||
next_valid: inlay_range.end.to_display_point(&snapshot),
|
next_valid,
|
||||||
exact_unclipped: inlay_range.end.to_display_point(&snapshot),
|
exact_unclipped,
|
||||||
column_overshoot_after_line_end: (entire_hint_label.find(struct_label).unwrap()
|
column_overshoot_after_line_end: 0,
|
||||||
+ struct_label.len() / 2)
|
|
||||||
as u32,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cx.update_editor(|editor, cx| {
|
cx.update_editor(|editor, cx| {
|
||||||
|
|
|
@ -1170,11 +1170,19 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let hint_hover_position = cx.update_editor(|editor, cx| {
|
let hint_hover_position = cx.update_editor(|editor, cx| {
|
||||||
let snapshot = editor.snapshot(cx);
|
let snapshot = editor.snapshot(cx);
|
||||||
|
let previous_valid = inlay_range.start.to_display_point(&snapshot);
|
||||||
|
let next_valid = inlay_range.end.to_display_point(&snapshot);
|
||||||
|
assert_eq!(previous_valid.row(), next_valid.row());
|
||||||
|
assert!(previous_valid.column() < next_valid.column());
|
||||||
|
let exact_unclipped = DisplayPoint::new(
|
||||||
|
previous_valid.row(),
|
||||||
|
previous_valid.column() + (hint_label.len() / 2) as u32,
|
||||||
|
);
|
||||||
PointForPosition {
|
PointForPosition {
|
||||||
previous_valid: inlay_range.start.to_display_point(&snapshot),
|
previous_valid,
|
||||||
next_valid: inlay_range.end.to_display_point(&snapshot),
|
next_valid,
|
||||||
exact_unclipped: inlay_range.end.to_display_point(&snapshot),
|
exact_unclipped,
|
||||||
column_overshoot_after_line_end: (hint_label.len() / 2) as u32,
|
column_overshoot_after_line_end: 0,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Press cmd to trigger highlight
|
// Press cmd to trigger highlight
|
||||||
|
|
Loading…
Reference in a new issue