#[cfg(feature = "hit")]
#[cfg(test)]
mod hardware_integration_tests {
use depthai::{DaiError, Device, Pipeline, PipelineConfig};
#[test]
fn test_device_creation_with_hardware() {
let device =
Device::new().expect("Failed to create device - ensure DepthAI hardware is connected");
assert!(device.is_connected(), "Device should be connected");
let device_info = device.get_device_info();
assert!(device_info.is_ok(), "Should be able to get device info");
println!("Device created successfully with hardware");
}
#[test]
fn test_pipeline_creation_with_hardware() {
let pipeline = Pipeline::new()
.build()
.expect("Failed to create pipeline - ensure DepthAI hardware is connected");
assert!(
!pipeline.is_running(),
"Pipeline should not be running initially"
);
println!("Pipeline created successfully with hardware");
}
#[test]
fn test_pipeline_with_config_and_hardware() {
let config = PipelineConfig {
create_implicit_device: true,
..Default::default()
};
let pipeline = Pipeline::with_config(config)
.expect("Failed to create pipeline with config - ensure DepthAI hardware is connected");
let retrieved_config = pipeline.get_config();
assert!(
retrieved_config.create_implicit_device,
"Config should have create_implicit_device set to true"
);
println!("Pipeline with config created successfully with hardware");
}
#[test]
fn test_device_ffi_connection_with_hardware() {
let device =
Device::new().expect("Failed to create device - ensure DepthAI hardware is connected");
let connected = device.is_connected_ffi();
assert!(connected, "Device should be connected via FFI");
println!("Device FFI connection test passed with hardware");
}
}