Skip to content

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

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

Brandon Thomas7f9aa28c03ab
diff --git a/crates/effects/src/color_fx.rs b/crates/effects/src/color_fx.rs
index e39902d7e..e431ff22e 100644
--- a/crates/effects/src/color_fx.rs
+++ b/crates/effects/src/color_fx.rs
@@ -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),
diff --git a/crates/effects/src/perspective.rs b/crates/effects/src/perspective.rs
index 24038dcb8..24c561ecd 100644
--- a/crates/effects/src/perspective.rs
+++ b/crates/effects/src/perspective.rs
@@ -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);
diff --git a/crates/ui-egui/tests/ui_drag_drop.rs b/crates/ui-egui/tests/ui_drag_drop.rs
index 47449fed8..77a3995d6 100644
--- a/crates/ui-egui/tests/ui_drag_drop.rs
+++ b/crates/ui-egui/tests/ui_drag_drop.rs
@@ -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());