Capture · Roots: the roots round 2 missed
A sweep that read every render found 28 roots still on w_full, reached by 64 components: the field button under Select and every picker, the checked and mention fields, the slider track, NumberInput, Steps, the state views, the agent previews, and every chart and finance frame. All drop it. LivePreview's size_full becomes h_full, since its card no longer fills. Every host of those roots was listed and read, 231 in all. Five tests that mounted a picker as the window root sit in a size_full box, the index manager gives its method select a flex_1 box, and the notification center and the gallery's state frames stack their state views in a column so they stretch. Each dropped root carries a debug selector, and six chapter tests mount 43 components in a padded card whose column is measured by content, through layout::tests::narrow_width: each root must take the full 240px. With w_full back on the roots, all six fail. AGENTS.md names the roots that keep w_full and why: picture frames that keep a ratio, and rows that hand a text field its share.
This commit is contained in:
1 parent
ad98ca7746
commit
a6f9a7b77b
43 files changed
+465
-108
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use gpui::{
|
||||
App, Div, ElementId, Entity, IntoElement, ParentElement, PathBuilder, Pixels, Point,
|
||||
Refineable, RenderOnce, StyleRefinement, Styled, Window, canvas, div, fill,
|
||||
App, Div, ElementId, Entity, InteractiveElement, IntoElement, ParentElement, PathBuilder,
|
||||
Pixels, Point, Refineable, RenderOnce, StyleRefinement, Styled, Window, canvas, div, fill,
|
||||
};
|
||||
|
||||
use super::quotes::moves;
|
||||
@@ -250,7 +250,10 @@ impl RenderOnce for DepthChart {
|
||||
let (stroke, bottom) = (sizes.stroke.to_pixels(rem), frame.y + frame.h);
|
||||
let mark = reading.map(|(price, _, total)| (xs.at(price), ys.at(total)));
|
||||
let palette = colors.clone();
|
||||
let mut root = div().relative().w_full().h(sizes.height);
|
||||
let mut root = div()
|
||||
.debug_selector(|| "chart-root".into())
|
||||
.relative()
|
||||
.h(sizes.height);
|
||||
root.style().refine(self.base.style());
|
||||
tracked(
|
||||
root,
|
||||
|
||||
@@ -165,7 +165,10 @@ impl RenderOnce for MarketHeatmap {
|
||||
theme.radius(Radius::Sm).to_pixels(rem),
|
||||
colors.fg,
|
||||
);
|
||||
let mut root = div().relative().w_full().h(sizes.height);
|
||||
let mut root = div()
|
||||
.debug_selector(|| "chart-root".into())
|
||||
.relative()
|
||||
.h(sizes.height);
|
||||
root.style().refine(self.base.style());
|
||||
tracked(
|
||||
root,
|
||||
|
||||
@@ -422,7 +422,10 @@ impl RenderOnce for CandlestickChart {
|
||||
},
|
||||
};
|
||||
let height = sizes.height + sizes.height * 0.3 * self.studies.len() as f32;
|
||||
let mut root = div().relative().w_full().h(height);
|
||||
let mut root = div()
|
||||
.debug_selector(|| "chart-root".into())
|
||||
.relative()
|
||||
.h(height);
|
||||
root.style().refine(self.base.style());
|
||||
let steering = Steering {
|
||||
stage: stage.clone(),
|
||||
|
||||
@@ -196,7 +196,9 @@ impl RenderOnce for PayoffDiagram {
|
||||
}
|
||||
chart.labels = labels;
|
||||
chart.format = Rc::new(|value| format::currency(value, "USD"));
|
||||
let mut base = div().w_full().h(cx.theme().chart().height);
|
||||
let mut base = div()
|
||||
.debug_selector(|| "chart-root".into())
|
||||
.h(cx.theme().chart().height);
|
||||
base.style().refine(self.base.style());
|
||||
plot(chart, base, window, cx)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::{
|
||||
App, Div, ElementId, Entity, IntoElement, ParentElement, PathBuilder, Pixels, Refineable,
|
||||
RenderOnce, StyleRefinement, Styled, Window, canvas, div, fill,
|
||||
App, Div, ElementId, Entity, InteractiveElement, IntoElement, ParentElement, PathBuilder,
|
||||
Pixels, Refineable, RenderOnce, StyleRefinement, Styled, Window, canvas, div, fill,
|
||||
};
|
||||
|
||||
use jiff::tz::TimeZone;
|
||||
@@ -146,7 +146,10 @@ fn board(
|
||||
theme.radius(crate::theme::Radius::Sm).to_pixels(rem),
|
||||
);
|
||||
let box_px = boxes.map(|size| (ys.at(0.0) - ys.at(size)).abs());
|
||||
let mut root = div().relative().w_full().h(sizes.height);
|
||||
let mut root = div()
|
||||
.debug_selector(|| "chart-root".into())
|
||||
.relative()
|
||||
.h(sizes.height);
|
||||
root.style().refine(base.style());
|
||||
tracked(root, (id, "marks").into(), &tiles, move |place| {
|
||||
hit.iter().position(|(rect, _)| rect.contains(place))
|
||||
|
||||
+43
-2
@@ -6,8 +6,11 @@ use gpui::{
|
||||
};
|
||||
use jiff::Timestamp;
|
||||
|
||||
use crate::finance::{CandlestickChart, ChartSync, candles::Candle, stage::Visible};
|
||||
use crate::theme::Theme;
|
||||
use crate::finance::{
|
||||
CandlestickChart, ChartSync, DepthChart, Leg, MarketHeatmap, PayoffDiagram, PointFigureChart,
|
||||
RenkoChart, candles::Candle, stage::Visible,
|
||||
};
|
||||
use crate::{layout::tests::narrow_width, theme::Theme};
|
||||
|
||||
fn candles(count: usize) -> Rc<Vec<Candle>> {
|
||||
Rc::new(
|
||||
@@ -106,3 +109,41 @@ fn a_lagging_chart_leaves_the_shared_window_alone(cx: &mut TestAppContext) {
|
||||
"the lagging chart's append is already shown"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn every_chart_fills_a_column_its_block_measures_by_content(cx: &mut TestAppContext) {
|
||||
cx.update(Theme::init);
|
||||
let leg = Leg {
|
||||
call: true,
|
||||
strike: 100.0,
|
||||
quantity: 1.0,
|
||||
premium: 2.0,
|
||||
};
|
||||
let widths = [
|
||||
narrow_width(cx, "chart-root", |_, _| {
|
||||
DepthChart::new("depth", [(99.0, 2.0)], [(101.0, 3.0)]).into_any_element()
|
||||
}),
|
||||
narrow_width(cx, "chart-root", |_, _| {
|
||||
MarketHeatmap::new("heatmap")
|
||||
.tile("A", 1.0, 0.5)
|
||||
.into_any_element()
|
||||
}),
|
||||
narrow_width(cx, "chart-root", |_, _| {
|
||||
CandlestickChart::new("candles", candles(30)).into_any_element()
|
||||
}),
|
||||
narrow_width(cx, "chart-root", move |_, _| {
|
||||
PayoffDiagram::new("payoff", [leg], (80.0, 120.0), 100.0).into_any_element()
|
||||
}),
|
||||
narrow_width(cx, "chart-root", |_, _| {
|
||||
RenkoChart::new("renko", candles(30), 0.1).into_any_element()
|
||||
}),
|
||||
narrow_width(cx, "chart-root", |_, _| {
|
||||
PointFigureChart::new("figure", candles(30), 0.1, 3).into_any_element()
|
||||
}),
|
||||
];
|
||||
assert_eq!(
|
||||
widths,
|
||||
[px(240.0); 6],
|
||||
"each chart spans the card inside its padding"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user