#[cfg(feature = "cli")]
use std::path::PathBuf;
#[cfg(feature = "cli")]
#[derive(Debug, Clone)]
pub struct ScreenshotInfo {
pub timecode_ms: u128,
pub temp_path: PathBuf,
}
#[cfg(feature = "cli")]
pub fn screenshot_file_name(timecode: u128, ext: &str) -> String {
format!("t-rec-screenshot-{:09}.{}", timecode, ext)
}
#[cfg(feature = "cli")]
pub fn screenshot_output_name(base: &str, timecode: u128, format: &str) -> String {
format!("{}_screenshot-{}.{}", base, timecode, format)
}
#[cfg(all(test, feature = "cli"))]
mod tests {
use super::*;
#[test]
fn test_screenshot_file_name() {
assert_eq!(
screenshot_file_name(12345, "bmp"),
"t-rec-screenshot-000012345.bmp"
);
}
#[test]
fn test_screenshot_output_name() {
assert_eq!(
screenshot_output_name("t-rec", 12345, "png"),
"t-rec_screenshot-12345.png"
);
}
}