mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 05:37:04 +00:00
Merge branch 'pdf-red2/fw-shell' into area/fw-red-2
This commit is contained in:
@@ -507,6 +507,9 @@ impl StartScreen<'_> {
|
||||
link_items(ui, links);
|
||||
};
|
||||
let page_stack = || Stack::new().gap(Gap::Section).pad(Pad::Regular).fill_width();
|
||||
// The page stack fills its room, so its own measure is the room. The least width is that of the same body in a
|
||||
// content-sized column, where a fill-width child only follows the column.
|
||||
let page_content = || Stack::new().gap(Gap::Section).pad(Pad::Regular);
|
||||
// The host's sections at `place`, each one child of the page, so they stand one section gap apart.
|
||||
let host_sections = |ui: &mut Ui, place: StartPlace| {
|
||||
for (_, body) in sections.iter().filter(|(held, _)| *held == place) {
|
||||
@@ -547,7 +550,7 @@ impl StartScreen<'_> {
|
||||
// narrower page keeps New and Open in its row and lists the links after the sections.
|
||||
let rail = !links.is_empty() && {
|
||||
let rail_width = rail_stack().measure_in(ui, Proposal::Ideal, |ui, _| rail_body(ui)).x;
|
||||
let sections_least = page_stack().measure_in(ui, Proposal::Min, |ui, cx| page_body(ui, cx, true)).x;
|
||||
let sections_least = page_content().measure_in(ui, Proposal::Min, |ui, cx| page_body(ui, cx, true)).x;
|
||||
eprintln!(
|
||||
"DIAG host_sections_sit_at_their_place_and_count_in_the_rail_decision: rail {rail_width} least {sections_least} room {} gap {}",
|
||||
ui.available_width(),
|
||||
|
||||
@@ -31,7 +31,7 @@ fn an_app_command_pressed_with_the_focus_in_a_shell_body_is_taken_by_the_body_an
|
||||
frames.idle(3, &mut show);
|
||||
request(&frames.ctx, FocusTarget::Id(tap.get()));
|
||||
frames.frame(vec![], &mut show);
|
||||
frames.frame(vec![key_press(Key::K, Modifiers::COMMAND)], &mut show);
|
||||
frames.frame(vec![key_press(Key::K, Modifiers::COMMAND | Modifiers::ALT | Modifiers::SHIFT)], &mut show);
|
||||
assert_eq!(*taken.borrow(), [AppCommand::Save], "the body took the chord's command");
|
||||
assert!(take_output(&frames.ctx).fired.is_empty(), "a command the body took is not in the frame's output");
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ fn the_gate_may_resolve_commands() {
|
||||
Tap::new().id_salt("go").command(AppCommand::Save).show(ui);
|
||||
};
|
||||
frames.idle(2, &mut show);
|
||||
frames.frame(vec![key_press(Key::K, Modifiers::COMMAND)], &mut show);
|
||||
frames.frame(vec![key_press(Key::K, Modifiers::COMMAND | Modifiers::ALT | Modifiers::SHIFT)], &mut show);
|
||||
assert_eq!(ids(&take_output(&frames.ctx).fired), ["trial.save"]);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ fn a_disabled_commands_key_is_declined_and_a_gated_one_is_not() {
|
||||
let keys = vec![
|
||||
key_press(Key::F8, Modifiers::NONE),
|
||||
key_press(Key::J, Modifiers::COMMAND | Modifiers::ALT),
|
||||
key_press(Key::K, Modifiers::COMMAND),
|
||||
key_press(Key::K, Modifiers::COMMAND | Modifiers::ALT | Modifiers::SHIFT),
|
||||
];
|
||||
let mut first = true;
|
||||
frames.frame(keys, |ui| {
|
||||
|
||||
@@ -21,7 +21,7 @@ pub struct FixedStyle {
|
||||
pub enum AppCommand {
|
||||
#[command(label = "Go")]
|
||||
Go,
|
||||
#[command(label = "Save", default = "Cmd+K")]
|
||||
#[command(label = "Save", default = "Cmd+Alt+Shift+K")]
|
||||
Save,
|
||||
#[command(label = "Play", default = "F8")]
|
||||
Play,
|
||||
|
||||
@@ -103,8 +103,6 @@ fn the_recent_menu_offers_show_in_folder_where_the_platform_can_reveal() {
|
||||
|
||||
for (key, modifiers) in [(Key::Menu, Modifiers::NONE), (Key::F10, Modifiers::SHIFT)] {
|
||||
fixture.key(Key::Escape, Modifiers::NONE).idle(3);
|
||||
let remove = fixture.by_label("Remove from Recent").map(|found| fixture.tree().role_of(found.node));
|
||||
eprintln!("DIAG the_recent_menu_offers_show_in_folder_where_the_platform_can_reveal: {key:?} after Escape: remove {remove:?}");
|
||||
assert!(fixture.by_label(MENU_ONLY).is_none(), "Escape closes the menu before {key:?}");
|
||||
let card = fixture.by_label("Poster.psd").expect("the card shows");
|
||||
fixture.click(&card).idle(2);
|
||||
@@ -259,7 +257,9 @@ fn a_listed_pinned_folder_folds_shows_more_and_opens_its_files() {
|
||||
assert!(log.borrow().contains(&StartAction::OpenPinnedFile(work.join(file_name(count - 1)))), "a file row opens its file: {:?}", log.borrow());
|
||||
|
||||
// Left on the open heading is the disclosure's close.
|
||||
let heading = target(&fixture, "Work");
|
||||
// A folder row is named by its name and its path.
|
||||
let heading_name = format!("Work, {}", work.display());
|
||||
let heading = target(&fixture, &heading_name);
|
||||
fixture.click(&heading).idle(2);
|
||||
log.borrow_mut().clear();
|
||||
fixture.key(Key::ArrowLeft, Modifiers::NONE).idle(2);
|
||||
@@ -269,5 +269,5 @@ fn a_listed_pinned_folder_folds_shows_more_and_opens_its_files() {
|
||||
fixture.settle();
|
||||
assert!((0..count).all(|n| fixture.by_label(&file_name(n)).is_none()), "a folded folder shows no file row");
|
||||
assert!(fixture.by_label("Show less").is_none(), "a folded folder shows no More row");
|
||||
assert!(fixture.by_label("Work").is_some(), "a folded folder keeps its heading");
|
||||
assert!(fixture.by_label(&heading_name).is_some(), "a folded folder keeps its heading");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user