use crate::{
    codegen::SvgDocument,
    types::nodes::{
        primitives::{
            displacement_map::Channel,
            turbulence::{NoiseType, StitchTiles},
        },
        standard_input::StandardInput,
    },
};

#[test]
fn test_displacement_map_simple() {
    let mut doc = SvgDocument::new();

    let displace = doc.create_filter("displace");

    let simple_noise =
        displace.turbulence(0.01, 0.01, 1, 0, StitchTiles::Stitch, NoiseType::Turbulence);
    displace.displacement_map(
        StandardInput::SourceGraphic,
        simple_noise,
        128.,
        Channel::R,
        Channel::R,
    );

    assert_eq!(
        doc.generate_svg(),
        r#"<svg><filter id="displace"><feTurbulence baseFrequency="0.01 0.01" stitchTiles="stitch" result="r6"/><feDisplacementMap scale="128" xChannelSelector="R" yChannelSelector="R" in="SourceGraphic" in2="r6"/></filter></svg>"#
    );
}
