Gradient: measure Freeform Gradient in the narrow-panel test

The narrow-panel test now measures the fifth Type button and holds it to
the 2 pt it reaches past the panel at the narrowest width, since
`Segmented` keeps its segments on one line. The doc comment states the
overflow instead of saying the whole Type row stays inside the panel.
This commit is contained in:
dotCooCoo committed 2026-11-25 14:01:44 -08:00
1 parent 5a54b17194
commit d30f0d863e
1 file changed
+11 -2
+11 -2
View File
@@ -451,9 +451,13 @@ fn the_gradient_panel_stays_inside_its_dock_column() {
}
/// In a panel at the narrowest panel width the Type, Method, Spread and stop rows wrap: their controls stay inside
/// the panel.
/// the panel, except the last type button. The five type buttons are one `Segmented` control, which keeps its
/// segments on one line, so at this width Freeform Gradient reaches 2 pt past the panel's right edge. The test
/// holds that button to the 2 pt until the widget can wrap its segments.
#[test]
fn the_gradient_rows_wrap_in_a_narrow_panel() {
/// How far Freeform Gradient reaches past the panel's right edge at the narrowest width.
const TYPE_OVERFLOW: f32 = 2.0;
let names = [
"Linear Gradient",
"Radial Gradient",
@@ -468,9 +472,14 @@ fn the_gradient_rows_wrap_in_a_narrow_panel() {
"Delete Stop",
];
for lang in ["en", "fr"] {
let panel = shown(lang, Place::Floating(crate::panel_docking::PANEL_MIN_WIDTH), select_a_stop, &names);
let asked: Vec<&'static str> = names.iter().copied().chain(["Freeform Gradient"]).collect();
let panel = shown(lang, Place::Floating(crate::panel_docking::PANEL_MIN_WIDTH), select_a_stop, &asked);
let past = panel.past(names.iter().flat_map(|name| panel.rects(name).into_iter().map(|r| (name.to_string(), r))));
assert!(past.is_empty(), "past the panel in {lang}: {past:?}");
for freeform in panel.rects("Freeform Gradient") {
let inside = freeform.left() >= panel.body.left() - 0.5 && freeform.right() <= panel.body.right() + TYPE_OVERFLOW + 0.5;
assert!(inside, "Freeform Gradient at {freeform:?} is more than {TYPE_OVERFLOW} pt past {:?} in {lang}", panel.body);
}
}
}