mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 21:08:18 +00:00
Add test for gray scale node
# Conflicts: # node-graph/gcore/src/raster.rs
This commit is contained in:
parent
ef08c27e9c
commit
7f415febed
2 changed files with 13 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
use core::marker::PhantomData;
|
||||
|
||||
use crate::{value::ValueNode, Node};
|
||||
use crate::Node;
|
||||
|
||||
use self::color::Color;
|
||||
|
||||
|
@ -34,7 +34,15 @@ impl<'n, T: Clone, N: Node<'n, T, Output = T>> Node<'n, &'n mut T> for MutWrappe
|
|||
}
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
let map = ForEachNode(MutWrapper(GrayscaleNode, PhantomData), PhantomData);
|
||||
map.eval(&mut [Color::from_rgbaf32(1.0, 0.0, 0.0, 1.0).unwrap()].iter_mut());
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn map_node() {
|
||||
let array = &mut [Color::from_rgbaf32(1.0, 0.0, 0.0, 1.0).unwrap()];
|
||||
let map = ForEachNode(MutWrapper(GrayscaleNode, PhantomData), PhantomData);
|
||||
map.eval(array.iter_mut());
|
||||
assert_eq!(array[0], Color::from_rgbaf32(0.33333334, 0.33333334, 0.33333334, 1.0).unwrap());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
// use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Structure that represents a color.
|
||||
/// Internally alpha is stored as `f32` that ranges from `0.0` (transparent) to `1.0` (opaque).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue