Some checks failed
API and SemVer surface / api-surface (push) Failing after 1m34s
Native code generation / deterministic (push) Has been cancelled
Concurrency and resource soak audit / soak (push) Has been cancelled
Documentation / documentation (push) Has been cancelled
performance evidence / audit (push) Has been cancelled
First release candidate / non-fuzz-release-gate (push) Has been cancelled
Release platform and feature matrix / audit (push) Has been cancelled
Release platform and feature matrix / matrix (false, linux-stable-minimal, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (false, macos-stable-portable, x86_64-apple-darwin, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (false, windows-stable-portable, x86_64-pc-windows-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-msrv-portable, x86_64-unknown-linux-gnu, 1.96.0) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-stable-default, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-stable-features, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-stable-release-surface, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Dependency and supply-chain audit / audit (push) Has been cancelled
Native release artifact audit / audit (push) Has been cancelled
Imaging and meshing gate / native (push) Failing after 53s
JPEG 2000 feature / linux (push) Successful in 2m49s
Native Rust workspace compile / compile (push) Failing after 59s
Skia feature / linux (push) Has been cancelled
58 lines
1.9 KiB
Rust
58 lines
1.9 KiB
Rust
//! Behavioral checks for immutable event-argument mappings generated from the
|
|
//! pinned C# constructor assignments.
|
|
|
|
#![allow(clippy::float_cmp)] // Generated constructor fixtures retain exact values.
|
|
|
|
use libremetaverse::{MeanCollisionEventArgs, MeanCollisionType, ScriptDialogEventArgs};
|
|
use libremetaverse_types::UUID;
|
|
use std::time::{Duration, UNIX_EPOCH};
|
|
|
|
fn id(value: u64) -> UUID {
|
|
UUID::new_with_u_int64(value).expect("UUID")
|
|
}
|
|
|
|
#[test]
|
|
fn script_dialog_preserves_constructor_values_and_aliases() {
|
|
let image_id = id(1);
|
|
let object_id = id(2);
|
|
let owner_id = id(3);
|
|
let dialog = ScriptDialogEventArgs::new(
|
|
"Choose".to_owned(),
|
|
"OpenSim object".to_owned(),
|
|
image_id,
|
|
object_id,
|
|
"Grid".to_owned(),
|
|
"Resident".to_owned(),
|
|
-42,
|
|
vec!["Yes".to_owned(), "No".to_owned()],
|
|
owner_id,
|
|
)
|
|
.expect("ScriptDialogEventArgs");
|
|
|
|
assert_eq!(dialog.message(), "Choose");
|
|
assert_eq!(dialog.object_name(), "OpenSim object");
|
|
assert_eq!(dialog.image_id(), image_id);
|
|
assert_eq!(dialog.object_id(), object_id);
|
|
assert_eq!(dialog.first_name(), "Grid");
|
|
assert_eq!(dialog.last_name(), "Resident");
|
|
assert_eq!(dialog.channel(), -42);
|
|
assert_eq!(dialog.button_labels(), ["Yes", "No"]);
|
|
assert_eq!(dialog.owner_id(), owner_id);
|
|
}
|
|
|
|
#[test]
|
|
fn mean_collision_maps_perp_to_aggressor() {
|
|
let aggressor = id(10);
|
|
let victim = id(11);
|
|
let time = UNIX_EPOCH + Duration::from_secs(1234);
|
|
let collision =
|
|
MeanCollisionEventArgs::new(MeanCollisionType::Bump, aggressor, victim, 2.5, time)
|
|
.expect("MeanCollisionEventArgs");
|
|
|
|
assert_eq!(collision.type_(), MeanCollisionType::Bump);
|
|
assert_eq!(collision.aggressor(), aggressor);
|
|
assert_eq!(collision.victim(), victim);
|
|
assert_eq!(collision.magnitude(), 2.5);
|
|
assert_eq!(collision.time(), time);
|
|
}
|