Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

rf-jxl: test the ends of the quality scale

gelenmedyaa845867f0b1c
diff --git a/crates/rf-jxl/tests/roundtrip.rs b/crates/rf-jxl/tests/roundtrip.rs
index 12c9c5b3..84a4e10a 100644
--- a/crates/rf-jxl/tests/roundtrip.rs
+++ b/crates/rf-jxl/tests/roundtrip.rs
@@ -134,6 +134,17 @@ fn gradients_and_noise() {
check("noise", 128, 128, &noise(128, 128), 90.0, 30.0);
}
+#[test]
+fn the_ends_of_the_quality_scale() {
+ let px = synthetic(128, 96, 7);
+ check("quality 100", 128, 96, &px, 100.0, 90.0);
+ check("quality 50", 128, 96, &px, 50.0, 40.0);
+ check("quality 0", 128, 96, &px, 0.0, -50.0);
+ // smaller files for lower qualities
+ let sizes: Vec<usize> = [100.0, 90.0, 70.0, 40.0, 10.0].iter().map(|&q| rf_jxl::encode(128, 96, &px, false, q).len()).collect();
+ assert!(sizes.windows(2).all(|w| w[0] > w[1]), "{sizes:?}");
+}
+
#[test]
fn stripes_keep_their_direction() {
let (w, h) = (64u32, 64u32);