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:
1 parent
399e3a6b53
commit
717d07ee4e
10 files changed
+45
-30
No files matched your search
@@ -18,6 +18,21 @@ jobs:
|
|||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: scripts/check.sh
|
- 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:
|
site:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ fn a_card_waits_for_a_whole_code_and_a_name(cx: &mut TestAppContext) {
|
|||||||
tab(3, cx);
|
tab(3, cx);
|
||||||
write("3", cx);
|
write("3", cx);
|
||||||
tab(4, cx);
|
tab(4, cx);
|
||||||
tap("cmd-a", cx);
|
tap("secondary-a", cx);
|
||||||
tap("backspace", cx);
|
tap("backspace", cx);
|
||||||
tap("enter", cx);
|
tap("enter", cx);
|
||||||
assert!(said(&host, cx).is_empty(), "no name on the card");
|
assert!(said(&host, cx).is_empty(), "no name on the card");
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ fn an_edit_saves_only_a_change_and_escape_cancels(cx: &mut TestAppContext) {
|
|||||||
window.focus(&field, cx);
|
window.focus(&field, cx);
|
||||||
});
|
});
|
||||||
settle(cx);
|
settle(cx);
|
||||||
cx.simulate_keystrokes("cmd-enter");
|
cx.simulate_keystrokes("secondary-enter");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
edit.read_with(cx, |edit, _| edit.saved),
|
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.");
|
cx.simulate_input(" Gently.");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
cx.simulate_keystrokes("cmd-enter");
|
cx.simulate_keystrokes("secondary-enter");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(edit.read_with(cx, |edit, _| edit.saved), 1);
|
assert_eq!(edit.read_with(cx, |edit, _| edit.saved), 1);
|
||||||
cx.simulate_keystrokes("escape");
|
cx.simulate_keystrokes("escape");
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ fn backspace_at_the_start_joins_up_and_undo_parts_them(cx: &mut TestAppContext)
|
|||||||
blocks(&editor, cx),
|
blocks(&editor, cx),
|
||||||
[text(BlockKind::Paragraph, "tone lift")]
|
[text(BlockKind::Paragraph, "tone lift")]
|
||||||
);
|
);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
blocks(&editor, cx),
|
blocks(&editor, cx),
|
||||||
@@ -229,7 +229,7 @@ fn enter_over_a_selection_drops_it_and_splits_there(cx: &mut TestAppContext) {
|
|||||||
text(BlockKind::Paragraph, "ef")
|
text(BlockKind::Paragraph, "ef")
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
blocks(&editor, cx),
|
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);
|
caret(&editor, 0, 3, cx);
|
||||||
cx.simulate_keystrokes("enter");
|
cx.simulate_keystrokes("enter");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
let first = cx.update(|_, cx| editor.read(cx).blocks[0].key);
|
let first = cx.update(|_, cx| editor.read(cx).blocks[0].key);
|
||||||
let focused = cx.update(|window, cx| editor.read(cx).focused(window, cx));
|
let focused = cx.update(|window, cx| editor.read(cx).focused(window, cx));
|
||||||
assert_eq!(focused, Some((first, 0)));
|
assert_eq!(focused, Some((first, 0)));
|
||||||
cx.simulate_keystrokes("cmd-shift-z");
|
cx.simulate_keystrokes("secondary-shift-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
blocks(&editor, cx),
|
blocks(&editor, cx),
|
||||||
@@ -259,7 +259,7 @@ fn undo_puts_the_caret_back_where_the_change_began(cx: &mut TestAppContext) {
|
|||||||
],
|
],
|
||||||
"redo splits again"
|
"redo splits again"
|
||||||
);
|
);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
cx.simulate_input("x");
|
cx.simulate_input("x");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
@@ -305,7 +305,7 @@ fn undoing_a_kind_change_brings_back_its_styling(cx: &mut TestAppContext) {
|
|||||||
});
|
});
|
||||||
settle(cx);
|
settle(cx);
|
||||||
caret(&editor, 0, 0, cx);
|
caret(&editor, 0, 0, cx);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
let bold = cx.update(|_, cx| {
|
let bold = cx.update(|_, cx| {
|
||||||
let field = editor.read(cx).blocks[0].fields[0].clone();
|
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");
|
cx.simulate_keystrokes("x");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abxef")]);
|
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abxef")]);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
let selection = cx.update(|_, cx| editor.read(cx).blocks[0].fields[0].read(cx).selection());
|
let selection = cx.update(|_, cx| editor.read(cx).blocks[0].fields[0].read(cx).selection());
|
||||||
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abcdef")]);
|
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");
|
cx.simulate_keystrokes("backspace");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abef")]);
|
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abef")]);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(selection(cx), 2..4, "undo of a delete selects what it took");
|
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())));
|
cx.update(|_, cx| cx.write_to_clipboard(gpui::ClipboardItem::new_string("xy".into())));
|
||||||
select(&editor, 0, 0, 2..4, cx);
|
select(&editor, 0, 0, 2..4, cx);
|
||||||
cx.simulate_keystrokes("cmd-v");
|
cx.simulate_keystrokes("secondary-v");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abxyef")]);
|
assert_eq!(blocks(&editor, cx), [text(BlockKind::Paragraph, "abxyef")]);
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
selection(cx),
|
selection(cx),
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ fn a_composition_undoes_in_one_step(cx: &mut TestAppContext) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
assert_eq!(text(field, cx), "你");
|
assert_eq!(text(field, cx), "你");
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
assert_eq!(text(field, cx), "");
|
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");
|
assert_eq!(text(field, cx), "1");
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
assert_eq!(text(field, cx), "");
|
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");
|
assert_eq!(text(field, cx), "abcd");
|
||||||
cx.simulate_keystrokes("cmd-z");
|
cx.simulate_keystrokes("secondary-z");
|
||||||
assert_eq!(text(field, cx), "ab");
|
assert_eq!(text(field, cx), "ab");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ fn undo_leaves_a_disabled_field_alone(cx: &mut TestAppContext) {
|
|||||||
focus(field, cx);
|
focus(field, cx);
|
||||||
cx.simulate_input("a");
|
cx.simulate_input("a");
|
||||||
field.update(cx, |input, cx| input.set_disabled(true, cx));
|
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");
|
assert_eq!(text(field, cx), "a");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ fn stepping_starts_from_the_typed_number(cx: &mut TestAppContext) {
|
|||||||
setup(cx);
|
setup(cx);
|
||||||
let (view, cx) = cx.add_window_view(|_, _| Stepped { value: 4.0 });
|
let (view, cx) = cx.add_window_view(|_, _| Stepped { value: 4.0 });
|
||||||
cx.update(|window, cx| window.focus_next(cx));
|
cx.update(|window, cx| window.focus_next(cx));
|
||||||
cx.simulate_keystrokes("cmd-a");
|
cx.simulate_keystrokes("secondary-a");
|
||||||
cx.simulate_input("20");
|
cx.simulate_input("20");
|
||||||
cx.simulate_keystrokes("up");
|
cx.simulate_keystrokes("up");
|
||||||
assert_eq!(view.read_with(cx, |view, _| view.value), 21.0);
|
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);
|
setup(cx);
|
||||||
let (view, cx) = cx.add_window_view(|_, _| Stepped { value: 100.0 });
|
let (view, cx) = cx.add_window_view(|_, _| Stepped { value: 100.0 });
|
||||||
cx.update(|window, cx| window.focus_next(cx));
|
cx.update(|window, cx| window.focus_next(cx));
|
||||||
cx.simulate_keystrokes("cmd-a");
|
cx.simulate_keystrokes("secondary-a");
|
||||||
cx.simulate_input("250");
|
cx.simulate_input("250");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
view.read_with(cx, |view, _| view.value),
|
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.update(|window, cx| window.focus_next(cx));
|
||||||
cx.simulate_input("4821");
|
cx.simulate_input("4821");
|
||||||
cx.simulate_keystrokes("cmd-a");
|
cx.simulate_keystrokes("secondary-a");
|
||||||
cx.simulate_input("1234");
|
cx.simulate_input("1234");
|
||||||
assert_eq!(view.read_with(cx, |view, _| view.code.clone()), "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);
|
let (state, cx) = masked("1-999", cx);
|
||||||
cx.simulate_input("123");
|
cx.simulate_input("123");
|
||||||
assert_eq!(text(&state, cx), "1-123");
|
assert_eq!(text(&state, cx), "1-123");
|
||||||
cx.simulate_keystrokes("cmd-a");
|
cx.simulate_keystrokes("secondary-a");
|
||||||
cx.simulate_input("1");
|
cx.simulate_input("1");
|
||||||
assert_eq!(text(&state, cx), "1-1");
|
assert_eq!(text(&state, cx), "1-1");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ fn cmd_enter_in_a_field_submits_the_form_once(cx: &mut TestAppContext) {
|
|||||||
let (view, cx) = signup(cx);
|
let (view, cx) = signup(cx);
|
||||||
cx.update(|window, cx| window.focus_next(cx));
|
cx.update(|window, cx| window.focus_next(cx));
|
||||||
cx.simulate_input("Ada");
|
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));
|
let counts = view.read_with(cx, |view, _| (view.sent, view.field_submits));
|
||||||
assert_eq!(counts, (1, 0));
|
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);
|
||||||
window.focus_next(cx);
|
window.focus_next(cx);
|
||||||
});
|
});
|
||||||
cx.simulate_keystrokes("cmd-enter");
|
cx.simulate_keystrokes("secondary-enter");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
view.read_with(cx, |view, _| view.sent),
|
view.read_with(cx, |view, _| view.sent),
|
||||||
1,
|
1,
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ fn a_converter_reads_an_amount_in_another_unit(cx: &mut TestAppContext) {
|
|||||||
);
|
);
|
||||||
press("tab", cx);
|
press("tab", cx);
|
||||||
press("tab", cx);
|
press("tab", cx);
|
||||||
press("cmd-a", cx);
|
press("secondary-a", cx);
|
||||||
cx.simulate_input("-40");
|
cx.simulate_input("-40");
|
||||||
assert!(shown("converted-−40 °F", cx));
|
assert!(shown("converted-−40 °F", cx));
|
||||||
press("tab", 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");
|
assert!(shown("converted-233.15 K", cx), "picked Kelvin");
|
||||||
press("shift-tab", cx);
|
press("shift-tab", cx);
|
||||||
press("shift-tab", cx);
|
press("shift-tab", cx);
|
||||||
press("cmd-a", cx);
|
press("secondary-a", cx);
|
||||||
cx.simulate_input("-");
|
cx.simulate_input("-");
|
||||||
assert!(shown("converted-—", cx));
|
assert!(shown("converted-—", cx));
|
||||||
}
|
}
|
||||||
@@ -55,16 +55,16 @@ fn colors(_: &mut Window, cx: &mut App, owner: Entity<Desk>) -> AnyElement {
|
|||||||
.into_any_element()
|
.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]
|
#[gpui::test]
|
||||||
fn a_color_well_sets_its_own_color(cx: &mut TestAppContext) {
|
fn a_color_well_sets_its_own_color(cx: &mut TestAppContext) {
|
||||||
let (host, cx) = desk(colors, cx);
|
let (host, cx) = desk(colors, cx);
|
||||||
tab(8, cx);
|
tab(8, cx);
|
||||||
tap("enter", cx);
|
tap("enter", cx);
|
||||||
for _ in 0..3 {
|
for _ in 0..if cfg!(target_os = "macos") { 3 } else { 2 } {
|
||||||
tap("tab", cx);
|
tap("tab", cx);
|
||||||
}
|
}
|
||||||
tap("cmd-a", cx);
|
tap("secondary-a", cx);
|
||||||
cx.simulate_input("#224466");
|
cx.simulate_input("#224466");
|
||||||
tap("enter", cx);
|
tap("enter", cx);
|
||||||
assert_eq!(said(&host, cx), ["#224466"]);
|
assert_eq!(said(&host, cx), ["#224466"]);
|
||||||
|
|||||||
@@ -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());
|
cx.simulate_click(point(px(48.0), px(42.0)), Modifiers::none());
|
||||||
settle(cx);
|
settle(cx);
|
||||||
cx.update(|_, cx| cx.write_to_clipboard(ClipboardItem::new_string("x\ty\nz\tw".into())));
|
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);
|
settle(cx);
|
||||||
let cells = |row, col, text: &str| (row, col, text.to_string());
|
let cells = |row, col, text: &str| (row, col, text.to_string());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ fn a_grid_that_shrinks_keeps_its_cursor_inside(cx: &mut TestAppContext) {
|
|||||||
count.set(1);
|
count.set(1);
|
||||||
view.update(cx, |_, cx| cx.notify());
|
view.update(cx, |_, cx| cx.notify());
|
||||||
settle(cx);
|
settle(cx);
|
||||||
cx.simulate_keystrokes("cmd-c");
|
cx.simulate_keystrokes("secondary-c");
|
||||||
settle(cx);
|
settle(cx);
|
||||||
let copied = cx.update(|_, cx| cx.read_from_clipboard().and_then(|item| item.text()));
|
let copied = cx.update(|_, cx| cx.read_from_clipboard().and_then(|item| item.text()));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
Reference in new issue
Block a user