Add tests for Bloom and Cartoon graphs.

This commit is contained in:
Bauke 2024-01-23 13:54:43 +01:00
parent deba03b83f
commit 3312cf055a
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
4 changed files with 126 additions and 0 deletions

25
gegl/tests/bloom.rs Normal file
View File

@ -0,0 +1,25 @@
use {
gegl::{Bloom, GeglOperation},
insta::assert_debug_snapshot,
};
#[test]
fn test_bloom_graph() {
let mut graphs = vec![];
let op = Bloom {
limit_exposure: true,
radius: 100_f64,
softness: 100_f64,
..Default::default()
};
let default = Bloom::default();
graphs.push(("non-default: exclude defaults", op.graph(false)));
graphs.push(("non-default: include defaults", op.graph(true)));
graphs.push(("default: exclude defaults", default.graph(false)));
graphs.push(("default: include defaults", default.graph(true)));
assert_debug_snapshot!("graphs", graphs);
}

23
gegl/tests/cartoon.rs Normal file
View File

@ -0,0 +1,23 @@
use {
gegl::{Cartoon, GeglOperation},
insta::assert_debug_snapshot,
};
#[test]
fn test_cartoon_graph() {
let mut graphs = vec![];
let op = Cartoon {
mask_radius: 0.1,
..Default::default()
};
let default = Cartoon::default();
graphs.push(("non-default: exclude defaults", op.graph(false)));
graphs.push(("non-default: include defaults", op.graph(true)));
graphs.push(("default: exclude defaults", default.graph(false)));
graphs.push(("default: include defaults", default.graph(true)));
assert_debug_snapshot!("graphs", graphs);
}

View File

@ -0,0 +1,43 @@
---
source: gegl/tests/bloom.rs
expression: graphs
---
[
(
"non-default: exclude defaults",
[
"gegl:bloom",
"limit_exposure=true",
"radius=100",
"softness=100",
],
),
(
"non-default: include defaults",
[
"gegl:bloom",
"limit_exposure=true",
"radius=100",
"softness=100",
"strength=50",
"threshold=50",
],
),
(
"default: exclude defaults",
[
"gegl:bloom",
],
),
(
"default: include defaults",
[
"gegl:bloom",
"limit_exposure=false",
"radius=10",
"softness=25",
"strength=50",
"threshold=50",
],
),
]

View File

@ -0,0 +1,35 @@
---
source: gegl/tests/cartoon.rs
expression: graphs
---
[
(
"non-default: exclude defaults",
[
"gegl:cartoon",
"mask_radius=0.1",
],
),
(
"non-default: include defaults",
[
"gegl:cartoon",
"mask_radius=0.1",
"pct_black=0.2",
],
),
(
"default: exclude defaults",
[
"gegl:cartoon",
],
),
(
"default: include defaults",
[
"gegl:cartoon",
"mask_radius=7",
"pct_black=0.2",
],
),
]