Files
Unlucky-Launcher/crates/app-iced/src/components/gallery/selection.rs
T
AskaEth 4155429f45 test(selection): 像素判据从「存在性」改成「逐处都对」(复审 P2-4)
- 20(±1) 的 Primary 块:**每一块**都不许超过 21(22 = 描边画到框外),且总数恰好 12
- 状态层:**每一块** Ø40 都要四角无墨(原来只看两块角点),数量 ≥5
- switch 轨道 **恰好一块** 52×32、chip **恰好一块** 32 高(原来 any(...) 就算过)
- 新增 P2-1 / P2-3 的像素断言:禁用 chip 4 块完整宽度 + filter·on 仍填充;20×20 禁用块不许是 12%
- 断言与像素扫描搬到 selection/probe.rs + selection/pixel.rs:gallery/selection.rs 只剩「摆矩阵」
  (原文件 458 行,超 400 红线)
2026-11-02 06:55:34 +08:00

38 lines
1.5 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! gallery 里的选择类小节:把状态矩阵摆进 harness(**断言不在这里**)。
//!
//! 矩阵本体的构造在 [`selection::matrix`](12 行 × 5 列:checkbox 四态 / radio / switch /
//! chip 三类),消息用 `()`(矩阵只供视觉验收),这里一次 `.map(..)` 接成 `DemoMessage`。
//!
//! ## 渲染层几何断言去哪了
//!
//! 在 [`crate::app::components::selection::probe`](`selection/probe.rs`)。挪出去的原因是
//! 400 行红线(复审 P2-5 同一类问题):断言 + 像素扫描会把这个文件顶到 458 行。
//!
//! 跑法(worktree 根目录):
//!
//! ```text
//! ULL_GALLERY_SECTION=selection ./target/debug/unlucky-launcher-iced --software-renderer \
//! --screen=gallery --screenshot target/m76/selection-light.png --screenshot-theme=light
//! ULL_GALLERY_SHOT=target/m76/selection-light.png cargo test -p unlucky-app-iced selection::probe
//! ```
use iced::widget::column;
use iced::Element;
use super::super::selection;
use crate::theme::Ui;
use super::DemoMessage;
/// 选择类家族的小节:标题 + 矩阵 + 图例。
pub(super) fn section<'a>(ui: &'a Ui) -> Element<'a, DemoMessage> {
let pressed = |()| DemoMessage::Pressed("selection");
column![
selection::matrix::heading_and_note(ui).map(pressed),
selection::matrix::matrix(ui).map(pressed),
selection::matrix::legend(ui).map(pressed),
]
.spacing(ui.space(unlucky_design::spacing::Space::X2))
.into()
}