mirror of
https://github.com/storytold/deckcraft.git
synced 2026-11-01 22:47:04 -06:00
Move gradient editor test module to file end
This commit is contained in:
@@ -45,23 +45,6 @@ pub fn gradient_json(g: &Gradient) -> Value {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn gradient_json_retains_flip_mode() {
|
||||
let gradient = Gradient {
|
||||
stops: vec![],
|
||||
shape: GradientShape::Linear { angle: 90.0, scaled: false },
|
||||
flip: Some(GradientFlip::Xy),
|
||||
rotate_with_shape: true,
|
||||
tile: [0.0; 4],
|
||||
};
|
||||
assert_eq!(gradient_json(&gradient).get("flip"), Some(&json!("xy")));
|
||||
}
|
||||
}
|
||||
|
||||
fn alpha_of(c: &ColorRef) -> f64 {
|
||||
c.mods.iter().find_map(|m| if let ColorTransform::Alpha(a) = m { Some(*a as f64 / 100_000.0) } else { None }).unwrap_or(1.0)
|
||||
}
|
||||
@@ -532,3 +515,20 @@ pub fn pattern_editor(ui: &mut Ui, pt: &PatternFill, sc: &ColorScheme) -> Option
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn gradient_json_retains_flip_mode() {
|
||||
let gradient = Gradient {
|
||||
stops: vec![],
|
||||
shape: GradientShape::Linear { angle: 90.0, scaled: false },
|
||||
flip: Some(GradientFlip::Xy),
|
||||
rotate_with_shape: true,
|
||||
tile: [0.0; 4],
|
||||
};
|
||||
assert_eq!(gradient_json(&gradient).get("flip"), Some(&json!("xy")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user