fix: refresh nested flex measurements after cross-axis constraint changes
Verify Tessera GUI / verify (push) Failing after 9m2s

This commit is contained in:
2026-10-23 00:50:15 +08:00
parent 1fda07ebc5
commit 33f94da927
6 changed files with 92 additions and 4 deletions
+39
View File
@@ -3889,6 +3889,45 @@ page.render(block)
);
}
#[test]
fn nested_flex_refreshes_natural_height_when_cross_width_changes() {
let (mut session, initial) = ReplSession::load(
r#"
class Narrow: Row {
function measure(self: Narrow, mount: Mount, constraints: Constraints): MeasureResult { return MeasureResult(240, 400) }
}
paragraph = TextBlock("Changing the parent's width must refresh the natural height of this wrapping paragraph. The first wide measurement must not freeze a single line of text. Changing the parent's width must refresh the natural height of this wrapping paragraph.")
paragraph.flexShrink = 1
column = Column(0, 0, paragraph)
column.flex = 1
page = Page()
page.render(Narrow(10, 0, column))
"#,
"app.main",
268,
1,
)
.unwrap();
initial.validate().unwrap();
let height: f32 = session
.execute("paragraph.mounts().at(0).bounds().height", "app.main")
.unwrap()
.value
.parse()
.unwrap();
assert!(height > 20.0);
session
.execute("paragraph.setText(\"short\")", "app.main")
.unwrap();
assert_eq!(
session
.execute("paragraph.mounts().at(0).bounds().height", "app.main")
.unwrap()
.value,
"20"
);
}
#[test]
fn bounded_flex_redistributes_growth_and_scaled_shrink() {
let (mut session, initial) = ReplSession::load(