WASM plugins, scripting, i18n, GUI pan/zoom, cargo-dist CI/CD
- WASM plugin host (wasmtime 46, 17 host fns) + example noisemap plugin - Rhai scripting engine (12 API fns, `terrafier run` cmd) - i18n: en/ru translations, auto-detect, t! macro - GUI: pan (click-drag) + zoom (scroll wheel) with viewport transform - cargo-dist 0.31: MSI/pkg/shell installers, both binaries - CI: .github/workflows/ci.yml + release.yml - Security: wasmtime 30→46, bincode 1.3→2.0, quick-xml CVE docs - Code review: SAFETY comments, unwrap→match cleanup - Fixes: clippy approx_constant, needless_borrows, rustfmt
This commit is contained in:
parent
bdd4564240
commit
18613260a8
100 changed files with 4262 additions and 585 deletions
56
crates/scripting/tests/integration_test.rs
Normal file
56
crates/scripting/tests/integration_test.rs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
use std::path::Path;
|
||||
|
||||
use terrafier_core::World;
|
||||
use terrafier_scripting::ScriptEngine;
|
||||
|
||||
#[test]
|
||||
fn test_new_world() {
|
||||
let mut engine = ScriptEngine::new();
|
||||
let result = engine
|
||||
.run(
|
||||
r#"
|
||||
let world = new_world("test_world", 12345);
|
||||
let i = info(world);
|
||||
i.contains("test_world") && i.contains("12345")
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(result.as_bool().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_generate_flat_heightmap() {
|
||||
let mut engine = ScriptEngine::new();
|
||||
let _ = engine
|
||||
.run(
|
||||
r#"
|
||||
let world = new_world("flat_world", 42);
|
||||
generate_heightmap_flat(world, 64, "overworld");
|
||||
save_world(world, "/tmp/test_flat.tfw");
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
let loaded: World = terrafier_core::io::load_binary(Path::new("/tmp/test_flat.tfw")).unwrap();
|
||||
if let Some(dim) = loaded.dimensions.first() {
|
||||
for (_, tile) in &dim.tiles {
|
||||
for z in 0..128 {
|
||||
for x in 0..128 {
|
||||
assert_eq!(tile.get_height(x, z), 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = std::fs::remove_file("/tmp/test_flat.tfw");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_script_error_reporting() {
|
||||
let mut engine = ScriptEngine::new();
|
||||
let result = engine.run(
|
||||
r#"
|
||||
let world = new_world("bad", 1);
|
||||
generate_heightmap_flat(world, 64, "nonexistent");
|
||||
"#,
|
||||
);
|
||||
assert!(result.is_err());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue