Files
Sylpheed/crates/sylpheed-formats/examples/prm_colour_census.rs
sim 4e10b9e9c1
All checks were successful
CI / Native — linux (pull_request) Successful in 2h23m5s
CI / WASM — Web (pull_request) Successful in 31m32s
CI / Formatting (pull_request) Successful in 1m25s
test: one disc resolver, no machine-specific defaults, all three corpora in the container
Finishes #16 in the three places its earlier remedies missed.

`tests/`: the last four local `disc_root()` copies now use `tests/common`, and
with them goes the one real hardcoded fallback — `ui_keyframe_record_disc.rs`
fell back to an absolute path on one machine, which made `unset SYLPHEED_DISC`
a no-op there. Control: with the corpus absent that suite now finishes in 0.00s
instead of 57.55s, so it skips rather than finding a disc of its own.

`examples/`: seventeen examples defaulted to `/disc`, the mount point inside the
CI container. Redundant there — `docker/ci/run` sets `SYLPHEED_DISC=/disc` — and
wrong everywhere else, where a missing corpus turned into a file-not-found
against a path that has never existed on the host. They now name the variable to
set, like the other hundred examples already did.

`docker/ci/run`: mount `$SYLPHEED_RES3D` and `$SYLPHEED_ISO` alongside the disc.
Only the disc was mounted, so an in-container run sat out the res3d and iso
suites while looking like a full one — the defect this issue is about, in the
runner itself.

Measured in the container on this desktop with all three corpora present:
45 suites / 377 passed / 0 failed / 14 ignored, and `sylpheed-corpus-report.txt`
now reports PRESENT for all three rather than for the disc alone.

Refs #16.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 22:18:59 +02:00

54 lines
1.9 KiB
Rust

//! What COLOUR is a primitive, and does any of them only make sense additively?
//!
//! `ui-prm-primitives.md` leaves blend mode open, and `forced_backdrop` assumes
//! straight alpha-over. A quad whose ARGB would tint the whole screen a colour no
//! screen shows is evidence against alpha-over for that quad.
use std::collections::BTreeMap;
use sylpheed_formats::{pak, ratc, ui_layout};
fn main() {
let root =
std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root");
let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat"))
.expect("dat/")
.flatten()
.map(|e| e.path())
.filter(|p| p.extension().and_then(|s| s.to_str()) == Some("pak"))
.collect();
paks.sort();
let mut m: BTreeMap<String, BTreeMap<String, usize>> = BTreeMap::new();
for p in &paks {
let Ok(ar) = pak::PakArchive::open(p) else {
continue;
};
for e in ar.entries() {
let Ok(by) = ar.read(e) else { continue };
if !ratc::is_ratc(&by) {
continue;
}
let Some(b) = ui_layout::parse_build(&by) else {
continue;
};
for el in &b.elements {
if el.sprite.is_some() {
continue;
}
for k in &el.keyframes {
*m.entry(el.name.clone())
.or_default()
.entry(format!("{:08x}", k.fade))
.or_default() += 1;
}
}
}
}
println!("{:>26} fade ARGB values (count)", "keyless element");
for (n, v) in &m {
let tot: usize = v.values().sum();
if tot < 4 {
continue;
}
let s: Vec<String> = v.iter().map(|(k, c)| format!("{k}x{c}")).collect();
println!(" {n:>24} {}", s.join(" "));
}
}