fmt: Brightness & Contrast test (#702 follow-up)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-12 03:12:04 -04:00
co-authored by Claude Opus 5.5
parent d47d3c7b34
commit 7f9aa28c03
3 changed files with 10 additions and 13 deletions
+4 -1
View File
@@ -1196,7 +1196,10 @@ mod tests {
#[test]
fn brightness_contrast_modern_matches_ae_ramp_samples() {
let u8 = |v: f32| (v * 255.0).round() as i32;
let go = |b: f64, c: f64, x: u8| u8(px("ec.color.brightnesscontrast", &[("brightness", num(b)), ("contrast", num(c))], [x as f32 / 255.0, x as f32 / 255.0, x as f32 / 255.0, 1.0])[0]);
let go = |b: f64, c: f64, x: u8| {
u8(px("ec.color.brightnesscontrast", &[("brightness", num(b)), ("contrast", num(c))], [x as f32 / 255.0, x as f32 / 255.0, x as f32 / 255.0, 1.0])
[0])
};
// (brightness, contrast, input, AE 8-bit)
let samples: &[(f64, f64, u8, u8)] = &[
(0.0, 100.0, 64, 40),
+2 -10
View File
@@ -265,21 +265,13 @@ fn cylinder(ctx: &EffectCtx, mut b: Buf) -> Buf {
let root = discriminant.sqrt();
let face = |z: f64, back: bool| {
// Rᵀ turns the intersection into cylinder-local coordinates.
let local = [
m[0][0] * dx + m[1][0] * dy + m[2][0] * z,
m[0][1] * dx + m[1][1] * dy + m[2][1] * z,
m[0][2] * dx + m[1][2] * dy + m[2][2] * z,
];
let local = [m[0][0] * dx + m[1][0] * dy + m[2][0] * z, m[0][1] * dx + m[1][1] * dy + m[2][1] * z, m[0][2] * dx + m[1][2] * dy + m[2][2] * z];
let u = (local[0].atan2(local[2]) + spin) / std::f64::consts::TAU + 0.5;
let v = local[1] / h + 0.5;
let sign = if back { -1.0 } else { 1.0 };
let nx = local[0] / r * sign;
let nz = local[2] / r * sign;
let normal = [
m[0][0] * nx + m[0][2] * nz,
m[1][0] * nx + m[1][2] * nz,
m[2][0] * nx + m[2][2] * nz,
];
let normal = [m[0][0] * nx + m[0][2] * nz, m[1][0] * nx + m[1][2] * nz, m[2][0] * nx + m[2][2] * nz];
sh.shade(texel(&src, rect, u, v), normal)
};
let front = || face((-bq + root) / a, false);
+4 -2
View File
@@ -258,8 +258,10 @@ fn multiple_selected_footage_dropped_on_empty_timeline_asks_how_to_create_comps(
#[test]
fn project_footage_dropped_on_empty_viewer_creates_first_comp() {
let mut s = Session::default();
let footage = s.execute("file.importPlaceholder", json!({"name": "Landscape.png", "width": 640, "height": 360, "frameRate": 24, "duration": 5}))
.unwrap()["item"].as_u64().unwrap();
let footage =
s.execute("file.importPlaceholder", json!({"name": "Landscape.png", "width": 640, "height": 360, "frameRate": 24, "duration": 5})).unwrap()["item"]
.as_u64()
.unwrap();
let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).build_eframe(|_| EffectcraftApp::new(s));
h.run_steps(3);
assert!(h.state().session.active_comp().is_none());