fix(app-iced): IconButton Outlined 真的画环 + ELEVATED CARD 值串单行(M229 复审 P1)
P1-1:`icon()` 把 `StyleSpec.stroke` 写死 `0.0`,`IconVariant::Outlined` 的描边角色只到 `roles()` 为止、没画出来 —— Outlined 与 Plain 逐像素相同。改成「有描边角色就是 1px」, 并把「角色 → 填充/内容/描边」抽成 `icon_style_spec()`(`icon()` 直接吃它),单测因此能断言 **接线**而不只是断言 `icon_stroke()` 这个纯函数(第一版正是这样漏掉调用点的)。 回归门两条:纯函数/接线(`buttons/tests/icon.rs`,变异回 0.0 时红)+ 渲染层 (`gallery/probe/rows.rs`:图标按钮左缘 4px 带里 Outlined 有环墨、Plain 必须 0 px; 变异后重出图再跑会红)。环在软渲染里是 Outline 叠画布的抗锯齿混色(实测 110/124/110, 本体 123/138/123),所以判据是「这一带有墨/没墨」而不是颜色匹配。 P1-2:ELEVATED CARD 内距 24 + 值 16px 让「2026-10-29 19:22 UTC」折行,同排卡底不齐; 旧测试还断言 20/14(不变量 118+2×padding ≤ 160 变成 166 > 160,假绿)。 按塔裁决「收内距/字号、不破卡片宽度契约」:`PAD` 24 → 20(= card_padding)、值字级 → BodySmall 12。 量测:时戳 14px 墨水宽 138px(160 外框内宽 120 放不下)、12px 为 118px(放得下,余 2px)。 测试改成四条绑一起(字级 12 / 内距 20 / 160−2×PAD ≥ 118 / 2 列实际宽度也 ≥ 118), 并反证「14px 确实放不下」防登记被当噪音删掉;变异回 14px 时红。 P2(顺带): - 截图通道的主题档由 `--screenshot-theme` 钉死(此前读机器 launcher.json,设置页主题行会漂) - `gallery::probe` 只认 gallery sheet(必须给 `ULL_GALLERY_SECTION`,否则整页图的 chip 会被当按钮量)、 行表 8 → 9 行(四式图标按钮)、分隔线判据只在渲染了 divider 段时执行、逐行阈值 40 → 30 并加 「满档色像素必须少于 38% 像素」的反向判据、probe 拆出 `probe/rows.rs` 守 400 行 - FAB extended 的重复分支合成一处,右内距提取 `EXTENDED_PAD_END`;iced 0.14 无 `Length::Min`, 「最小宽随标签增长」退化为固定宽已登记 - 五处注释谎言改真(theme/tests、general/theme、elevated、launch_args、app/tests/theme) `buttons/tests.rs` 加用例后 402 行 ⇒ 图标按钮那组拆到 `buttons/tests/icon.rs`。
This commit is contained in:
1 parent
6ed26626db
commit
8958b7f67d
18 files changed
+398
-124
No files matched your search
@@ -1,6 +1,7 @@
|
||||
//! ELEVATED CARD 的几何/排版断言(对着规格卡原值,不看渲染结果)。
|
||||
//!
|
||||
//! 抓得住:圆角退回组件表的 12、内边距被换成 `card_padding`、上标注变成 500/700 这些「悄悄改数」。
|
||||
//! 抓得住:圆角退回组件表的 12、内距/字级被改回规格卡的 24/16(元信息卡会折行)、
|
||||
//! 上标注变成 500/700 这些「悄悄改数」。
|
||||
//! 抓不住:底色对不对(要看 `Ui::color(SurfaceContainer)` 的来源,那条由 `theme` 的色板测试守)、
|
||||
//! 以及卡在页面里好不好看(D30 视觉判定)。
|
||||
|
||||
@@ -22,13 +23,18 @@ fn ui(flavor: unlucky_design::color::SchemeFlavor) -> Ui {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_card_takes_the_spec_corner_and_padding() {
|
||||
fn the_card_takes_the_spec_corner_and_the_tile_padding() {
|
||||
let ui = ui(unlucky_design::color::SchemeFlavor::Dark);
|
||||
assert_eq!(ui.card_shape(), ShapeScale::Large, "规格卡 rx=16");
|
||||
assert_eq!(ui.card_box().radius_px(), 16.0);
|
||||
assert_eq!(PAD, 24.0, "规格卡文字 x=88 − 框 x=64");
|
||||
// 4px 栅格(`spacing::GRID`)上:24 是,21(描边卡的 card_padding)不是——两者不许混用。
|
||||
assert_eq!(PAD % unlucky_design::spacing::GRID, 0.0);
|
||||
// 内距 **20**(不是规格卡的 24):24 会让元信息卡的值串折行(复审 P1-2),
|
||||
// 20 与描边卡同源(`LayoutMetrics::card_padding`),卡片宽度契约不变。
|
||||
assert_eq!(PAD, 20.0);
|
||||
assert_eq!(
|
||||
PAD,
|
||||
unlucky_design::spacing::LayoutMetrics::DESKTOP.card_padding
|
||||
);
|
||||
assert_eq!(PAD % unlucky_design::spacing::GRID, 0.0, "仍在 4px 栅格上");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -37,9 +43,12 @@ fn the_typography_matches_the_spec_rows() {
|
||||
assert_eq!(style.size_px, 11.0, "上标注 11px");
|
||||
assert_eq!(style.weight, Weight::SemiBold, "上标注 600(不是 500/700)");
|
||||
|
||||
let title = TypeRole::BodyLarge.style();
|
||||
assert_eq!(title.size_px, 16.0, "标题 16px");
|
||||
assert_eq!(title.weight, Weight::Regular, "标题 400");
|
||||
// 值的字级:**12**(BodySmall),不是规格卡展示卡的 16 —— 16px 下时戳墨水宽 138px,
|
||||
// 而 160 外框减两倍内距只有 120(复审 P1-2)。这条与 `pages/instances/tests.rs` 的不等式同源。
|
||||
let title = TITLE_ROLE.style();
|
||||
assert_eq!(TITLE_ROLE, TypeRole::BodySmall);
|
||||
assert_eq!(title.size_px, 12.0, "值 12px");
|
||||
assert_eq!(title.weight, Weight::Regular, "值 400");
|
||||
|
||||
let support = TypeRole::BodyMedium.style();
|
||||
assert_eq!(support.size_px, 14.0, "副文案 13 → 取较大档 14");
|
||||
|
||||
Reference in new issue
Block a user