fix(motion2): 修掉 drawer 药丸守卫的同义反复(M257 r1 复审 P2-1)
`rail_selected_label_is_secondary` 里那条 `pill_color(..) == pill_color(..)` 比的是同一个 表达式,恒真、抓不到任何东西,而注释还写着「rail 与 drawer 两条线的药丸一致」。 药丸从 M257 起不吃 layout(`pill_color` 的签名里没有 `NavLayout`),所以「两条线一致」由 签名保证;本用例改判真正要守的那一件事:静息选中药丸来自 `SecondaryContainer`。 变异验证:把 `pill_color` 的兜底角色换成 `Primary` ⇒ 该用例在 tests.rs:54 红。
This commit is contained in:
1 parent
b61f342431
commit
c869a7b346
1 file changed
+10
-3
@@ -43,11 +43,18 @@ fn rail_selected_label_is_secondary() {
|
|||||||
let drawer = palette(&ui, BASE, NavLayout::Drawer, Interaction::Enabled, true);
|
let drawer = palette(&ui, BASE, NavLayout::Drawer, Interaction::Enabled, true);
|
||||||
assert_eq!(rail.label, ui.color(Role::Secondary));
|
assert_eq!(rail.label, ui.color(Role::Secondary));
|
||||||
assert_ne!(rail.label, drawer.label, "两条线的选中标签角色不同");
|
assert_ne!(rail.label, drawer.label, "两条线的选中标签角色不同");
|
||||||
// 但图标与药丸相同(同一套语言)
|
// 图标与药丸相同(同一套语言)。
|
||||||
assert_eq!(rail.icon, drawer.icon);
|
//
|
||||||
|
// 复审 P2-1:这里原先写成 `pill_color(..) == pill_color(..)`——比的是同一个表达式,恒真,
|
||||||
|
// 抓不到任何东西(注释却还在说「两条线的药丸一致」)。药丸从 M257 起**不吃 layout**
|
||||||
|
// (`pill_color` 的签名里根本没有 `NavLayout`),所以「两条线一致」由**签名**保证;
|
||||||
|
// 本用例改判真正要守的那件事:静息选中药丸就是 `SecondaryContainer` 这一档
|
||||||
|
// (换成 `Primary` 立刻红,变异原文见 M257 r2 报告)。
|
||||||
|
assert_eq!(rail.icon, drawer.icon, "图标与布局无关");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pill_color(&ui, BASE, Interaction::Enabled, true),
|
pill_color(&ui, BASE, Interaction::Enabled, true),
|
||||||
pill_color(&ui, BASE, Interaction::Enabled, true)
|
Some(ui.color(Role::SecondaryContainer)),
|
||||||
|
"两条线的静息选中药丸都必须来自 SecondaryContainer"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user