An unofficial collection of APIs used in FreeJam games and mods
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
769B

  1. #[cfg(all(feature = "robocraft", feature = "convert"))]
  2. use libfj::convert::cubes_to_model;
  3. #[cfg(all(feature = "robocraft", feature = "convert"))]
  4. use libfj::robocraft;
  5. #[cfg(all(feature = "robocraft", feature = "convert"))]
  6. #[tokio::test]
  7. async fn convert_to_obj() -> Result<(), ()> {
  8. let api = robocraft::FactoryAPI::new();
  9. let result = api.list().await;
  10. assert!(result.is_ok());
  11. let robot = api.get(result.unwrap().response.roboshop_items[0].item_id).await;
  12. assert!(robot.is_ok());
  13. let cubes = robot.unwrap();
  14. let obj = cubes_to_model(robocraft::Cubes::from(cubes.clone()));
  15. let save_result = obj.save(format!("tests/test-{}.obj", cubes.response.item_id));
  16. //save_result.unwrap();
  17. assert!(save_result.is_ok());
  18. Ok(())
  19. }