feat(app-iced): 下载页在选 LiteLoader 时给中性说明(GUI 只叠原版、Forge 组合走 CLI)

新增 Key::DownloadOptionsLiteLoaderVanillaOnly(中英各一句,不含花括号占位符);
金表按 Key::ALL 的真实位置插入(DownloadOptionsNeedsAtLeast 之后、DownloadCancelled 之前),
只加新键不重排旧键。说明走 OptionsView 的新字段 note,不塞 problem(那是错误色 + 禁用确认)。
This commit is contained in:
AskaEth committed 2026-11-10 19:34:10 +08:00
1 parent 7ed954f7fa
commit c8bf536c37
5 files changed
+91

No files matched your search

@@ -272,3 +272,61 @@ fn installed_versions_cannot_be_confirmed_again() {
assert!(options.installed);
assert!(!options.can_confirm);
}
/// 中性说明(M222):只有 LiteLoader 带「这里只叠原版」那条,且它**不影响**确认键。
///
/// 抓得住:说明被塞进 `problem`(会让用户以为不能装、确认键按不下去);或者说明跑到别家
/// 加载器下面(Forge/Fabric 没有这条边界)。
#[test]
fn liteloader_carries_a_neutral_note_without_blocking_confirm() {
let state = state_with(
LoaderKind::LiteLoader,
"1.12.2",
Ok(vec!["1.12.2-SNAPSHOT"]),
);
let options = OptionsView::of(
&row("1.12.2", VersionKind::Release),
&state,
&draft(Loader::LiteLoader),
Lang::En.catalog(),
);
let note = options.note.as_deref().expect("LiteLoader 应带中性说明");
assert!(note.contains("vanilla"), "{note}");
assert!(
note.contains("--loader liteloader"),
"要给出可执行的下一步:{note}"
);
assert!(options.problem.is_none(), "中性说明不能变成错误");
assert!(options.can_confirm, "说明不该禁用确认键");
// 中文目录同样给中文说明,且仍然不禁用确认键。
let zh = state_with(
LoaderKind::LiteLoader,
"1.12.2",
Ok(vec!["1.12.2-SNAPSHOT"]),
);
let options = OptionsView::of(
&row("1.12.2", VersionKind::Release),
&zh,
&draft(Loader::LiteLoader),
Lang::ZhCn.catalog(),
);
let note = options.note.as_deref().expect("中文也要有说明");
assert!(note.contains("原版"), "{note}");
assert!(options.can_confirm);
// 别家加载器不带这条说明。
for loader in [Loader::Vanilla, Loader::Fabric, Loader::Forge] {
let state = state_with(loader.kind(), "1.20.1", Ok(Vec::new()));
let options = OptionsView::of(
&row("1.20.1", VersionKind::Release),
&state,
&draft(loader),
Lang::En.catalog(),
);
assert!(
options.note.is_none(),
"{loader:?} 不该带 LiteLoader 的说明"
);
}
}