docs: clarify rendering contract and event regression evidence
This commit is contained in:
@@ -2898,11 +2898,13 @@ fn source_paint_rejects_business_mutation_before_it_happens_and_restores_scope()
|
||||
// 另用独立加载检查无效颜色的命令解码错误,与上面的业务写入拒绝分开覆盖。
|
||||
let bad_color =
|
||||
include_str!("../../../examples/source-paint.endor").replace("#ED6A5A", "invalid color");
|
||||
// 这里只断言加载失败,没有核对诊断内容;不能单凭此断言证明失败一定来自颜色解码。
|
||||
assert!(ReplSession::load(&bad_color, "app.main", 73, 1).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// 生成 1100 个共享 rect 出现位置,使 Mount 变更通知超过单批容量。
|
||||
/// 生成 1100 个共享 rect 出现位置,对有限容量的 Mount 变更批次施加压力。
|
||||
/// 本测试不读取溢出标志或批次条数;直接断言的是命令完整性与下一次空刷新稳定性。
|
||||
/// 首次仍需完整产出 1100 条命令,随后无变更刷新为 None,避免通知溢出造成永久重绘。
|
||||
fn source_paint_is_stable_when_mount_notifications_overflow_the_change_batch() {
|
||||
// 复用源 paint 类与共享 rect 的定义,保留实际依赖读取行为。
|
||||
@@ -2911,7 +2913,7 @@ fn source_paint_is_stable_when_mount_notifications_overflow_the_change_batch() {
|
||||
let mut source = fixture[..fixture.find("root = Column").unwrap()].to_owned();
|
||||
// 创建一个无内边距和间距的 Column,使命令数量直接对应共享 rect 的出现次数。
|
||||
source.push_str("root = Column(0, 0");
|
||||
// 1100 次出现使 Mount 通知超过单批容量;每次追加的是同一业务对象引用。
|
||||
// 每次追加同一业务引用,扩大 Mount 及相关属性通知规模;1100 是出现数,不是直接测得的通知条数。
|
||||
for _ in 0..1100 {
|
||||
source.push_str(", rect");
|
||||
}
|
||||
@@ -2925,7 +2927,7 @@ fn source_paint_is_stable_when_mount_notifications_overflow_the_change_batch() {
|
||||
|
||||
#[test]
|
||||
/// 检查可选原生构造参数、可变子项和源子类字段在同一构造中的独立分段。
|
||||
/// 错误类型在分配前拒绝,Block 数量不增;合法回调有效,并逐一验证已公开 UI 方法的 native signature。
|
||||
/// 错误调用被拒绝且最终 Block 数量不增;合法回调有效,并验证下方显式列出的 UI 方法具有有效 native signature。
|
||||
fn constructor_options_and_subclass_fields_have_independent_contracts() {
|
||||
// 加载省略可选原生参数、带源子类字段及可变子项的组合示例,走真实构造入口。
|
||||
let (mut session, document) = ReplSession::load(
|
||||
@@ -2954,7 +2956,7 @@ fn constructor_options_and_subclass_fields_have_independent_contracts() {
|
||||
"{expression}"
|
||||
);
|
||||
}
|
||||
// 保存非法构造前的 Block 数量,后面检查类型拒绝是否发生在原生分配副作用之前。
|
||||
// 保存非法调用前的 Block 数量,后面比较最终保留数;计数相同本身不能排除中途分配后又回收。
|
||||
let blocks = session
|
||||
.execute("ui.stats().blocks", "app.main")
|
||||
.unwrap()
|
||||
@@ -2992,7 +2994,7 @@ fn constructor_options_and_subclass_fields_have_independent_contracts() {
|
||||
session.execute("rect.color", "app.main").unwrap().value,
|
||||
"\"#237A45\""
|
||||
);
|
||||
// 逐个检查公开 UI 入口的 native signature,防止仅部分函数注册了契约元数据。
|
||||
// 检查下方固定名单的签名元数据;没有遍历 ui 全部属性,因此不是所有公开入口的完整覆盖。
|
||||
for name in [
|
||||
"open",
|
||||
"present",
|
||||
@@ -3135,7 +3137,7 @@ fn nullable_page_methods_union_event_options_and_nominal_mount_bounds_compose()
|
||||
|
||||
#[test]
|
||||
/// 向 measure/paint、几何方法、resize 和 setColor 传递错误名义类型。
|
||||
/// 检查每项错误点名所需类型,业务颜色保持不变,随后合法 Constraints 测量仍返回受限宽度。
|
||||
/// 检查每项错误点名所需类型,保存的颜色探测值不变,随后合法 Constraints 测量仍返回受限宽度。
|
||||
fn native_contracts_reject_wrong_types_before_geometry_or_window_effects() {
|
||||
// 先加载合法页面,以有效业务对象为前提逐项测试原生接口的参数类型边界。
|
||||
let (mut session, _) = ReplSession::load(
|
||||
@@ -3175,7 +3177,8 @@ fn native_contracts_reject_wrong_types_before_geometry_or_window_effects() {
|
||||
"{expression}: {error:#}"
|
||||
);
|
||||
}
|
||||
// 先核对示例保存的原始颜色结果仍正确,再执行合法 Constraints 测量确认会话继续可用。
|
||||
// results.color 是 onMount 保存的探测值,不是重新读取 rect 当前颜色;此断言不单独证明 rect.color 未变。
|
||||
// 随后的合法 Constraints 测量验证会话继续可用。
|
||||
assert_eq!(
|
||||
session.execute("results.color", "app.main").unwrap().value,
|
||||
"\"#DDEEFF\""
|
||||
@@ -3526,7 +3529,7 @@ fn event_session(extra: &str) -> (ReplSession, RenderDocument) {
|
||||
ReplSession::load(&source, "app.main", 41, 1).unwrap()
|
||||
}
|
||||
|
||||
/// 按全局 button 的业务身份找给定文档中的可交互 Mount,模拟原生 click。
|
||||
/// 按全局 button 的业务身份找给定文档中的可交互 Mount,构造无坐标的运行时 click。
|
||||
/// 事件使用该文档的会话与布局版本,返回派发后的完整文档,避免用过期目标绕过真实输入检查。
|
||||
fn click_document(session: &mut ReplSession, document: &RenderDocument) -> RenderDocument {
|
||||
// 事件测试助手从当前会话的名字表取得 button,保持业务身份与输入目标一致。
|
||||
@@ -3713,6 +3716,7 @@ fn event_failure_releases_dispatch_guard_and_token_does_not_retain_target() {
|
||||
.is_err()
|
||||
);
|
||||
// 先移除故障回调,再用同一 Event 成功派发;若守卫泄漏,会误报重复派发。
|
||||
// 本例未在首次失败后断言 phase/currentTarget 已复位;异常释放弱守卫不等于正常末尾 Finish 已执行。
|
||||
session
|
||||
.execute(
|
||||
"failing.disconnect()\nbutton.dispatch(failedEvent)",
|
||||
|
||||
Reference in New Issue
Block a user