Files
shinyobjectz 4217941ad5 A staticFile path is found in the media folders wherever a source is resolved, a three.js shader's texture too
resolve_src read /media/fonts/x.png as a file at the root, so an R3F ShaderMaterial or TSL node material whose texture
came from new THREE.TextureLoader().load(staticFile("fonts/x.png")) found no such file, and its render was refused
(a material's map, drei's Environment files and every other source already went through media_path). /media/ paths
now go through raea-core-scene media_path in resolve_src itself, with a test.
2026-11-08 13:43:14 -08:00

15 lines
791 B
Rust

//! A row's source as a file: a staticFile path (/media/x) is found in the media folders, as a material's map and every
//! other media src is, not read as a file at the root (a three.js shader's texture once was: "/media/fonts/x.png").
use raea_sys_frame::resolve_src;
#[test]
fn a_static_file_is_found_in_media() {
let dir = std::env::temp_dir().join(format!("raea-resolve-src-{}", std::process::id()));
std::fs::create_dir_all(dir.join("media/fonts")).unwrap();
std::fs::write(dir.join("media/fonts/x.png"), "").unwrap();
assert_eq!(resolve_src(&[], "/media/fonts/x.png", &dir).unwrap(), dir.join("media/fonts/x.png"));
// a relative path is still the edit's own
assert_eq!(resolve_src(&[], "media/fonts/x.png", &dir).unwrap(), dir.join("media/fonts/x.png"));
}