mirror of
https://github.com/storytold/designcraft.git
synced 2026-12-04 04:53:37 -05:00
Merge branch 'main' into rfc-0018-designcraft-cli
This commit is contained in:
2 files changed
+30
-5
No files matched your search
@@ -243,10 +243,12 @@ fn font_popups_stay_bounded_and_anchored_to_each_text_selection_field() {
|
||||
click_at(&mut h, at.center());
|
||||
h.run_steps(4);
|
||||
let input = h.get_by(|n| n.role() == egui::accesskit::Role::TextInput && n.is_focused()).rect();
|
||||
assert!(h.query_by_label("Search fonts").is_some(), "the open picker exposes its search field");
|
||||
geometry.push((at, input));
|
||||
h.key_press(egui::Key::Escape);
|
||||
h.run_steps(4);
|
||||
assert!(!h.ctx.text_edit_focused(), "Escape closes the font picker");
|
||||
assert!(h.query_by_label("Search fonts").is_none(), "Escape removes the font picker search field");
|
||||
assert!(!h.ctx.text_edit_focused(), "Escape leaves no text edit focused");
|
||||
}
|
||||
for (at, input) in &geometry {
|
||||
assert!(input.width() >= 350.0 && input.width() <= 600.0, "the search fits a main-sized dropdown: {geometry:?}");
|
||||
|
||||
@@ -583,10 +583,6 @@ mod framework {
|
||||
if unavailable && !rows.is_empty() {
|
||||
small(ui, None, &tr("Link status is unavailable."), Shade::Muted, None);
|
||||
}
|
||||
if rows.is_empty() {
|
||||
Text::new(tr("No placed graphics.")).shade(Shade::Muted).show(ui);
|
||||
return;
|
||||
}
|
||||
// The chosen row belongs to the document it was chosen in, and holds only while that document still lists it: a
|
||||
// row of another document, or one gone from this list, is no choice.
|
||||
let row_id = |r: &Value| r["asset"].as_u64().or_else(|| r["story"].as_u64());
|
||||
@@ -595,6 +591,10 @@ mod framework {
|
||||
if chosen.is_none() {
|
||||
ui.data_mut(|d| d.remove::<u64>(sel_key));
|
||||
}
|
||||
if rows.is_empty() {
|
||||
Text::new(tr("No placed graphics.")).shade(Shade::Muted).show(ui);
|
||||
return;
|
||||
}
|
||||
// Status and Page · PPI are as wide as their widest entry (a chip sized to its words, a short readout) and Name
|
||||
// takes the rest, so a file name stays readable and every column fits the panel; long source paths are cut.
|
||||
let width = ui.available_width();
|
||||
@@ -956,6 +956,29 @@ mod ui223_links_tests {
|
||||
assert_eq!(app.session.journal.last(), Some(&(command.to_owned(), payload)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ui223_links_empty_list_drops_the_selected_link_before_undo_restores_it() {
|
||||
let (app, items, assets) = graphics();
|
||||
let mut h = harness(app);
|
||||
click(&mut h, "studio-b/photo.svg");
|
||||
assert!(!button(&h, "Go To").facts.as_ref().unwrap().disabled);
|
||||
|
||||
let deleted = h.state_mut().run("edit.clear", json!({"ids": items})).unwrap();
|
||||
assert_eq!(deleted["deleted"], 3);
|
||||
idle(&mut h, 3);
|
||||
assert!(h.query_by_label("No placed graphics.").is_some());
|
||||
h.state_mut().run("edit.undo", json!({})).unwrap();
|
||||
idle(&mut h, 3);
|
||||
assert!(h.query_by_role_and_label(egui::accesskit::Role::Button, "studio-b/photo.svg").is_some(), "the same link has returned");
|
||||
assert!(h.query_by_label("Choose a link.").is_some(), "the empty list retired the old selection");
|
||||
assert!(h.query_by_label("Go To").is_none(), "restoring the links does not select one");
|
||||
|
||||
click(&mut h, "studio-b/photo.svg");
|
||||
let go = button(&h, "Go To");
|
||||
click_at(&mut h, go.rect);
|
||||
assert_last_command(h.state(), "links.goTo", json!({"asset": assets[1].0}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ui223_links_pointer_go_to_preserves_same_named_asset_identity() {
|
||||
let (app, items, assets) = graphics();
|
||||
|
||||
Reference in new issue
Block a user