docs: clarify incremental layout and pixel sampling regressions

This commit is contained in:
2026-11-12 21:12:57 +08:00
parent 435ec3b8be
commit 831d013f75
+10 -6
View File
@@ -4328,6 +4328,7 @@ fn incremental_event_runs_callback_once_before_publishing_its_layout() {
session.execute("count.value", "app.main").unwrap().value,
"1"
);
// refreshYields 是当前会话累计计数,>0 证明曾让出,不给出这一次事件单独贡献的切片次数。
assert!(source_measure_stat(&mut session, "refreshYields") > 0);
}
@@ -4558,6 +4559,7 @@ fn bridge_layout_can_return_pending_before_committing_a_complete_frame() {
));
assert!(session.candidate.vm.has_suspended_call());
// 按返回状态继续推进,只有 Complete 分支允许读取最终几何。
// 此 loop 没有测试侧轮数/墙钟截止时间,终止依赖真实 VM/布局预算与完成契约;不能称作有界轮询助手。
loop {
// Pending 携带尚未完成的独占工作;Complete 则携带可检查的完整帧。
match progress {
@@ -4812,7 +4814,7 @@ fn weighted_flex_remeasures_children_and_updates_live_weights() {
#[test]
/// 表驱动切换 start/center/end/space-between,逐项比较两个子项的 x。
/// 子项宽度始终为自然宽度,mainAlign 只分配剩余间隙,不应被误当成 flex 拉伸。
/// 本例逐轮检查首项宽度仍为 20;第二项只检查 x,没有对其宽度作独立断言。
fn main_alignment_updates_live_geometry_without_changing_sizes() {
// 固定父宽 300、左右 padding 各 10,两子项自然宽 20/40、基础间距 10,留出可对齐的剩余空间。
let (mut session, initial) = ReplSession::load(r#"
@@ -4974,7 +4976,7 @@ fn cross_alignment_preserves_source_placements_and_starts_overflow() {
.value,
"7"
);
// 子宽 40 大于父宽 10,center 应从起点溢出,不能用负剩余空间计算出负偏移。
// 夹具子项自然宽为 40、父测量宽为 10;这里断言最终 x=0,没有再断言实际分配宽度或溢出像素。
assert_eq!(
session
.execute("second.mounts().at(0).bounds().x", "app.main")
@@ -5166,7 +5168,7 @@ fn fill_wraps_text_inside_finite_column_and_rejects_unbounded_axis() {
#[test]
/// 让子按钮超出带左边框且 overflow=clip 的固定 Row。
/// 子 Mount 保留原几何,但 clip 仅覆盖父内容区域;命中在原按钮矩形内也应因裁剪而失败。
/// 检查子 Mount 的位置、clip 和整帧 hit_test 拒绝;此用例不调用软件光栅化或派发源回调。
fn clipping_a_box_limits_descendant_paint_and_hit_geometry() {
// 固定 Row 宽 60 且左边框宽 2,前项先占宽 100,后按钮保留位于父内容区之外的原几何。
let (_, initial) = ReplSession::load(r#"
@@ -5301,7 +5303,7 @@ fn box_layout_example_runs_through_the_real_source_pipeline() {
#[test]
/// 固定 Overlay 按内容高度拉伸子项,再受 margin/maxHeight 限制得到 50。
/// 改为显式 boxHeight 后使用 15,证明显式尺寸优先于 stretch,覆盖层不按线性子项重排。
/// 改为显式 boxHeight 后使用 15,证明显式尺寸优先于 stretch;本例未独立比较兄弟项前后位置。
fn overlay_stretch_allocates_each_occurrence_without_reflowing_its_siblings() {
// Overlay 高 80 扣上下 padding 10 和 child 顶 margin 3,stretch 原可分配 67,再受 maxHeight=50 限制。
let (mut session, initial) = ReplSession::load(
@@ -5457,6 +5459,7 @@ fn two_canvas_viewports_share_a_scene_with_independent_explicit_cameras() {
.document
.unwrap();
// 验证新帧并检查所有交互出现都采用 zoom=2,区分显式共享和初始默认独立。
// all 只校验枚举到的项目;这一分支没有再次断言交互出现数,数量基线由前面的初始帧检查建立。
shared.validate().unwrap();
assert!(
shared
@@ -5558,7 +5561,7 @@ fn nested_canvas_projects_pixels_and_hits_while_overlay_ui_stays_fixed() {
200,
)
.unwrap();
// HUD 原点蓝色保持固定;场景采样与远处背景不同,证明平移后的内容确实被绘出。
// HUD 采样点必须为蓝色;另一点只要求与远处背景不同,没有断言具体按钮颜色或整图一致性。
assert_eq!(pixels[5 * 200 + 5], 0x0000FF);
assert_ne!(pixels[55 * 200 + 45], pixels[190 * 200 + 190]);
}
@@ -5596,7 +5599,8 @@ fn canvas_world_paint_is_zoomed_and_clipped_in_the_software_renderer() {
80,
)
.unwrap();
// 依次核对固定蓝层、可见红块、视口外背景以及矩形右侧背景,捕获缩放或裁剪遗漏。
// 依次核对固定蓝层、可见红块和两个背景对照点;背景按输出右下角取样,不绑定固定底色。
// 这是指定像素的光栅回归,不覆盖全部边缘、所有 DPI 或完整图像差分。
assert_eq!(pixels[5 * 80 + 5], 0x0000FF);
assert_eq!(pixels[25 * 80 + 5], 0xFF0000);
assert_eq!(pixels[55 * 80 + 5], pixels[79 * 80 + 79]);