Issue #345: activity stack polish
The cross sits at the right edge of its row (the name's area kept only the text's width, so the cross followed short names). Seen in the running app; a test pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
10e097abf6
commit
63d9b70356
|
|
@ -115,7 +115,8 @@ fn row(ui: &mut egui::Ui, t: &Tokens, task: &TaskInfo, width: f32) -> bool {
|
|||
let cross = task.cancellable && !task.cancelling;
|
||||
let label_w = if cross { width - CROSS - 6.0 } else { width };
|
||||
ui.allocate_ui_with_layout(vec2(label_w, 18.0), Layout::left_to_right(Align::Center), |ui| {
|
||||
ui.set_max_width(label_w);
|
||||
// the whole width, so the cross lands at the right edge however short the name
|
||||
ui.set_width(label_w);
|
||||
ui.add(egui::Label::new(RichText::new(tr(&task.label)).font(t.font(12.5)).color(t.text)).truncate());
|
||||
});
|
||||
if cross {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,16 @@ fn long_detail_stays_inside_the_stack() {
|
|||
assert!(row.width() <= WIDTH + 1.0, "{row:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cross_sits_at_the_right_edge_of_its_row() {
|
||||
let mut h = demo();
|
||||
let g = h.app.session.activity.start("export", "Exporting", Cancel::Yes);
|
||||
wait_visible(&mut h);
|
||||
let row = rect(&h, &format!("activity:row:{}", g.id()));
|
||||
let cross = rect(&h, &format!("activity:cancel:{}", g.id()));
|
||||
assert!(cross.right() >= row.right() - 2.0, "the cross is at the right, not after the label: {cross:?} in {row:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quit_with_a_running_task_asks_and_quit_anyway_cancels() {
|
||||
let mut h = demo();
|
||||
|
|
@ -184,7 +194,6 @@ fn start_export(h: &mut Headless, n: usize) {
|
|||
}
|
||||
let r = h.request("ui.dialog.confirm", json!({}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
assert!(h.app.export.is_some(), "running in the background");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -192,6 +201,7 @@ fn export_shows_a_row_and_stops_on_activity_cancel() {
|
|||
let mut h = demo();
|
||||
h.app.services.write_shared = Some(slow_writer(200));
|
||||
start_export(&mut h, 5);
|
||||
assert!(h.app.export.is_some(), "running in the background");
|
||||
let tasks = h.request("ui.inspect", json!({}), T)["result"]["activity"].clone();
|
||||
assert_eq!(tasks[0]["kind"], "export", "{tasks}");
|
||||
assert_eq!(tasks[0]["total"], 5, "{tasks}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue