use rustybara::raster::RenderConfig;
#[test]
fn render_config_default_150dpi() {
let cfg = RenderConfig::default();
assert_eq!(cfg.dpi, 150);
assert!(cfg.render_annotations);
assert!(cfg.render_form_data);
}
#[test]
fn render_config_prepress_300dpi() {
let cfg = RenderConfig::prepress();
assert_eq!(cfg.dpi, 300);
assert!(cfg.render_annotations);
assert!(cfg.render_form_data);
}
#[test]
fn dpi_pixel_math_150() {
let dpi: f32 = 150.0;
let width_pts: f32 = 612.0;
let height_pts: f32 = 792.0;
let px_w = (width_pts / 72.0 * dpi) as i32;
let px_h = (height_pts / 72.0 * dpi) as i32;
assert_eq!(px_w, 1275);
assert_eq!(px_h, 1650);
}
#[test]
fn dpi_pixel_math_300() {
let dpi: f32 = 300.0;
let width_pts: f32 = 612.0;
let height_pts: f32 = 792.0;
let px_w = (width_pts / 72.0 * dpi) as i32;
let px_h = (height_pts / 72.0 * dpi) as i32;
assert_eq!(px_w, 2550);
assert_eq!(px_h, 3300);
}
#[test]
fn dpi_pixel_math_72() {
let dpi: f32 = 72.0;
let width_pts: f32 = 612.0;
let height_pts: f32 = 792.0;
let px_w = (width_pts / 72.0 * dpi) as i32;
let px_h = (height_pts / 72.0 * dpi) as i32;
assert_eq!(px_w, 612);
assert_eq!(px_h, 792);
}
#[test]
#[ignore] fn render_page_produces_image() {
let fixture = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests/fixtures/pdf_test_data_print_v2.pdf");
if !fixture.exists() {
eprintln!("Skipping: fixture not found at {}", fixture.display());
return;
}
todo!("requires PDFium native library setup");
}