feat: wire vertical exaggeration through the shell #13
+85
@@ -469,6 +469,55 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn info_text_lists_quality_presets() {
|
||||||
|
let text = info_text();
|
||||||
|
assert!(text.contains("preview"));
|
||||||
|
assert!(text.contains("balanced"));
|
||||||
|
assert!(text.contains("final"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn supported_quality_presets_lists_preview_balanced_and_final() {
|
||||||
|
let qualities = supported_quality_presets();
|
||||||
|
assert!(qualities.contains(&"preview"));
|
||||||
|
assert!(qualities.contains(&"balanced"));
|
||||||
|
assert!(qualities.contains(&"final"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn resolve_render_output_path_uses_quality_suffix_for_directories() {
|
||||||
|
let dir = temp_output_dir("quality-path");
|
||||||
|
let preview = resolve_render_output_path(&dir, Preset::Hill, RenderQualityPreset::Preview);
|
||||||
|
let final_path = resolve_render_output_path(&dir, Preset::Hill, RenderQualityPreset::Final);
|
||||||
|
|
||||||
|
assert_ne!(preview, final_path);
|
||||||
|
assert_eq!(preview.file_name().and_then(|s| s.to_str()), Some("openvistapro-hill-preview.png"));
|
||||||
|
assert_eq!(final_path.file_name().and_then(|s| s.to_str()), Some("openvistapro-hill-final.png"));
|
||||||
|
std::fs::remove_dir_all(&dir).ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_render_with_quality_preset() {
|
||||||
|
let cli = Cli::try_parse_from([
|
||||||
|
"openvistapro",
|
||||||
|
"render",
|
||||||
|
"--preset",
|
||||||
|
"hill",
|
||||||
|
"--quality",
|
||||||
|
"final",
|
||||||
|
"--output",
|
||||||
|
"/tmp/out.png",
|
||||||
|
])
|
||||||
|
.unwrap();
|
||||||
|
match cli.command {
|
||||||
|
Command::Render(args) => {
|
||||||
|
assert_eq!(args.quality, RenderQualityPreset::Final);
|
||||||
|
}
|
||||||
|
_ => panic!("expected render"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn temp_output_path(tag: &str) -> PathBuf {
|
fn temp_output_path(tag: &str) -> PathBuf {
|
||||||
let mut path = std::env::temp_dir();
|
let mut path = std::env::temp_dir();
|
||||||
path.push(format!(
|
path.push(format!(
|
||||||
@@ -480,6 +529,18 @@ mod tests {
|
|||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn temp_output_dir(tag: &str) -> PathBuf {
|
||||||
|
let mut dir = std::env::temp_dir();
|
||||||
|
dir.push(format!(
|
||||||
|
"openvistapro-cli-{}-{}-dir",
|
||||||
|
tag,
|
||||||
|
std::process::id()
|
||||||
|
));
|
||||||
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
dir
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn execute_render_plane_writes_png_with_requested_dimensions() {
|
fn execute_render_plane_writes_png_with_requested_dimensions() {
|
||||||
let path = temp_output_path("plane");
|
let path = temp_output_path("plane");
|
||||||
@@ -527,6 +588,30 @@ mod tests {
|
|||||||
std::fs::remove_file(&path).ok();
|
std::fs::remove_file(&path).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn execute_render_uses_quality_specific_filename_for_output_directories() {
|
||||||
|
let dir = temp_output_dir("quality-exec");
|
||||||
|
let cli = Cli::try_parse_from([
|
||||||
|
"openvistapro",
|
||||||
|
"render",
|
||||||
|
"--preset",
|
||||||
|
"hill",
|
||||||
|
"--quality",
|
||||||
|
"final",
|
||||||
|
"--width",
|
||||||
|
"8",
|
||||||
|
"--height",
|
||||||
|
"8",
|
||||||
|
"--output",
|
||||||
|
dir.to_str().unwrap(),
|
||||||
|
])
|
||||||
|
.unwrap();
|
||||||
|
execute(cli).expect("execute should succeed");
|
||||||
|
let derived = dir.join("openvistapro-hill-final.png");
|
||||||
|
assert!(derived.exists(), "expected derived output path {derived:?}");
|
||||||
|
std::fs::remove_dir_all(&dir).ok();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parses_render_with_camera_demo_flag() {
|
fn parses_render_with_camera_demo_flag() {
|
||||||
let cli = Cli::try_parse_from([
|
let cli = Cli::try_parse_from([
|
||||||
|
|||||||
Reference in New Issue
Block a user