From e62945a8dab45dd3c0584ad50596076cb555b445 Mon Sep 17 00:00:00 2001 From: ".CooCoo" Date: Mon, 16 Nov 2026 18:36:00 -0800 Subject: [PATCH] craft-psd: test-support is the name of the testgen feature, which stays as an alias (#1380) --- crates/psd/Cargo.toml | 7 +++++-- crates/psd/README.md | 2 +- crates/psd/examples/big_psb.rs | 2 +- crates/psd/src/lib.rs | 4 ++-- crates/psd/tests/it/main.rs | 10 ++++++++++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/crates/psd/Cargo.toml b/crates/psd/Cargo.toml index c9aa6dbe0..30bf3a471 100644 --- a/crates/psd/Cargo.toml +++ b/crates/psd/Cargo.toml @@ -12,7 +12,10 @@ repository.workspace = true corpus = [] default = [] serde = ["dep:serde"] -testgen = [] +# `fixtures` and `testgen`: test-data generators for the tests of crates that read PSD files. +test-support = [] +# The former name of `test-support`. +testgen = ["test-support"] [dependencies] thiserror = { workspace = true } @@ -26,7 +29,7 @@ rayon = { workspace = true } [dev-dependencies] proptest = { workspace = true } -craft-psd = { path = ".", features = ["testgen"] } +craft-psd = { path = ".", features = ["test-support"] } [lints] workspace = true diff --git a/crates/psd/README.md b/crates/psd/README.md index 5bac98732..7a7bfa2d7 100644 --- a/crates/psd/README.md +++ b/crates/psd/README.md @@ -127,7 +127,7 @@ builder.push_layer(LayerSpec) / begin_group(GroupSpec) / end_group()? / composit builder.build() -> Result; builder.to_bytes() PixelData::{Rgba8, Rgba16, GrayA8, GrayA16, Cmyka8, Cmyka16} // CMYK given as ink, stored inverted -// Test generator (feature `testgen`) +// Test generator (feature `test-support`; `testgen` is an alias) testgen::{all_cases, merged_only, layered, small, sample_descriptor, pattern_plane} ``` diff --git a/crates/psd/examples/big_psb.rs b/crates/psd/examples/big_psb.rs index 18ce78ccf..3ed6c8175 100644 --- a/crates/psd/examples/big_psb.rs +++ b/crates/psd/examples/big_psb.rs @@ -1,6 +1,6 @@ //! Writes multi-gigabyte PSB files (and the 2 GB PSD) for large-file tests (photocraft#375, photocraft#216), straight //! from the Adobe PSD spec and independent of this crate's writer, so the fixtures don't inherit -//! its limits. The generator is `craft_psd::fixtures` (feature `testgen`). +//! its limits. The generator is `craft_psd::fixtures` (feature `test-support`). //! //! `cargo run --release -p craft-psd --example big_psb -- [case...]` //! diff --git a/crates/psd/src/lib.rs b/crates/psd/src/lib.rs index efcc474b2..5b84fcb91 100644 --- a/crates/psd/src/lib.rs +++ b/crates/psd/src/lib.rs @@ -71,7 +71,7 @@ pub mod engine_data; pub mod error; pub mod file; pub mod filter_effects; -#[cfg(any(test, feature = "testgen"))] +#[cfg(any(test, feature = "test-support"))] pub mod fixtures; pub mod flat; pub mod float; @@ -97,7 +97,7 @@ pub mod slices; pub mod smart; pub mod source; pub mod tagged; -#[cfg(any(test, feature = "testgen"))] +#[cfg(any(test, feature = "test-support"))] // Test-data generator (tests and fuzz seeds only): failing loudly is the point. #[allow(clippy::expect_used)] pub mod testgen; diff --git a/crates/psd/tests/it/main.rs b/crates/psd/tests/it/main.rs index 08825ddf9..3bb60a8d9 100644 --- a/crates/psd/tests/it/main.rs +++ b/crates/psd/tests/it/main.rs @@ -22,3 +22,13 @@ fn corpus_dir(sub: &str) -> std::path::PathBuf { .map_or_else(|| std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus"), std::path::PathBuf::from); root.join(sub) } + +/// The self dev-dependency builds these tests with `test-support`, the feature that gates +/// `craft_psd::fixtures` and `craft_psd::testgen`. +#[test] +fn tests_build_with_the_test_support_feature() { + const { assert!(cfg!(feature = "test-support")) }; + let file = craft_psd::testgen::small(craft_psd::Version::Psd, craft_psd::Compression::Raw); + assert_eq!(file.header.version, craft_psd::Version::Psd); + let _sample: fn(u32, u32, u32, bool) -> u8 = craft_psd::fixtures::sample; +}