CI · the crate's tests and the gallery on Linux, Windows and macOS, arm64 and x86_64; tests type the platform's secondary key

This commit is contained in:
ZacharyZhang-NY committed 2026-10-04 00:00:43 -04:00
1 parent bbe45a4bcd
commit 59c73f18f2
10 files changed
+45 -30

No files matched your search

+15
View File
@@ -18,6 +18,21 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: scripts/check.sh
platforms:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.95"
- uses: Swatinem/rust-cache@v2
- run: cargo test --lib --features test-support --quiet
- run: cargo build --example gallery
site:
runs-on: ubuntu-latest
defaults:
+1 -1
View File
@@ -269,7 +269,7 @@ fn a_card_waits_for_a_whole_code_and_a_name(cx: &mut TestAppContext) {
tab(3, cx);
write("3", cx);
tab(4, cx);
tap("cmd-a", cx);
tap("secondary-a", cx);
tap("backspace", cx);
tap("enter", cx);
assert!(said(&host, cx).is_empty(), "no name on the card");
+2 -2
View File
@@ -142,7 +142,7 @@ fn an_edit_saves_only_a_change_and_escape_cancels(cx: &mut TestAppContext) {
window.focus(&field, cx);
});
settle(cx);
cx.simulate_keystrokes("cmd-enter");
cx.simulate_keystrokes("secondary-enter");
settle(cx);
assert_eq!(
edit.read_with(cx, |edit, _| edit.saved),
@@ -151,7 +151,7 @@ fn an_edit_saves_only_a_change_and_escape_cancels(cx: &mut TestAppContext) {
);
cx.simulate_input(" Gently.");
settle(cx);
cx.simulate_keystrokes("cmd-enter");
cx.simulate_keystrokes("secondary-enter");
settle(cx);
assert_eq!(edit.read_with(cx, |edit, _| edit.saved), 1);
cx.simulate_keystrokes("escape");
+10 -10
View File
@@ -96,7 +96,7 @@ fn backspace_at_the_start_joins_up_and_undo_parts_them(cx: &mut TestAppContext)
blocks(&editor, cx),
[text(BlockKind::Paragraph, "tone lift")]
);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
assert_eq!(
blocks(&editor, cx),
@@ -229,7 +229,7 @@ fn enter_over_a_selection_drops_it_and_splits_there(cx: &mut TestAppContext) {
text(BlockKind::Paragraph, "ef")
]
);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
assert_eq!(
blocks(&editor, cx),
@@ -244,12 +244,12 @@ fn undo_puts_the_caret_back_where_the_change_began(cx: &mut TestAppContext) {
caret(&editor, 0, 3, cx);
cx.simulate_keystrokes("enter");
settle(cx);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
let first = cx.update(|_, cx| editor.read(cx).blocks[0].key);
let focused = cx.update(|window, cx| editor.read(cx).focused(window, cx));
assert_eq!(focused, Some((first, 0)));
cx.simulate_keystrokes("cmd-shift-z");
cx.simulate_keystrokes("secondary-shift-z");
settle(cx);
assert_eq!(
blocks(&editor, cx),
@@ -259,7 +259,7 @@ fn undo_puts_the_caret_back_where_the_change_began(cx: &mut TestAppContext) {
],
"redo splits again"
);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
cx.simulate_input("x");
settle(cx);
@@ -305,7 +305,7 @@ fn undoing_a_kind_change_brings_back_its_styling(cx: &mut TestAppContext) {
});
settle(cx);
caret(&editor, 0, 0, cx);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
let bold = cx.update(|_, cx| {
let field = editor.read(cx).blocks[0].fields[0].clone();
@@ -329,7 +329,7 @@ fn undo_of_typing_restores_the_selection_it_replaced(cx: &mut TestAppContext) {
cx.simulate_keystrokes("x");
settle(cx);
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abxef")]);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
let selection = cx.update(|_, cx| editor.read(cx).blocks[0].fields[0].read(cx).selection());
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abcdef")]);
@@ -371,15 +371,15 @@ fn undo_of_a_delete_or_a_paste_restores_the_selection(cx: &mut TestAppContext) {
cx.simulate_keystrokes("backspace");
settle(cx);
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abef")]);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
assert_eq!(selection(cx), 2..4, "undo of a delete selects what it took");
cx.update(|_, cx| cx.write_to_clipboard(gpui::ClipboardItem::new_string("xy".into())));
select(&editor, 0, 0, 2..4, cx);
cx.simulate_keystrokes("cmd-v");
cx.simulate_keystrokes("secondary-v");
settle(cx);
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abxyef")]);
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
settle(cx);
assert_eq!(
selection(cx),
+8 -8
View File
@@ -121,7 +121,7 @@ fn a_composition_undoes_in_one_step(cx: &mut TestAppContext) {
})
});
assert_eq!(text(field, cx), "你");
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
assert_eq!(text(field, cx), "");
}
@@ -142,7 +142,7 @@ fn a_committed_composition_obeys_the_filter_and_length(cx: &mut TestAppContext)
})
});
assert_eq!(text(field, cx), "1");
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
assert_eq!(text(field, cx), "");
}
@@ -158,7 +158,7 @@ fn a_browser_paste_undoes_apart_from_the_typing(cx: &mut TestAppContext) {
})
});
assert_eq!(text(field, cx), "abcd");
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
assert_eq!(text(field, cx), "ab");
}
@@ -169,7 +169,7 @@ fn undo_leaves_a_disabled_field_alone(cx: &mut TestAppContext) {
focus(field, cx);
cx.simulate_input("a");
field.update(cx, |input, cx| input.set_disabled(true, cx));
cx.simulate_keystrokes("cmd-z");
cx.simulate_keystrokes("secondary-z");
assert_eq!(text(field, cx), "a");
}
@@ -194,7 +194,7 @@ fn stepping_starts_from_the_typed_number(cx: &mut TestAppContext) {
setup(cx);
let (view, cx) = cx.add_window_view(|_, _| Stepped { value: 4.0 });
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_keystrokes("cmd-a");
cx.simulate_keystrokes("secondary-a");
cx.simulate_input("20");
cx.simulate_keystrokes("up");
assert_eq!(view.read_with(cx, |view, _| view.value), 21.0);
@@ -205,7 +205,7 @@ fn a_typed_number_reaches_the_owner_before_any_blur(cx: &mut TestAppContext) {
setup(cx);
let (view, cx) = cx.add_window_view(|_, _| Stepped { value: 100.0 });
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_keystrokes("cmd-a");
cx.simulate_keystrokes("secondary-a");
cx.simulate_input("250");
assert_eq!(
view.read_with(cx, |view, _| view.value),
@@ -242,7 +242,7 @@ fn select_all_then_typing_replaces_the_pin(cx: &mut TestAppContext) {
});
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_input("4821");
cx.simulate_keystrokes("cmd-a");
cx.simulate_keystrokes("secondary-a");
cx.simulate_input("1234");
assert_eq!(view.read_with(cx, |view, _| view.code.clone()), "1234");
}
@@ -277,7 +277,7 @@ fn select_all_then_typing_refits_a_masked_field(cx: &mut TestAppContext) {
let (state, cx) = masked("1-999", cx);
cx.simulate_input("123");
assert_eq!(text(&state, cx), "1-123");
cx.simulate_keystrokes("cmd-a");
cx.simulate_keystrokes("secondary-a");
cx.simulate_input("1");
assert_eq!(text(&state, cx), "1-1");
}
+2 -2
View File
@@ -61,7 +61,7 @@ fn cmd_enter_in_a_field_submits_the_form_once(cx: &mut TestAppContext) {
let (view, cx) = signup(cx);
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_input("Ada");
cx.simulate_keystrokes("cmd-enter");
cx.simulate_keystrokes("secondary-enter");
let counts = view.read_with(cx, |view, _| (view.sent, view.field_submits));
assert_eq!(counts, (1, 0));
}
@@ -73,7 +73,7 @@ fn cmd_enter_on_any_control_in_a_form_submits_it(cx: &mut TestAppContext) {
window.focus_next(cx);
window.focus_next(cx);
});
cx.simulate_keystrokes("cmd-enter");
cx.simulate_keystrokes("secondary-enter");
assert_eq!(
view.read_with(cx, |view, _| view.sent),
1,
+2 -2
View File
@@ -123,7 +123,7 @@ fn a_converter_reads_an_amount_in_another_unit(cx: &mut TestAppContext) {
);
press("tab", cx);
press("tab", cx);
press("cmd-a", cx);
press("secondary-a", cx);
cx.simulate_input("-40");
assert!(shown("converted-−40 °F", cx));
press("tab", cx);
@@ -134,7 +134,7 @@ fn a_converter_reads_an_amount_in_another_unit(cx: &mut TestAppContext) {
assert!(shown("converted-233.15 K", cx), "picked Kelvin");
press("shift-tab", cx);
press("shift-tab", cx);
press("cmd-a", cx);
press("secondary-a", cx);
cx.simulate_input("-");
assert!(shown("converted-—", cx));
}
+3 -3
View File
@@ -55,16 +55,16 @@ fn colors(_: &mut Window, cx: &mut App, owner: Entity<Desk>) -> AnyElement {
.into_any_element()
}
/// The first color is the eighth stop; Enter opens its picker, where the third stop is the hex field, which takes a new background.
/// The first color is the eighth stop; Enter opens its picker, where the hex field follows the eyedropper, a stop on macOS alone, and takes a new background.
#[gpui::test]
fn a_color_well_sets_its_own_color(cx: &mut TestAppContext) {
let (host, cx) = desk(colors, cx);
tab(8, cx);
tap("enter", cx);
for _ in 0..3 {
for _ in 0..if cfg!(target_os = "macos") { 3 } else { 2 } {
tap("tab", cx);
}
tap("cmd-a", cx);
tap("secondary-a", cx);
cx.simulate_input("#224466");
tap("enter", cx);
assert_eq!(said(&host, cx), ["#224466"]);
+1 -1
View File
@@ -18,7 +18,7 @@ fn a_paste_fills_cells_from_the_cursor(cx: &mut TestAppContext) {
cx.simulate_click(point(px(48.0), px(42.0)), Modifiers::none());
settle(cx);
cx.update(|_, cx| cx.write_to_clipboard(ClipboardItem::new_string("x\ty\nz\tw".into())));
cx.simulate_keystrokes("cmd-v");
cx.simulate_keystrokes("secondary-v");
settle(cx);
let cells = |row, col, text: &str| (row, col, text.to_string());
assert_eq!(
+1 -1
View File
@@ -376,7 +376,7 @@ fn a_grid_that_shrinks_keeps_its_cursor_inside(cx: &mut TestAppContext) {
count.set(1);
view.update(cx, |_, cx| cx.notify());
settle(cx);
cx.simulate_keystrokes("cmd-c");
cx.simulate_keystrokes("secondary-c");
settle(cx);
let copied = cx.update(|_, cx| cx.read_from_clipboard().and_then(|item| item.text()));
assert_eq!(