printobserver-panels 0.20.2

Camera calibration, drift and alignment checks, and the check image's panels, for printobserver.
Documentation
//! What this crate's published package carries, as cargo lists it.
//!
//! crates.io refuses a package over 10,485,760 bytes compressed, and refused
//! this crate's v0.19.0 at 10.5 MiB because it carried the recorded frames
//! under `tests/fixtures/`, which only the fixture suite here reads. So the
//! package leaves that directory out; the root `budgets.yaml`'s
//! `crate-package-bytes` holds every publishable crate's compressed size.

use std::process::Command;

/// The files `cargo package --list` names for this crate.
fn packaged_files() -> Vec<String> {
    let output = Command::new(env!("CARGO"))
        .args([
            "package",
            "--list",
            "--allow-dirty",
            "--offline",
            "-p",
            env!("CARGO_PKG_NAME"),
        ])
        .current_dir(env!("CARGO_MANIFEST_DIR"))
        .output()
        .expect("cargo runs");
    assert!(
        output.status.success(),
        "cargo package --list fails: {}",
        String::from_utf8_lossy(&output.stderr)
    );
    String::from_utf8(output.stdout)
        .expect("cargo lists paths as UTF-8")
        .lines()
        .map(|line| line.replace('\\', "/"))
        .collect()
}

/// The package carries the crate's sources and its test suites, and none of
/// the fixtures those suites read.
#[test]
fn the_package_leaves_the_test_fixtures_out() {
    let files = packaged_files();
    for needed in [
        "Cargo.toml",
        "src/lib.rs",
        "src/compose.rs",
        "assets/LiberationMono-Regular.ttf",
    ] {
        assert!(
            files.iter().any(|file| file == needed),
            "the package carries {needed}: {files:?}"
        );
    }
    let fixtures: Vec<&String> = files
        .iter()
        .filter(|file| file.starts_with("tests/fixtures/"))
        .collect();
    assert!(
        fixtures.is_empty(),
        "the package carries {} test fixtures, the first {:?}",
        fixtures.len(),
        fixtures.first()
    );
}