mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-29 09:34:20 +01:00
test(xfl): tighten native color effect parity
This commit is contained in:
1 parent
7a05cc1f08
commit
de7f52f207
2 files changed
+8
-6
No files matched your search
@@ -622,10 +622,7 @@ impl<'a> Builder<'a> {
|
||||
if alpha != 1.0 { bright.with_alpha(alpha) } else { bright }
|
||||
} else {
|
||||
let offsets = native.offsets().map(|value| value / 255.0);
|
||||
let t = ColorTransform {
|
||||
mul: multipliers,
|
||||
add: offsets,
|
||||
};
|
||||
let t = ColorTransform { mul: multipliers, add: offsets };
|
||||
if t.changes_colour() || t.add[3] != 0.0 {
|
||||
ColorEffect::Advanced(t)
|
||||
} else if alpha != 1.0 {
|
||||
|
||||
@@ -226,7 +226,8 @@ fn shared_native_color_effect_view_preserves_anicraft_style_mapping() {
|
||||
let (doc, _) = import(&files).unwrap();
|
||||
let elements = &doc.timeline(0).layers[0].keyframes[0].elements;
|
||||
|
||||
let tint = ColorTransform { mul: [0.75, 0.75, 0.75, 0.5], add: [0.25 * 0x33 as f32 / 255.0, 0.25 * 0x66 as f32 / 255.0, 0.25 * 0x99 as f32 / 255.0, 0.0] };
|
||||
let mut tint = ColorTransform::tint(Rgba::hex(0x336699), 0.25);
|
||||
tint.mul[3] = 0.5;
|
||||
assert_eq!(elements[0].name, "Tint");
|
||||
assert_eq!(elements[0].color, ColorEffect::Advanced(tint).sanitized(), "tint keeps precedence over brightness and composes alpha");
|
||||
|
||||
@@ -236,7 +237,11 @@ fn shared_native_color_effect_view_preserves_anicraft_style_mapping() {
|
||||
|
||||
let advanced = ColorTransform { mul: [2.0, 1.0, -0.5, 0.5], add: [1.0, -0.5, 0.0, 128.0 / 255.0] };
|
||||
assert_eq!(elements[2].name, "Advanced");
|
||||
assert_eq!(elements[2].color, ColorEffect::Advanced(advanced).sanitized(), "invalid multipliers default to identity and offsets stay in XFL byte units until mapping");
|
||||
assert_eq!(
|
||||
elements[2].color,
|
||||
ColorEffect::Advanced(advanced).sanitized(),
|
||||
"invalid multipliers default to identity and offsets stay in XFL byte units until mapping"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user