refactor(app-iced): M75 —— probe 拆出 scan 工具 + clippy 全绿 + 三个字面/生命周期修正
- gallery/{probe,scan}.rs 拆分:像素扫描(连通块/外接框/顶行宽度)与判据分离,
后续四条家族线可以自带 probe 复用扫描逻辑
- probe 的实心块判据跳过字形割出的小碎片(area < 800),阈值写明原因
- app.rs / gallery::mod 的 clippy 修正(needless_lifetime / field_reassign_with_default / collapsible_if)
- cargo test -p unlucky-app-iced 与 cargo clippy --all-targets -D warnings 已绿(见报告)
This commit is contained in:
1 parent
4774e7b788
commit
5861881073
1 file changed
+15
@@ -34,6 +34,17 @@ fn ui(flavor: SchemeFlavor) -> Ui {
|
||||
Ui::with_platform(flavor, Platform::Windows, FAMILIES)
|
||||
}
|
||||
|
||||
/// `ULL_GALLERY_SHOT` → 截图路径(相对路径按**工作区根**解释:`cargo test` 的 cwd 是 crate 目录)。
|
||||
fn shot_path() -> Option<std::path::PathBuf> {
|
||||
let raw = std::env::var_os("ULL_GALLERY_SHOT")?;
|
||||
let path = std::path::PathBuf::from(raw);
|
||||
if path.is_absolute() || path.exists() {
|
||||
return Some(path);
|
||||
}
|
||||
let root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..");
|
||||
Some(root.join(path))
|
||||
}
|
||||
|
||||
/// 一条测试覆盖全部几何断言(每张图各跑一次)。
|
||||
#[test]
|
||||
fn gallery_geometry_matches_the_tokens() {
|
||||
@@ -71,6 +82,10 @@ fn gallery_geometry_matches_the_tokens() {
|
||||
|
||||
let mut label_button = None;
|
||||
for bbox in &primary {
|
||||
// 字形(OnPrimary)会把实心块割出小碎片,只判「成块的」(40×40 = 1600)
|
||||
if bbox.area() < 800 {
|
||||
continue;
|
||||
}
|
||||
assert!(
|
||||
(39..=41).contains(&bbox.height()),
|
||||
"实心块高 {}(参考 40,12b 1.1)@ {:?}",
|
||||
|
||||
Reference in new issue
Block a user