ui-patterns: the path row test checks the Browse button against the column width

The fixture's shown rect grows with whatever the row allocates, so a
button that overflowed the column also widened it and the check passed.
The room starts at x = 0, so the test now compares the button's right
edge with the requested width.
This commit is contained in:
dotCooCoo committed 2026-11-28 19:28:09 -08:00
1 parent 07a8c471ed
commit 929dc7b794
1 file changed
+1 -2
@@ -20,13 +20,12 @@ fn row_in(width: f32) -> Fixture {
fn browse_shows_its_whole_label_inside_a_narrow_column() {
for width in [360.0, 260.0, 200.0] {
let fixture = row_in(width);
let shown = fixture.shown();
let label = fixture.texts().iter().find(|run| run.text == "Browse…").cloned();
let label = label
.unwrap_or_else(|| panic!("{width}: Browse… is painted: {:?}", fixture.texts().iter().map(|run| run.text.clone()).collect::<Vec<_>>()));
assert!(!label.elided, "{width}: the Browse label is not cut");
let button = fixture.by_label("Browse…").expect("the Browse button");
assert!(button.rect.right() <= shown.right() + 0.5, "{width}: the button {:?} ends inside the column {shown:?}", button.rect);
assert!(button.rect.right() <= width + 0.5, "{width}: the button {:?} ends inside the column of width {width}", button.rect);
assert!(
label.rect.left() >= button.rect.left() - 0.5 && label.rect.right() <= button.rect.right() + 0.5,
"{width}: the label {:?} lies inside the button {:?}",