T24b round 1 fix

- AgentProgress splits its bar only for two steps or more; a task of one
  step draws a plain bar
- test a_task_of_one_step_draws_before_and_after renders 0 of 1 and 1 of 1
This commit is contained in:
ZacharyZhang-NY committed 2026-09-26 08:31:32 -04:00
1 parent f4cf1ef3d7
commit fab0131168
3 files changed
+35 -5

No files matched your search

+1
View File
@@ -275,3 +275,4 @@ Per-component lines live in `tasks/`. Tags there:
| T24a | 1 | FAIL | tall arguments pushed the approval dialog's title and buttons off screen; a long tool name in a narrow column pushed the time and chevron out of the card; the dark capture closed the card the light one opened |
| T24a | 2 | FAIL | a dialog body's children shrank to the capped column instead of scrolling: a 2000px body drew at 860px and a scroll moved nothing |
| T24a | 3 | PASS | |
| T24b | 1 | FAIL | a task of one step crashed at render: its bar asked for one segment, and a segmented bar needs two |
+9 -5
View File
@@ -246,7 +246,7 @@ impl RenderOnce for AgentStatus {
}
}
/// How far an agent has come: the step at work, how many are done of how many, the time so far, and a bar split by step.
/// How far an agent has come: the step at work, how many are done of how many, the time so far, and a bar split by step when there are two or more.
#[derive(IntoElement)]
pub struct AgentProgress {
id: ElementId,
@@ -309,9 +309,13 @@ impl RenderOnce for AgentProgress {
tabular(div().flex_none().text_color(colors.fg_subtle)).child(took(spent))
})),
)
.child(
ProgressBar::new((self.id, "bar"), self.done as f32 / self.total as f32)
.segments(self.total),
)
.child({
let bar = ProgressBar::new((self.id, "bar"), self.done as f32 / self.total as f32);
if self.total >= 2 {
bar.segments(self.total)
} else {
bar
}
})
}
}
+25
View File
@@ -129,3 +129,28 @@ fn the_prompt_walks_deny_always_then_once(cx: &mut TestAppContext) {
fn progress_past_its_total_fails_loud() {
let _ = AgentProgress::new("progress", "Writing", 6, 5);
}
/// A progress bar for a task of one step, `done` or not.
struct Single {
done: usize,
}
impl Render for Single {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
div()
.w_full()
.child(AgentProgress::new("single", "The one step", self.done, 1))
}
}
#[gpui::test]
fn a_task_of_one_step_draws_before_and_after(cx: &mut TestAppContext) {
cx.update(Theme::init);
let (view, cx) = cx.add_window_view(|_, _| Single { done: 0 });
settle(cx);
view.update(cx, |single, cx| {
single.done = 1;
cx.notify();
});
settle(cx);
}