From f9877a89d8cf61576f037f323fae88b6907ef64b Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 10 Nov 2026 23:30:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(app-iced):=20=E4=B8=8B=E8=BD=BD=E9=A1=B5?= =?UTF-8?q?=E9=A1=B5=E5=A4=B4=E3=80=8C=E5=86=85=E5=AE=B9=E5=BA=93=E3=80=8D?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=80=81=E5=8F=8D=E8=BD=AC=EF=BC=88M229=20?= =?UTF-8?q?=E5=A4=8D=E5=AE=A1=20F3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `pages/content.rs::section_switcher` 把 `on_content` 写死成 `true`,而下载页也调它, 于是版本管理页的页头把「内容库」画成选中、「版本管理」画成未选中。 改成由调用方给位置:下载页传 false、内容库页自己传 true;并加一条源码层面的调用点断言 (iced 的 Element 不可内省,判据只有一行,写错必红)。 不是 M229 引入的缺陷(M109 就有),按复审要求单独提交,不与收官换肤混在一起。 --- crates/app-iced/src/pages/content.rs | 6 +++++- crates/app-iced/src/pages/content/tests.rs | 19 +++++++++++++++++++ crates/app-iced/src/pages/download.rs | 4 +++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/crates/app-iced/src/pages/content.rs b/crates/app-iced/src/pages/content.rs index 6d58ce8..2a9b1bc 100644 --- a/crates/app-iced/src/pages/content.rs +++ b/crates/app-iced/src/pages/content.rs @@ -105,9 +105,13 @@ pub fn demo(kind: ContentKind, lang: Lang) -> Content { } /// 页头那条一级切换(版本管理页也要用同一个函数:两页共用一个入口才不会各画一套)。 +/// +/// `on_content` 是**调用方自己**的位置:内容库页传 `true`、版本管理页传 `false`。 +/// M229 复审 F3 之前这里写死 `true`,于是下载页页头的「内容库」也画成选中态(选中态反了)。 pub(crate) fn section_switcher<'a>( ui: &'a Ui, catalog: unlucky_i18n::Catalog, + on_content: bool, ) -> Element<'a, PageMessage> { - parts::section_switcher(ui, catalog, true) + parts::section_switcher(ui, catalog, on_content) } diff --git a/crates/app-iced/src/pages/content/tests.rs b/crates/app-iced/src/pages/content/tests.rs index 5b1453f..1555846 100644 --- a/crates/app-iced/src/pages/content/tests.rs +++ b/crates/app-iced/src/pages/content/tests.rs @@ -98,3 +98,22 @@ fn the_default_demo_screen_has_no_retry_surface() { ); } } + +/// M229 复审 F3 的回归门:页头一级切换的选中态由**调用方所在页**决定,不是写死「内容库」。 +/// +/// 抓得住:`download.rs` 又传回 `true`(下载页页头的「内容库」被画成选中,正是 F3 的现场)。 +/// 抓不住:像素长什么样(那要截图);iced 的 `Element` 不可内省,所以这条从源码层面钉住调用点—— +/// 判据只有一行,读的人也不会误解。 +#[test] +fn the_download_header_marks_versions_selected_not_content() { + let download = include_str!("../download.rs"); + assert!( + download.contains("section_switcher(ui, catalog, false)"), + "下载页是「版本管理」那一侧,必须传 false(传 true = F3 复发)" + ); + let content_view = include_str!("view.rs"); + assert!( + content_view.contains("section_switcher(ui, catalog, true)"), + "内容库页自己那一份必须传 true" + ); +} diff --git a/crates/app-iced/src/pages/download.rs b/crates/app-iced/src/pages/download.rs index 107c456..37fb11d 100644 --- a/crates/app-iced/src/pages/download.rs +++ b/crates/app-iced/src/pages/download.rs @@ -187,7 +187,9 @@ pub fn view_sized<'a>( .subtitle(catalog.text(Key::DownloadSubtitle)) // M109:一级切换「版本管理 | 内容库」。两页共用同一条导航轨项(`NavSection::Download`), // 所以这个切换是进内容库的唯一产品入口——少了它,内容库只能靠 `ULL_START_ROUTE` 到达。 - .action(content::section_switcher(ui, catalog)) + // 本页是「版本管理」那一侧:`on_content = false`(传 true 会让「内容库」画成选中, + // 这正是 M229 复审 F3 的现场)。 + .action(content::section_switcher(ui, catalog, false)) .action(buttons::text( ui, Button::new(