Skip to content

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

Land batch: fix clippy lints and the #1424 test after #1413 changed layer_menu

Brandon Thomasf3f24ef18909
diff --git a/crates/media/tests/tga.rs b/crates/media/tests/tga.rs
index 61aacd957..13a1f7568 100644
--- a/crates/media/tests/tga.rs
+++ b/crates/media/tests/tga.rs
@@ -16,8 +16,8 @@ fn tga(pixels: [[u8; 4]; 4], alpha: bool, rle: bool, top: bool) -> Vec<u8> {
bytes[14] = 2;
bytes[16] = if alpha { 32 } else { 24 };
bytes[17] = if top { 0x20 } else { 0 } | if alpha { 8 } else { 0 };
- let order = if top { [0, 1, 2, 3] } else { [2, 3, 0, 1] };
- for row in order.chunks_exact(2) {
+ let rows = if top { [[0, 1], [2, 3]] } else { [[2, 3], [0, 1]] };
+ for row in rows {
if rle {
assert_eq!(pixels[row[0]], pixels[row[1]]);
bytes.push(0x81); // A two-pixel run.
diff --git a/crates/text/src/font_dirs.rs b/crates/text/src/font_dirs.rs
index 8004a62c0..0561d8f84 100644
--- a/crates/text/src/font_dirs.rs
+++ b/crates/text/src/font_dirs.rs
@@ -498,7 +498,7 @@ mod tests {
write(&first, "<fontconfig><dir>/unreadable/fonts</dir></fontconfig>");
write(&second, "<fontconfig><dir>/readable/fonts</dir></fontconfig>");
let _cleanup = Cleanup { root: root.clone(), file: first.clone(), permissions: std::fs::metadata(&first).unwrap().permissions() };
- std::fs::set_permissions(&first, std::fs::Permissions::from_mode(0)).unwrap();
+ std::fs::set_permissions(&first, std::fs::Permissions::from_mode(0o000)).unwrap();
if std::fs::File::open(&first).is_ok() {
eprintln!("skipped: this process can read mode-000 files");
return;
diff --git a/crates/ui-egui/src/panels/timeline.rs b/crates/ui-egui/src/panels/timeline.rs
index 0f292386e..e9660da36 100644
--- a/crates/ui-egui/src/panels/timeline.rs
+++ b/crates/ui-egui/src/panels/timeline.rs
@@ -4649,12 +4649,12 @@ mod tests {
#[test]
fn the_layer_context_menu_draws_in_the_interface_language() {
let caps = LayerMenuCaps { vector: true, text: false };
- let mut actions = Vec::new();
+ let (mut auto, mut actions) = (crate::automation::Registry::default(), Vec::new());
crate::i18n::set_current("zh-hans");
- let menu = drawn_text(|ui| layer_menu(ui, &[7], caps, &mut actions));
+ let menu = drawn_text(|ui| layer_menu(ui, &[7], caps, (&mut auto, "t"), &mut actions));
let effects = drawn_text(|ui| effects_submenu(ui, &[7], &mut |_: &mut egui::Ui, _: &str, _: &str, _: serde_json::Value| {}));
crate::i18n::set_current("en");
- let english = drawn_text(|ui| layer_menu(ui, &[7], caps, &mut actions));
+ let english = drawn_text(|ui| layer_menu(ui, &[7], caps, (&mut auto, "t"), &mut actions));
for label in ["新建", "图层设置...", "从矢量图层创建形状", "预合成...", "重复", "拆分图层", "删除"] {
assert!(menu.iter().any(|t| t == label), "{label} missing from {menu:?}");
}