use wintf::com::d2d::D2D1DeviceExt;
use wintf::ecs::{GraphicsCommandList, GraphicsCore};
#[test]
fn empty_has_no_command_list() {
let cl = GraphicsCommandList::empty();
assert!(cl.command_list().is_none());
}
#[test]
fn new_wraps_real_command_list() {
let graphics = GraphicsCore::new().expect("GraphicsCore creation");
let device = graphics.d2d_device().expect("d2d device");
let raw = device.create_command_list().expect("command list");
let component = GraphicsCommandList::new(raw.clone());
assert!(component.command_list().is_some());
assert_eq!(component.command_list(), Some(&raw));
}
#[test]
fn clone_and_partial_eq_semantics() {
let graphics = GraphicsCore::new().expect("GraphicsCore creation");
let device = graphics.d2d_device().expect("d2d device");
let raw = device.create_command_list().expect("command list");
let a = GraphicsCommandList::new(raw);
let b = a.clone();
assert_eq!(a, b, "clone shares the same COM pointer");
assert_eq!(GraphicsCommandList::empty(), GraphicsCommandList::empty());
assert_ne!(a, GraphicsCommandList::empty());
let other = device.create_command_list().expect("second command list");
assert_ne!(a, GraphicsCommandList::new(other));
}
#[test]
fn debug_format_contains_type_name() {
let cl = GraphicsCommandList::empty();
let s = format!("{:?}", cl);
assert!(s.contains("GraphicsCommandList"), "debug output: {s}");
}
#[test]
fn command_list_is_send_sync() {
fn assert_send_sync<T: Send + Sync>() {}
assert_send_sync::<GraphicsCommandList>();
}