Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

refactor(psd): move tests_<topic>.rs files to src/tests/

aiongg140b8d911cb9
diff --git a/crates/psd/src/lib.rs b/crates/psd/src/lib.rs
index 60a9ab806..e515e9cb6 100644
--- a/crates/psd/src/lib.rs
+++ b/crates/psd/src/lib.rs
@@ -1493,10 +1493,6 @@ fn lab_to_rgb(l: f32, a: f32, b: f32) -> [f32; 3] {
mod memory_tests;
#[cfg(test)]
mod tests;
-#[cfg(test)]
-mod tests_integration;
-#[cfg(test)]
-mod tests_opt;
/// Test-only call counters (per thread), to prove what the optimised paths avoid doing.
#[cfg(test)]
diff --git a/crates/psd/src/tests.rs b/crates/psd/src/tests.rs
index 60283b229..074976510 100644
--- a/crates/psd/src/tests.rs
+++ b/crates/psd/src/tests.rs
@@ -1,6 +1,9 @@
use super::write::*;
use super::*;
+mod integration;
+mod opt;
+
fn gradient(w: u32, h: u32) -> Vec<[f32; 4]> {
(0..w * h).map(|i| [(i % w) as f32 / (w - 1).max(1) as f32, (i / w) as f32 / (h - 1).max(1) as f32, 0.25, 1.0]).collect()
}
diff --git a/crates/psd/src/tests_integration.rs b/crates/psd/src/tests/integration.rs
similarity index 98%
rename from crates/psd/src/tests_integration.rs
rename to crates/psd/src/tests/integration.rs
index a2b48b20c..ee40aee16 100644
--- a/crates/psd/src/tests_integration.rs
+++ b/crates/psd/src/tests/integration.rs
@@ -2,9 +2,9 @@
//! the limit, a NaN text transform), a damaged layer section, and a tiny file claiming a huge
//! image. Each ends in a clean result or a clean error, on a 2 MiB stack, never a panic.
-use super::memory_tests::with_merged;
-use super::write::*;
-use super::*;
+use crate::memory_tests::with_merged;
+use crate::write::*;
+use crate::*;
/// Run `f` on a 2 MiB thread; a panic or stack overflow in it fails the test.
fn on_small_stack<T: Send + 'static>(f: impl FnOnce() -> T + Send + 'static) -> T {
diff --git a/crates/psd/src/tests_opt.rs b/crates/psd/src/tests/opt.rs
similarity index 99%
rename from crates/psd/src/tests_opt.rs
rename to crates/psd/src/tests/opt.rs
index f129480c1..5387e42b9 100644
--- a/crates/psd/src/tests_opt.rs
+++ b/crates/psd/src/tests/opt.rs
@@ -1,10 +1,10 @@
//! The optimised decode / mask / placed-bake paths against the implementations they replaced
//! (kept below verbatim as references), and counters for the work they no longer do.
-use super::counters::{self, INSIDE, QUAD, SCRATCH};
-use super::placed::{Warp, square_to_quad};
-use super::write::*;
-use super::*;
+use crate::counters::{self, INSIDE, QUAD, SCRATCH};
+use crate::placed::{Warp, square_to_quad};
+use crate::write::*;
+use crate::*;
// ------------------------------------------------------------------ the replaced code