diff --git a/src/runtime/endor_host/tests.rs b/src/runtime/endor_host/tests.rs index 08114f5..137f479 100644 --- a/src/runtime/endor_host/tests.rs +++ b/src/runtime/endor_host/tests.rs @@ -7330,7 +7330,7 @@ fn matching_present_method_does_not_implicitly_declare_presentable() { session.execute("marker.value", "app.main").unwrap().value, "1" ); - // 保存已发布文档集合,接下来注册缺少 present 的类型必须失败且不替换现有帧。 + // 克隆文档集合供后面对照,但实际断言只比较主窗 layout_version;不逐字段比较整个集合。 let before = session.documents.clone(); // Missing 没有实现能力方法,注册失败属于可恢复输入错误,不能发布半成品页面。 assert!( @@ -7381,6 +7381,7 @@ fn managed_property_bindings_update_hidden_objects_and_shared_window_geometry() "140" ); // 将同一 rect 挂到两个窗口,之后一次业务 width 更新应传播到两份出现几何。 + // 下方每帧按 width=260 查任一 Mount,未同时按 rect 身份筛选;这是此固定夹具的几何回归。 session.execute("first = Page()\nfirst.render(rect)\nother = Window()\nsecond = Page()\nsecond.open(other)\nsecond.render(rect)", "app.main").unwrap(); // 把模型改为 260,正常刷新返回主窗口及其他窗口的新文档。 let updated = session @@ -7569,6 +7570,7 @@ fn source_render_caches_do_not_root_a_page_block_waiting_frame_cycle() { // 子项也用弱引用检查,防止只回收页面而缓存仍意外保留业务 Block。 let rect_weak = session.candidate.vm.object_store().downgrade(rect).unwrap(); // 仅关闭展示不等于释放业务引用,pending 仍 running;不能把这种存活误判为缓存泄漏。 + // 示例 spawn/sleep 的 owner 是 CycleRect,不是 Page;Page.close 不取消仍由业务引用保留的这个 owner。 session.execute("holder.value.close()", "app.main").unwrap(); assert_eq!( session @@ -7735,7 +7737,7 @@ fn closing_a_page_releases_its_root_without_retaining_it_through_shared_content( let weak = session.candidate.vm.downgrade(page).unwrap(); // 第一次关闭后仍保留 page 全局引用,允许修改隐藏内容并重开验证页面可复用。 session.execute("page.close()", "app.main").unwrap(); - // 隐藏时改原 card;后面重开仍应正常发布,不要求重新创建内容。 + // 隐藏时改原 card,后面只要求重开返回文档;此用例没有断言新文档命令一定采用 #FFEEDD。 session .execute("card.setColor(\"#FFEEDD\")", "app.main") .unwrap(); @@ -8223,7 +8225,8 @@ fn executes_aster_functions_and_renders_after_vm_cleanup() { &document.frame.commands[3], RenderCommand::Text { x, y: 168.0, .. } if (*x - (24.0 + first_width + 12.0 + 8.0 + 12.0)).abs() < 0.01 )); - // compile 已清理候选 VM;以下重绘只能使用发布的原生数据,两种显示倍率都不能再依赖 VM 对象。 + // compile 已清理候选 VM;下面构造两种倍率的显示列表并检查命令数,未调用 SoftwareRenderer 写像素。 + // 验证的是发布数据在 VM 清理后仍可用于显示列表投影,不是两种倍率的像素正确性。 assert_eq!(document.display_list(1.0).unwrap().commands().len(), 5); assert_eq!(document.display_list(2.0).unwrap().commands().len(), 5); } @@ -8364,7 +8367,7 @@ fn construction_and_expanded_layout_have_separate_budgets() { #[test] /// 构造 64 层嵌套容器包住一个文字,完整编译后仍应有一条文字命令。 -/// 验证允许的深度不会因宿主遍历截断而悄悄丢掉叶节点。 +/// 验证这个深度的叶节点仍保留;不测试第 65 层,也不能从此推导 64 是当前实现的最大深度。 fn managed_ui_depth_is_not_truncated_at_64_levels() { // 生成单链而非二叉展开,隔离深度可用性与宽度/节点数量预算。 let mut source = "function node0(): View { return ui.text(\"x\") }\n".to_owned(); @@ -8467,7 +8470,8 @@ fn shutdown_unmounts_all_windows_once_and_cancels_tasks() { let (mut session, _) = ReplSession::load(EXIT_SOURCE, "app.main", 701, 1).unwrap(); // 退出前卸载次数为零,避免把加载期行为算作 shutdown 的清理结果。 assert_eq!(exit_log(&session), Value::Number(0_i64.into())); - // 真实 shutdown 返回资源清理统计;窗口应恰好两处,Mount/任务至少覆盖夹具创建的资源。 + // shutdown 返回窗口数、处理前活动 Mount 数及 quiesce 处理的任务项数;不是 source onUnmount 的调用次数。 + // 实际源通知次数由下方 exit_log=2 单独核对,不能把资源计数与通知计数混用。 let (windows, mounts, tasks) = session.shutdown().unwrap(); assert_eq!(windows, 2); assert!(mounts >= 2); @@ -8595,14 +8599,14 @@ page.zoom=2 .iter() .filter(|mount| mount.interactive) .collect(); - // 两处出现均保留负世界坐标,表面另记录 panX=-160 和 zoom=2。 + // 先检查两处身份关系;坐标只显式检查第一个 Mount,表面另记录 panX=-160 和 zoom=2。 assert_eq!(mounts.len(), 2); assert_eq!(mounts[0].block_id, mounts[1].block_id); assert_ne!(mounts[0].id, mounts[1].id); assert_eq!((mounts[0].x, mounts[0].y), (-120.0, 90.0)); assert_eq!(initial.frame.surface.pan.x, -160.0); assert_eq!(initial.frame.surface.zoom, 2.0); - // 写同一业务 item 的 x/y,两处出现都应更新为 (500,-60),不能只移动首个 Mount。 + // 写同一业务 item 的 x/y,后面用 all 检查当前所有 interactive 项的坐标;此分支未再次断言数量为 2。 let next = session .execute("item.x=500\nitem.y=-60", "app.main") .unwrap()