Skip to content

Commit

Permalink
add list primitives test
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Oct 11, 2024
1 parent 387d187 commit 0b4db59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion crates/unavi-scripting/src/api/wired/scene/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ mod tests {
}

#[test]
fn test_create_remove_primitive() {
fn test_primitives() {
let (mut app, mut data) = init_test_data();

let node = HostNode::new(&mut data).unwrap();
Expand All @@ -321,6 +321,14 @@ mod tests {

test_create_node_primitives(&mut app, &mut data, &node, &primitive);

let primitives =
HostMesh::list_primitives(&mut data, Resource::new_own(mesh.rep())).unwrap();
assert_eq!(primitives.len(), 1);
assert_eq!(
data.table.get(&primitives[0]).unwrap().read().id,
primitive_data.read().id
);

HostMesh::remove_primitive(&mut data, mesh, primitive).unwrap();

test_remove_node_primitives(&mut app, &mut data, &node, &primitive_data);
Expand Down
4 changes: 2 additions & 2 deletions crates/unavi-scripting/src/api/wired/scene/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use wasm_bridge::component::Resource;
use crate::{
api::{
id::ResourceId,
wired::scene::bindings::mesh::{HostMesh, HostPrimitive, Material},
wired::scene::bindings::mesh::{HostPrimitive, Material},
},
data::ScriptData,
};
Expand Down Expand Up @@ -211,7 +211,7 @@ impl HostPrimitive for ScriptData {
mod tests {
use crate::api::{
tests::init_test_data,
wired::scene::bindings::{material::HostMaterial, node::HostNode},
wired::scene::bindings::{material::HostMaterial, mesh::HostMesh, node::HostNode},
};

use super::*;
Expand Down

0 comments on commit 0b4db59

Please sign in to comment.