From 840fb21ba0aa77eb39074bf4f0141cd0201fb566 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 1 Mar 2024 15:47:58 -0500 Subject: [PATCH] Test the replace_vertices function --- src/model.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/model.rs b/src/model.rs index a5ec645..cdff0b5 100755 --- a/src/model.rs +++ b/src/model.rs @@ -990,6 +990,26 @@ mod tests { assert_eq!(mdl.model_data, old_mdl.model_data); } + #[test] + fn test_update_vertices() { + let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + d.push("resources/tests"); + d.push("c0201e0038_top_zeroed.mdl"); + + let mut mdl = MDL::from_existing(&read(d).unwrap()).unwrap(); + let old_mdl = mdl.clone(); + + for l in 0..old_mdl.lods.len() { + for p in 0..old_mdl.lods[l].parts.len() { + mdl.replace_vertices(l, p, &old_mdl.lods[l].parts[p].vertices, &old_mdl.lods[l].parts[p].indices, &old_mdl.lods[l].parts[p].submeshes); + } + } + + // There should be no changes + assert_eq!(mdl.file_header, old_mdl.file_header); + assert_eq!(mdl.model_data, old_mdl.model_data); + } + #[test] fn test_parsing() { let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));