Files
prometeu-runtime/crates/host/prometeu-host-desktop-winit/tests/studio_protocol.rs
T
bquarkz f1adf86dd5
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
feat(runtime): support Studio Play and separate integration gates
Add the windowless Studio host with authenticated binary control/frame channels,
managed input, pause/resume/stop, frame ownership and save-aware shutdown.
Preserve deterministic headless execution and add protocol/process fixtures.
Separate unit CI and coverage from opt-in integration/socket qualification,
retaining the prior combined coverage floors in the configuration history.

Validation: tooling make verify passed runtime ci-domains and integration.
2026-11-19 17:32:02 +00:00

39 lines
1.4 KiB
Rust

use prometeu_host_desktop_winit::studio::wire::*;
#[test]
fn rgba_fixture_pins_channel_order_and_metadata() {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../../devtools/studio-protocol/fixtures/rgba.hex");
let bytes: Vec<u8> = std::fs::read_to_string(path)
.unwrap()
.split_whitespace()
.map(|s| u8::from_str_radix(s, 16).unwrap())
.collect();
let m = Reader::new(bytes.as_slice()).receive().unwrap();
assert_eq!(m.header.kind, FRAME);
assert_eq!(m.header.length, 56);
assert_eq!(&m.payload[..16], &(0u8..16).collect::<Vec<_>>());
assert_eq!(
&m.payload[48..],
&[0xff0000ffu32.to_be_bytes(), 0x0000ff80u32.to_be_bytes()].concat()
);
assert_eq!(frame_bytes(2, 1, 2).unwrap() + FRAME_METADATA_BYTES, m.payload.len());
}
#[test]
fn bootstrap_rejects_wrong_roles_lengths_and_ports() {
let mut p = vec![0; 53];
p[48..50].copy_from_slice(&1234u16.to_le_bytes());
p[50..52].copy_from_slice(&1235u16.to_le_bytes());
p[52] = 1;
let mut bytes = Vec::new();
Writer::new(&mut bytes).send(BOOTSTRAP, 0, &p).unwrap();
let boot = Bootstrap::read(bytes.as_slice()).unwrap();
assert!(boot.disposable);
assert_eq!(boot.hello(1).len(), 49);
p[50..52].copy_from_slice(&1234u16.to_le_bytes());
bytes.clear();
Writer::new(&mut bytes).send(BOOTSTRAP, 0, &p).unwrap();
assert!(Bootstrap::read(bytes.as_slice()).is_err());
}