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
@@ -12,6 +12,8 @@ mod sidebar;
|
||||
mod split;
|
||||
mod stack;
|
||||
mod surface;
|
||||
#[cfg(all(test, feature = "test-support"))]
|
||||
pub(crate) mod tests;
|
||||
mod viewport;
|
||||
mod workspace;
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
use gpui::{
|
||||
AnyElement, App, Context, IntoElement, ParentElement, Pixels, Render, Styled, TestAppContext,
|
||||
Window, div, px,
|
||||
};
|
||||
|
||||
type Build = Box<dyn Fn(&mut Window, &mut App) -> AnyElement>;
|
||||
|
||||
/// One element in a column that a padded block measures by content.
|
||||
struct Narrow(Build);
|
||||
|
||||
impl Render for Narrow {
|
||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
div().w(px(280.0)).flex().flex_col().child(
|
||||
div().p_5().child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.child((self.0)(window, cx))
|
||||
.child("A line long enough to wrap in a narrow card, so the column fills it."),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// The width of `selector` in that column; a root that fills it takes all 240px.
|
||||
pub(crate) fn narrow_width(
|
||||
cx: &mut TestAppContext,
|
||||
selector: &'static str,
|
||||
build: impl Fn(&mut Window, &mut App) -> AnyElement + 'static,
|
||||
) -> Pixels {
|
||||
let (_, cx) = cx.add_window_view(|_, _| Narrow(Box::new(build)));
|
||||
cx.run_until_parked();
|
||||
cx.debug_bounds(selector).expect(selector).size.width
|
||||
}
|
||||
Reference in new issue
Block a user