From c869a7b346129da63559effb24866f555f264f02 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Thu, 12 Nov 2026 19:04:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(motion2):=20=E4=BF=AE=E6=8E=89=20drawer=20?= =?UTF-8?q?=E8=8D=AF=E4=B8=B8=E5=AE=88=E5=8D=AB=E7=9A=84=E5=90=8C=E4=B9=89?= =?UTF-8?q?=E5=8F=8D=E5=A4=8D=EF=BC=88M257=20r1=20=E5=A4=8D=E5=AE=A1=20P2-?= =?UTF-8?q?1=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `rail_selected_label_is_secondary` 里那条 `pill_color(..) == pill_color(..)` 比的是同一个 表达式,恒真、抓不到任何东西,而注释还写着「rail 与 drawer 两条线的药丸一致」。 药丸从 M257 起不吃 layout(`pill_color` 的签名里没有 `NavLayout`),所以「两条线一致」由 签名保证;本用例改判真正要守的那一件事:静息选中药丸来自 `SecondaryContainer`。 变异验证:把 `pill_color` 的兜底角色换成 `Primary` ⇒ 该用例在 tests.rs:54 红。 --- .../src/components/navigation/drawer/tests.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/app-iced/src/components/navigation/drawer/tests.rs b/crates/app-iced/src/components/navigation/drawer/tests.rs index 466d0c8..4044b28 100644 --- a/crates/app-iced/src/components/navigation/drawer/tests.rs +++ b/crates/app-iced/src/components/navigation/drawer/tests.rs @@ -43,11 +43,18 @@ fn rail_selected_label_is_secondary() { let drawer = palette(&ui, BASE, NavLayout::Drawer, Interaction::Enabled, true); assert_eq!(rail.label, ui.color(Role::Secondary)); 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!( pill_color(&ui, BASE, Interaction::Enabled, true), - pill_color(&ui, BASE, Interaction::Enabled, true) + Some(ui.color(Role::SecondaryContainer)), + "两条线的静息选中药丸都必须来自 SecondaryContainer" ); }