use crate::{
    codegen::SvgDocument,
    types::nodes::{primitives::color_matrix::ColorMatrixType, standard_input::StandardInput},
};

#[test]
fn test_greyscale_channel_extraction() {
    let mut doc = SvgDocument::new();
    let greyscale = doc.create_filter("greyscale");

    greyscale.color_matrix(
        StandardInput::SourceGraphic,
        ColorMatrixType::Matrix(Box::new([
            1., 0., 0., 0., 0., //
            1., 0., 0., 0., 0., //
            1., 0., 0., 0., 0., //
            0., 0., 0., 1., 0.,
        ])),
    );

    assert_eq!(
        doc.generate_svg(),
        r#"<svg><filter id="greyscale"><feColorMatrix values="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0" in="SourceGraphic"/></filter></svg>"#
    );
}
