Skip to content

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

Batch fixes: rustfmt, is_multiple_of in the Vegas test, drop a Swedish row #2718 retired

Brandon Thomasdc1f9eab74ef
diff --git a/crates/effects/src/generate3/tests.rs b/crates/effects/src/generate3/tests.rs
index 8c2bbff82..deb0d7dda 100644
--- a/crates/effects/src/generate3/tests.rs
+++ b/crates/effects/src/generate3/tests.rs
@@ -401,8 +401,8 @@ fn vegas_long_segments_are_sampled_finely() {
// A short segment keeps the 12 samples; a long one gets more so it bends smoothly round rounded corners.
assert_eq!(super::paths::vegas_substeps(10.0, 4.0), 12);
let n = super::paths::vegas_substeps(400.0, 4.0);
- assert!(n > 12 && n % 2 == 0, "{n}");
- assert_eq!(super::paths::vegas_substeps(13.0 * 4.0, 4.0) % 2, 0);
+ assert!(n > 12 && n.is_multiple_of(2), "{n}");
+ assert!(super::paths::vegas_substeps(13.0 * 4.0, 4.0).is_multiple_of(2));
assert!(400.0 / n as f64 <= 4.0 + 1e-9);
assert_eq!(super::paths::vegas_substeps(1.0e9, 4.0), 512);
}
diff --git a/crates/psd/src/placed.rs b/crates/psd/src/placed.rs
index 2611ba097..981f4ff23 100644
--- a/crates/psd/src/placed.rs
+++ b/crates/psd/src/placed.rs
@@ -552,7 +552,12 @@ mod tests {
#[test]
fn a_thin_output_is_not_refused_for_rounding() {
- let s = SmartObject { uuid: "x".into(), quad: [[0.0, 0.0], [16384.0, 0.0], [16384.0, 1.0], [0.0, 1.0]], size: None, warp: Some(Warp { style: "warpArc".into(), bounds: [0.0, 0.0, 16.0, 16.0], bend: 20.0, ..Default::default() }) };
+ let s = SmartObject {
+ uuid: "x".into(),
+ quad: [[0.0, 0.0], [16384.0, 0.0], [16384.0, 1.0], [0.0, 1.0]],
+ size: None,
+ warp: Some(Warp { style: "warpArc".into(), bounds: [0.0, 0.0, 16.0, 16.0], bend: 20.0, ..Default::default() }),
+ };
let content = Pixels { width: 16, height: 16, data: vec![[1.0, 0.0, 0.0, 1.0]; 256] };
assert!(s.render_placed(&content, 1.0, Some((16384, 1))).is_some());
}
diff --git a/crates/ui-egui/src/header.rs b/crates/ui-egui/src/header.rs
index df1e61e8d..140a0bbaf 100644
--- a/crates/ui-egui/src/header.rs
+++ b/crates/ui-egui/src/header.rs
@@ -111,13 +111,9 @@ fn tool_slot(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, si:
i.events
.iter()
.filter_map(|e| match e {
- egui::Event::PointerButton {
- pos,
- button: egui::PointerButton::Primary,
- pressed: false,
- modifiers,
- ..
- } if resp.rect.contains(*pos) => Some(*modifiers),
+ egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers, .. } if resp.rect.contains(*pos) => {
+ Some(*modifiers)
+ }
_ => None,
})
.collect()
@@ -1023,25 +1019,14 @@ mod tests {
let at = egui::pos2(e.rect[0] + e.rect[2] / 2.0, e.rect[1] + e.rect[3] / 2.0);
let alt = egui::Modifiers { alt: true, ..Default::default() };
let plain = egui::Modifiers::default();
- let pointer = |pos, pressed, modifiers| egui::Event::PointerButton {
- pos,
- button: egui::PointerButton::Primary,
- pressed,
- modifiers,
- };
+ let pointer = |pos, pressed, modifiers| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers };
app.ui.tool = Tool::Type;
app.ui.slot_tools[10] = Tool::Type;
frame(
&mut app,
&ctx,
1.0,
- vec![
- egui::Event::PointerMoved(at),
- pointer(at, true, alt),
- pointer(at, false, alt),
- pointer(at, true, plain),
- pointer(at, false, plain),
- ],
+ vec![egui::Event::PointerMoved(at), pointer(at, true, alt), pointer(at, false, alt), pointer(at, true, plain), pointer(at, false, plain)],
);
assert!(app.session.active_comp().unwrap().layers.is_empty(), "Alt then plain in one frame must not create");
assert!(app.session.state.text_edit.is_none());
diff --git a/crates/ui-egui/src/i18n/ui.rs b/crates/ui-egui/src/i18n/ui.rs
index 93e7b2614..3bd83c48a 100644
--- a/crates/ui-egui/src/i18n/ui.rs
+++ b/crates/ui-egui/src/i18n/ui.rs
@@ -3178,7 +3178,6 @@ const SWEDISH: &[(&str, &str)] = &[
("Guide Layer", "Hjälplager"),
("Layer Styles", "Lagerstilar"),
("Check for Updates", "Sök efter uppdateringar"),
- ("Checking for updates…", "Söker efter uppdateringar…"),
("Close font search", "Stäng typsnittssökningen"),
("Search project", "Sök i projektet"),
("Update check is not supported in the web browser.", "Sökning efter uppdateringar stöds inte i webbläsaren."),
diff --git a/crates/ui-egui/src/panels/viewer/view.rs b/crates/ui-egui/src/panels/viewer/view.rs
index 28c083dba..60a68c57c 100644
--- a/crates/ui-egui/src/panels/viewer/view.rs
+++ b/crates/ui-egui/src/panels/viewer/view.rs
@@ -200,7 +200,8 @@ pub(super) fn locked_pane(app: &mut EffectcraftApp, ui: &mut egui::Ui, full: Rec
p.rect_filled(cr, 0.0, Color32::from_rgb((b[0] * 255.0) as u8, (b[1] * 255.0) as u8, (b[2] * 255.0) as u8));
p.image(tex.id(), cr, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
p.rect_stroke(cr, 0.0, Stroke::new(1.0, Color32::from_black_alpha(160)), StrokeKind::Outside);
- let label = crate::i18n::tr_args("Locked: {} — {}", &[&name, &(if comp.has_3d() { super::view3d_label(lv.view) } else { crate::i18n::tr("Active Camera") })]);
+ let label =
+ crate::i18n::tr_args("Locked: {} — {}", &[&name, &(if comp.has_3d() { super::view3d_label(lv.view) } else { crate::i18n::tr("Active Camera") })]);
p.text(r.left_top() + vec2(8.0, 8.0), Align2::LEFT_TOP, &label, Tokens::ui(11.0), Color32::from_white_alpha(210));
app.auto.add("viewer.locked", r, &label);
// Close the locked viewer.