Add tests for Bloom and Cartoon graphs.
This commit is contained in:
		
							parent
							
								
									deba03b83f
								
							
						
					
					
						commit
						3312cf055a
					
				| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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",
 | 
			
		||||
        ],
 | 
			
		||||
    ),
 | 
			
		||||
]
 | 
			
		||||
| 
						 | 
				
			
			@ -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",
 | 
			
		||||
        ],
 | 
			
		||||
    ),
 | 
			
		||||
]
 | 
			
		||||
		Reference in New Issue