//! Basic GPU render test for {{ effect_name }}.
//!
//! Runs the full two-pass PremiereGPU pipeline on a checkerboard
//! using default parameters and writes the output as a PNG.

use prgpu::testing::{HostBuilder, ParamValue, builtin_checkerboard, write_png};
use {{ crate_name }}::PremiereGPU;
use {{ crate_name }}::params::Params;

#[test]
fn render_checkerboard_two_pass() {
    let (w, h) = (512, 512);
    let input = builtin_checkerboard(w, h);
    let input_copy = input.clone();

    let ctx = HostBuilder::<PremiereGPU, Params>::new(PremiereGPU::default(), input, w, h)
        .param(Params::EdgeStrength, ParamValue::float(1.0))
        .param(Params::Opacity, ParamValue::float(100.0))
        .param(Params::Tint, ParamValue::color(255, 0, 0, 255))
        .build()
        .expect("HostContext");

    let output = ctx.start().expect("render chain");

    assert!(!output.is_empty(), "output is empty");
    let has_nonzero = output.iter().any(|&b| b != 0);
    assert!(has_nonzero, "output is all black — pipeline may not have run");

    write_png("tests/output/basic.png", &output, w, h, 4).expect("write png");
    let input_changed = output.iter().zip(input_copy.iter()).any(|(a, b)| a != b);
    assert!(input_changed, "output is identical to input — effect may not have applied");
}
