mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-29 17:44:05 +01:00
test(ui): follow macOS close and pointer conventions (#4227)
* test(ui): follow macOS close and pointer conventions * Format the platform-specific Cryptomatte modifier test --------- Co-authored-by: FredApps <FredApps@users.noreply.github.com> Co-authored-by: Fredrik Hallin <fredrik.hallin@guidelinegeo.com>
This commit is contained in:
4 files changed
+10
-10
No files matched your search
@@ -378,19 +378,19 @@ mod tests {
|
||||
#[test]
|
||||
fn the_window_stays_open_until_the_quit_prompt_is_answered() {
|
||||
let (mut app, ctx) = app();
|
||||
assert!(!frame(&mut app, &ctx, true), "an unmodified project quits at once");
|
||||
assert_eq!(frame(&mut app, &ctx, true), cfg!(target_os = "macos"), "a saved project uses the platform quit path");
|
||||
modified(&mut app);
|
||||
assert!(frame(&mut app, &ctx, true), "the close is cancelled");
|
||||
assert_eq!(app.dialog, Some(Dialog::UnsavedChanges));
|
||||
answer_with(&mut app, &ctx, Answer::Discard);
|
||||
assert!(app.dialog_state.unsaved.quitting);
|
||||
assert!(!frame(&mut app, &ctx, true), "Don't Save lets the window close");
|
||||
assert_eq!(frame(&mut app, &ctx, true), cfg!(target_os = "macos"), "Don't Save uses the platform quit path");
|
||||
// Undoing back to the saved state needs no prompt.
|
||||
let (mut app, ctx) = self::app();
|
||||
modified(&mut app);
|
||||
app.session.execute("edit.undo", json!({})).unwrap();
|
||||
assert!(!app.session.is_dirty());
|
||||
assert!(!frame(&mut app, &ctx, true));
|
||||
assert_eq!(frame(&mut app, &ctx, true), cfg!(target_os = "macos"));
|
||||
}
|
||||
|
||||
/// Closing the window while AppKit's run loop is running crashes on a Mac with a Touch Bar
|
||||
|
||||
@@ -247,11 +247,11 @@ fn eyedropper_arms_hovers_picks_with_modifiers_and_stays_armed_until_esc() {
|
||||
h.event(Event::PointerButton { pos: b, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });
|
||||
h.run_steps(3);
|
||||
assert_eq!(selection(&h, &ids), "c1_1, c3_3", "Shift held at the press adds");
|
||||
// On a Mac the hint says Option or Cmd, and Ctrl (no Cmd there) removes too.
|
||||
// On a Mac Ctrl-click is secondary click; Option remains the remove modifier.
|
||||
h.ctx.set_os(egui::os::OperatingSystem::Mac);
|
||||
assert_eq!(hover(&mut h, hint), MAC_HINT);
|
||||
click(&mut h, a, Modifiers::CTRL);
|
||||
assert_eq!(selection(&h, &ids), "c3_3", "Ctrl on a Mac");
|
||||
click(&mut h, a, Modifiers::ALT);
|
||||
assert_eq!(selection(&h, &ids), "c3_3", "Option on a Mac");
|
||||
h.ctx.set_os(egui::os::OperatingSystem::Nix);
|
||||
click(&mut h, b, Modifiers::ALT);
|
||||
assert_eq!(selection(&h, &ids), "");
|
||||
|
||||
@@ -759,7 +759,7 @@ fn each_pick_is_one_step_and_clicks_that_change_nothing_are_none() {
|
||||
let mut m = Model::new(&h, f.comp);
|
||||
let ctr = |cx: usize, cy: usize| [cx as f64 * 37.0 + 18.5, cy as f64 * 29.0 + 14.5];
|
||||
let pl = f.plate;
|
||||
let ctrl_only = Modifiers { ctrl: true, ..Modifiers::NONE };
|
||||
let remove_modifier = if MAC { Modifiers::ALT } else { Modifiers { ctrl: true, ..Modifiers::NONE } };
|
||||
use Step::*;
|
||||
let steps = [
|
||||
Arm(pl),
|
||||
@@ -771,7 +771,7 @@ fn each_pick_is_one_step_and_clicks_that_change_nothing_are_none() {
|
||||
Pick(ctr(4, 2), Modifiers::SHIFT, "c4_2"), // add
|
||||
Pick(ctr(4, 2), Modifiers::COMMAND, "c4_2"), // Ctrl (as `command`) removes
|
||||
Pick(ctr(5, 5), Modifiers::SHIFT, "c5_5"), // add
|
||||
Pick(ctr(5, 5), ctrl_only, "c5_5"), // Ctrl alone removes too
|
||||
Pick(ctr(5, 5), remove_modifier, "c5_5"), // Option on Mac, Ctrl elsewhere
|
||||
Pick(ctr(3, 3), Modifiers::NONE, "c3_3"), // replace with what it already is: no step
|
||||
PickEmpty, // off the layer: no step
|
||||
Pick(ctr(2, 1), Modifiers::NONE, "c2_1"), // replace
|
||||
|
||||
@@ -163,8 +163,8 @@ fn the_selection_tool_picks_while_the_cryptomatte_effect_is_selected() {
|
||||
assert_eq!(selection(&h, &ids), "", "Ctrl removes");
|
||||
click(&mut h, b, Modifiers::NONE);
|
||||
assert_eq!(selection(&h, &ids), "c3_3");
|
||||
click(&mut h, b, Modifiers::CTRL);
|
||||
assert_eq!(selection(&h, &ids), "", "Ctrl (not Cmd) removes too");
|
||||
click(&mut h, b, if cfg!(target_os = "macos") { Modifiers::ALT } else { Modifiers::CTRL });
|
||||
assert_eq!(selection(&h, &ids), "", "the platform remove modifier removes too");
|
||||
click(&mut h, b, Modifiers::NONE);
|
||||
assert_eq!(selection(&h, &ids), "c3_3");
|
||||
assert_eq!(undo_steps(&h), steps + 7, "one undo step per pick");
|
||||
|
||||
Reference in new issue
Block a user