ci(app-iced): M127 把下载页四条像素守门接进 CI(仅 Windows),缺图在 CI 里从 SKIP 改成失败
- 新增 tests/options_shot/feed.rs:四条断言共用一条「喂图」策略 · CI(CI 已设置)且 Windows 上缺 ULL_DL_*_SHOT ⇒ 失败并提示「守门未喂图」 · 非 Windows 上喂了图 ⇒ CI 里也失败(断言按 Segoe UI 标定的行高/墨迹宽度) · 本机缺图仍可跳过,但每次都留一句提示 - ci.yml 的 test 作业(Windows 槽):pages_demo 现出 ready700/chips700/compact736/wide1180 四张图 → 写进 $GITHUB_ENV → cargo test -p unlucky-app-iced --lib options_shot 出图与断言两步都带 if: runner.os == 'Windows';失败时上传四张图便于复盘 - 顺带订正五处文档数字:main 7 整行 / r1 4 整行 / r2 7 整行,并写清第 8 条墨迹是 hint (rows.rs ×3、options_shot/ready.rs、tests/view.rs),不动任何断言期望值
This commit is contained in:
1 parent
631d4647dc
commit
02c7910ad5
8 files changed
+204
-42
No files matched your search
@@ -7,21 +7,21 @@
|
||||
//! 那些只有图能回答——所以这里直接量 `pages_demo` 出的 PNG,按**产品自己的裁决函数**
|
||||
//! ([`VersionRails::of_metrics`] + [`frame_metrics`])推出每一栏该在的 x 区间,再要求像素同意。
|
||||
//!
|
||||
//! ## 开关与跑法(与 `components/*/probe.rs` 同一族范式:没有图就 SKIP,不假绿)
|
||||
//! ## 开关与跑法(`ULL_DL_*_SHOT` 喂图,四条出图命令见 `feed.rs` 的模块文档)
|
||||
//!
|
||||
//! ```text
|
||||
//! # ① 1180 宽(Wide 档,两栏都展开)
|
||||
//! ULL_DL_DEMO=options-fabric cargo run -p unlucky-app-iced --example pages_demo -- \
|
||||
//! --screen=download --width=1180 --height=760 --screenshot=opt.png \
|
||||
//! --screenshot-theme=light --software-renderer
|
||||
//! ULL_DL_OPTIONS_SHOT=opt.png cargo test -p unlucky-app-iced --lib options_shot
|
||||
//! ```
|
||||
//! 四条断言都靠环境变量拿到一张真 PNG。M127 之前的写法是「没有图就 SKIP」,于是在 CI 里
|
||||
//! **全是空跑**(`.github/` 里 grep 这些变量零命中)。现在按环境分档:
|
||||
//!
|
||||
//! - **只在 Windows runner 上跑**:断言量的行高/墨迹条数/药丸位置是按本仓字体栈
|
||||
//! (`Segoe UI`)标定的,Linux/macOS 的回退字体会让这些数字变样 ⇒ 假红。这条限制同时写在
|
||||
//! `.github/workflows/ci.yml` 的作业条件(`if: runner.os == 'Windows'`,出图与断言两步都带)
|
||||
//! 和 `feed.rs` 的模块文档里,不靠「碰巧只配了一处」。
|
||||
//! - **CI 里没喂图 = 失败**,提示「守门未喂图」:将来谁把 CI 里出图那步重构掉,构建会红,
|
||||
//! 而不是静静退回手动档。本机(非 CI)才允许跳过,并且会留一句提示。
|
||||
//!
|
||||
//! 颜色**不**写死:`run_at` 只要求「同一段颜色连续」,栏与栏的边界按「颜色变了」判,
|
||||
//! 于是浅色/深色都能跑同一条断言(实测浅色下 Card=(235,245,255)、Canvas=(246,250,255))。
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use unlucky_design::color::SchemeFlavor;
|
||||
use unlucky_design::typography::Platform;
|
||||
|
||||
@@ -48,15 +48,6 @@ fn ui() -> Ui {
|
||||
Ui::with_platform(SchemeFlavor::Light, Platform::Windows, FAMILIES)
|
||||
}
|
||||
|
||||
fn shot_path(key: &str) -> Option<PathBuf> {
|
||||
let path = PathBuf::from(std::env::var_os(key)?);
|
||||
if path.is_absolute() || path.exists() {
|
||||
return Some(path);
|
||||
}
|
||||
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..");
|
||||
Some(root.join(path))
|
||||
}
|
||||
|
||||
/// 一张 RGB 图(只留本文件要用的那两件事:宽高 + 取点)。
|
||||
struct Shot {
|
||||
width: usize,
|
||||
@@ -293,11 +284,7 @@ fn bands(width: f32) -> Bands {
|
||||
/// 深色主题下的对比度(本条只跑浅色图;深色另用同一 argv 换 `--screenshot-theme` 出图人看)。
|
||||
#[test]
|
||||
fn an_options_shot_shows_both_rails_and_the_whole_panel() {
|
||||
let Some(path) = shot_path(WIDE_SHOT) else {
|
||||
eprintln!(
|
||||
"[options-shot] SKIPPED:未设置 {WIDE_SHOT}。这是**渲染层**几何断言,\
|
||||
需要先出图(见本文件模块文档的 1180 那张)。"
|
||||
);
|
||||
let Some(path) = feed(WIDE_SHOT) else {
|
||||
return;
|
||||
};
|
||||
let shot = Shot::load(&path);
|
||||
@@ -381,4 +368,8 @@ mod chips;
|
||||
|
||||
mod compact;
|
||||
|
||||
mod feed;
|
||||
|
||||
mod ready;
|
||||
|
||||
use feed::feed;
|
||||
Reference in new issue
Block a user